Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Inventory items  (Read 5876 times)

0 Members and 2 Guests are viewing this topic.

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Inventory items
« on: February 17, 2009, 05:54:27 AM »

I would like to use an inventory item picked up in one scene on an inventory item picked up in another scene or delete an inventory item picked up in one scene in another scene.  I seem to be having problems.  Is it necessary to use some global?

Is there a difference between actor.TakeItem and Game.TakeItem?

I'm using actor.TakeItem("nameofitem");

Also, when you use the inventory picked up in one scene on an item picked up in another scene, the item picked up should disappear but the original item should not.

Am having the game freeze when I do this.  Any help is appreciated.
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Birdline

  • Supporter
  • Occasional poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 57
    • View Profile
    • Birdline Web Site
Re: Inventory items
« Reply #1 on: February 17, 2009, 08:05:34 AM »

If you have just one inventory, you should use Game.TakeItem, and Game.DropItem.
If you have multiple inventories (for each actor), you use ActorName.TakeItem.
Normally, you should not have problems adding/removing items from scene to scene.

Spyros

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Inventory items
« Reply #2 on: February 17, 2009, 08:12:40 AM »

I have only one inventory.  Thanks, Spyros. Now I understand that part.

Let me see if this solves my problem of using one inventory item found in one scene on another found in another scene and then deleting one of those inventory items with the other one still existing.

Essentially I have a herbal system where you get a mortar in one scene and should be able to use it in other scenes on items like a rose to increase your herbalism stats.  The rose gets deleted but the mortar stays in inventory.  I just get a frozen system no matter how I do it.

This is all happening in your inventory.

I will try it anew.  :  )  Thanks again.
« Last Edit: February 17, 2009, 08:46:08 AM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

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: Inventory items
« Reply #3 on: February 18, 2009, 12:45:22 AM »

Have a look at your main game script. There is a line setting the global inventory to the actors inventory.
game.takeitem uses the global inventory container, the one currently displayed on the screen. but this container is in fact an actors inventory. so mainactor.takeitem and game.takeitem should be identical if the variable is set correctly.
Logged
... delete the inner sleep ...

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Inventory items
« Reply #4 on: February 19, 2009, 05:20:00 AM »

Yes, sychron, I can use either actor.TakeItem or Game.TakeItem.  I just experimented with that.  Thanks.

My problem arises when I want to use an item in inventory on another item in inventory that will be deleted but the original item in inventory will remain---the game freezes---it's as though the item I'm using on the item to be deleted is stuck in the deletion process.

I have a mortar in inventory.  I would like to use it on a rose in inventory.  When you use the mortar on the rose, the rose should disappear and the mortar still remain in inventory--but the game freezes.  Any help is welcome. : )  I have a walkaround for this but I'd like to figure out why I can't get it to work.  : )   
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Inventory items
« Reply #5 on: February 19, 2009, 03:14:54 PM »

I solved this---it was a tiny problem with the way I called a method that ran when the items were combined.  :  )  Thanks for your help.
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  
 

Page created in 0.305 seconds with 23 queries.