inventory on inventory

Started by ln888, Mon 26/08/2013 21:51:07

Previous topic - Next topic

ln888

hi,
I want to use an inventory item, on other inventory item, to create a new item
how to i do that ?

Mouth for war

#1
Doubleclick on Inventory items. Then doubleclick on the item you want something to be used on. Click on the lightning bolt and select "Use inventory on this item" In this example I use a magnet

in the script: (without the // stuff)

if (player.ActiveInventory==istring){             //The item to be used on the magnet
cEgo.LoseInventory(imagnet);                     //player lose magnet
cEgo.LoseInventory(istring);                    //player lose string
cEgo.AddInventory(imagstring);                 //player gets magnet with string attached to it
}
else{
Display ("That won't work");                   //player tries to use something else on the magnet
}
}                 
mass genocide is the most exhausting activity one can engage in, next to soccer


Ryan Timothy B

Mouth for war, use the code tags:

Second of all, if you're going to post code to assist people, try to use indentation so they can learn from your example instead of spawning even more unreadable script. Thanks.
Because of your lacking indentation you failed to notice you had an extra closing brace.

Code: ags
if (player.ActiveInventory==istring) {   //The item to be used on the magnet
  cEgo.LoseInventory(imagnet);                     //player lose magnet
  cEgo.LoseInventory(istring);                     //player lose string
  cEgo.AddInventory(imagstring);                   //player gets magnet with string attached to it
} else {
  Display ("That won't work");                     //player tries to use something else on the magnet
}

Mouth for war

Ahh i was unaware of those tags. Sorry about that  :-)
mass genocide is the most exhausting activity one can engage in, next to soccer

SMF spam blocked by CleanTalk