Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Problem with inventory Switching betwene to actors.  (Read 3705 times)

0 Members and 1 Guest are viewing this topic.

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 352
    • View Profile
    • Jyujinkai's WME Development Blog
Problem with inventory Switching betwene to actors.
« on: October 12, 2007, 02:20:55 AM »

Hi there.... I have almost got the code all working to have the two inventories. One for spells and one for items. The problem is that i can pick up items fine and add the to either inventory.. all that is working. This is done using the code "Game.InventoryObject = spellActor;". The thing is after i use that spell the inventory that shows is the spell inventory... and i can not seam to get it to switch back. Using "Game.InventoryObject = actor;" dose somthing not sure wat, as it shows a diffrent inventory to the spellactor but it is blank and dose not have the items form before.

Any ideas?

my actor code is

Code: WME Script
  1. // load our main actor
  2. actor = Game.LoadActor3D("actors\sandra\sandra.act3d");
  3. Game.MainObject = actor;
  4. // Load the spell actor Global set in base.inc
  5. spellActor = Game.LoadActor("actors\spell\spell.actor");

the code i am using to change the inventory is

Code: WME Script

Recap
  • I can pick up items and send them to the actors
  • I can use the code "Game.InventoryVisible = true/false;" to hide and open the inventory. Showing only the items, witch are sent to the "actor" using "Game.TakeItem("bag");"
  • I can click on the spell book icon with the "Game.InventoryObject = spellActor;" code and use "Game.InventoryVisible = true/false;" to see ONLY the spells sent to it using the "spellActor.TakeItem("fireball");"
  • But once i have viewed the spell book i can not switch the iinventory back using "Game.InventoryObject = actor;". If i call that then original inventorty go blank.

<---------- Edit

no Luuck fixing this .. i think it is working as the inventory changes it is like the "Game.InventoryObject = actor;" is loading a 34d new inventory rather than the original inventory?

« Last Edit: October 12, 2007, 06:43:51 AM by Jyujinkai »
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Problem with inventory Switching betwene to actors.
« Reply #1 on: October 12, 2007, 07:00:32 AM »

By default the initial inventory object is Game, not actor (unless you explicitly change it when starting the game). So I think if you replace:

  Game.InventoryObject = actor;

with

  Game.InventoryObject = Game;

it should work just fine.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Problem with inventory Switching betwene to actors.
« Reply #2 on: October 12, 2007, 07:04:56 AM »

and if you are using multiple inventories, I strongly recommend to stop using Game.TakeItem altogether to avoid this confusion.

see this thread for some ideas: http://forum.dead-code.org/index.php?topic=2388.0

Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 352
    • View Profile
    • Jyujinkai's WME Development Blog
Re: Problem with inventory Switching betwene to actors.
« Reply #3 on: October 12, 2007, 07:30:11 AM »

@menmonic - That totally fixed it thanks mate

@meta - Yea i read that post but i think it will not really apply in my case. if i was using to PLAYABLE actors then sure that is cool. But the 2nd actor is really nothing more than a container to store the 2nd inventory for spells. it is nvr loaded or used or anything. Besides it is working now and i do nto want to screw with it lol.
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Problem with inventory Switching betwene to actors.
« Reply #4 on: October 12, 2007, 08:02:11 AM »

well, it's the question of programming semantics. My point was that if you're using multiple actors with their own inventories, it doesn't matter if they are sprites or 3d models, but the inventory logic should be the same because then you won't have a heterogenous way how to access the same kind of inventory logic. This applies not only to inventory but enough of boring theories, use whatever works for you fine. :)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

sychron

  • Wanderer zwischen den Welten
  • Global Moderator
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 223
  • There is no spoon. The enemy gate is down!
    • View Profile
Re: Problem with inventory Switching betwene to actors.
« Reply #5 on: October 12, 2007, 01:38:25 PM »

My part of the code uses direct commands like "spellActor.TakeItem()";

Logged
... delete the inner sleep ...
 

Page created in 0.056 seconds with 24 queries.