Galactygon Posted November 6, 2005 Share Posted November 6, 2005 How exactly do I code this? I am right now in the midst of coding a spell that allows you to pick up ground piles from afar as one of its features (PnP Telekinesis), where you summon an invisible creature that does all the dirty work for you. Picking up items and giving them to the caster is easy, but I don't know how to check for the presence of ground piles and such. If I simply code this for every single item in the game... IF True() THEN RESPONSE #100 PickUpItem("ITEM01") Continue() END ...then my script will be stuck if ITEM01 does not exist or is not in range. And using Range() does not help either, because it does not work with ground piles. An idea I have is to check for a nearby groundpile via container name and then use the Contains() trigger, but I don't think it's possible to do that with ground piles. -Galactygon Link to comment
Avenger Posted November 10, 2005 Share Posted November 10, 2005 Ground piles in the original ie got no name Link to comment
SimDing0 Posted November 10, 2005 Share Posted November 10, 2005 If a dead creature has dropped a ground pile you can move to the corpse and use PickUpItem, but I seem to recall finding it wasn't terribly reliable. Link to comment
Galactygon Posted November 10, 2005 Author Share Posted November 10, 2005 I could try and search for a container and use the Contains() trigger with the combination of the Range() trigger and the PickUpItem() action and see what it does. If it works, then it would be a useful addition to the IESDP. -Galactygon Link to comment
Galactygon Posted November 13, 2005 Author Share Posted November 13, 2005 From my test runs, it seems the PickUpItem() command is skipped when there are no such items to pick up. That means if you apply the Continue() command after the PickUpItem() command, the creature will pick up items from containers and groundpiles until there are no such items to pick up. However, because the scripting block will still be checked, it will slow scripts down by quite a bit if you place a large amount of PickUpItem() blocks. My initial solution for this is the following: 1.) Check for the level, class, etc. of the creature when determining which items (s)he is interested in. A level 18 mage is unlikely to pick up a wand of the heavens or a priest scroll or a Sword +5. He might pick up a wand of magic missiles if he runs out of spells. A wolfwere or an orc is unlikely to pick up any magic items, since they don't have the sufficient lore to identify what it is. An orc might pick up a battleaxe +3, because it looks like an OMG KOOL weapon. A slime is unlikely going to pick up any items, and a fire giant will find a dagger a bit too small for him. 2.) There should be a timer checking for dropped items, so the creature doesn't always go through the thousands of blocks each time it wishes to execute an action after the blocks (ie attacking, spellcasting, etc.). A timer expiring every fifth round is sufficient. 3.) Many PickUpItem() commands could be cramped into a single block. I have used this, and it works. Here is an example: IF Class(Myself,LONG_BOW) !GlobalTimerNotExpired("PickUpItems","LOCALS") THEN RESPONSE #100 SetGlobalTimer("PickUpItems","LOCALS",30) PickUpItem("WAND01") PickUpItem("WAND02") PickUpItem("WAND03") ... Continue() END The only problem with this method is that creatures will loot containers within dungeons, but I guess that is more logical than having treasure sitting around. -Galactygon Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.