HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Help: What am I doing wrong?

06-07-2003, 01:22 AM#1
FongJune
I'm trying to create a trigger that will detect when a hero acquires an item like a tome, he will automatically use it. However, when my hero buys the item (like the manual of health) the first time, he doesn't use it automatically. When I buy another, he then uses the previously bought one. What gives?

Here's my code by the way.

Events
-Unit - A unit owned by Player 1 Acquires an item
-Unit - A unit owned by Player 2 Acquires an item
...yadda yadda yadda...
-Unit - A unit owned by Player 12 Acquires an item

Conditions
-None

Actions
-Unit Group - Pick every unit in (Units in Playable map area) matching (((Matching Unit) is A Hero) Equal to True)) and do (Hero - Order (Picked Unit) to use (Item carried by (Picked Unit) of Manual of Health))

Any ideas on what's wrong or what I should do instead? Thanks in advance.
06-07-2003, 01:48 AM#2
angelofdeathx
I don't really know what is wrong but i do know a of a way that obtains the same result:
Event
Every .75 seconds of the game
Actions
Unit Group - Pick every unit in (units in playable map area) and do (Hero - Order (picked unit) to use (Item carried by (picked unit) of type (tome1))
Unit Group - Pick every unit in (units in playable map area) and do (Hero - Order (picked unit) to use (Item carried by (picked unit) of type (tome2))
etc..
06-07-2003, 03:13 AM#3
bludragn
Put in a Wait - 0.01 seconds right before the main action. There is a slight delay in acquiring an item and it being loaded into the inventory, therefore the game was trying to use an item you didn't have.

Or for a shorter trigger:

Wait 0.01 seconds
Hero - Order (Triggering unit) to use (<itemX>)
06-07-2003, 04:48 AM#4
Guest
angelofdeathx,
dont you think that a trigger firing every 3/4ths of a second is extreme? i mean, it just seems that that kind of demand on a computer is bound to cause lag (eventually). why wouldn't you just have a trigger that fires when a unit acquires an item anyway? then it only fires when needed and then you can use the item being manipulated references which are very useful.