Destroy Torches, Player and Inventory

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Destroy Torches, Player and Inventory

Post by Mysterious »

Hi guys.

I want to make a Script that Destroys all the torches in the players hand and inventory, but not in the Level. I have searched the Forum and I am lost.

Is it possible to do it??

Thank you for any help.. :)
User avatar
Leki
Posts: 550
Joined: Wed Sep 12, 2012 3:49 pm

Re: Destroy Torches, Player and Inventory

Post by Leki »

Mysterious wrote:Hi guys.

I want to make a Script that Destroys all the torches in the players hand and inventory, but not in the Level. I have searched the Forum and I am lost.

Is it possible to do it??

Thank you for any help.. :)
Try harder m8, it's very simple, let me say "basic script"... viewtopic.php?f=14&t=3099 ;)
I'm the Gate I'm the Key.
Dawn of Lore
User avatar
DesperateGames
Posts: 90
Joined: Sun Oct 06, 2013 1:54 pm

Re: Destroy Torches, Player and Inventory

Post by DesperateGames »

Yeah Leki is right, this is very basic and a good exercise for learning...to give you some starting points: You can access the stuff each champion is carrying with the following functions:
Champion:insertItem(slot, item)
Inserts an item to an equipment slot. Slot must be one of the following: 1 (head), 2 (torso), 3 (legs), 4 (feet), 5 (cloak), 6 (neck), 7 (left hand), 8 (right hand), 9 (gaunlets), 10 (bracers), 11-31 (backpack slots).

Champion:removeItem(slot)
Removes an item from an equipment slot.

Champion:getItem(slot)
Returns an item in an equipment slot.
So you would need to

1.) Loop through all champions in the party
2.) Loop through all inventory slots as mentioned above
3.) If there is a torch you need to remove it from the inventory.

Bonus challenges: To be 100% correct you also need to check inside containers such as bags or boxes and the item that the player is "carrying" with the mouse cursor.
Post Reply