| 08-11-2004, 11:08 AM | #1 |
Ok I got this problem, I need to make a trigger that makes a unit drop an item if it has a certain buff when it dies. Basicly it works like this: Hero casts spell "loot when dead" Unit has "lootable" buff and then dies Center location at triggering unit and create "short sword" But if the buff runs out before it dies then it does nothing I've tried everything I can get it to work properly. Please help! Thanks |
| 08-11-2004, 12:32 PM | #2 |
When a unit dies, it immediately looses many attributes that are no longer important, including information about any buffs the unit may have. The only way around this I see is to use an alternative method to store the information about the buff. A simple way would be with a unit group: Code:
Events: A unit starts the effect of an ability Conditions: Ability being cast equal to Loot when Dead Actions: Unit group - add (target unit of ability being cast) to GonnaLooseTheirShoesUnitGroup Code:
Events:
Periodic event - every 1 second of game-time
Conditions:
Actions:
Pick every unit in GonnaLooseTheirShoesUnitGroup and do actions
loop - actions:
if ((picked unit) has buff (Loot when Dead) equal to true) then (do nothing) else (unit group - remove picked unit from GonnaLooseTheirShoesUnitGroup)Code:
Events: a unit dies Conditions: ((dying unit) is in (GonnaLooseTheirShoesUnitGroup)) equal to true Actions: Set TempPoint = (position of (dying unit)) item - create whatever item at TempPoint custom script: call RemoveLocation( udg_TempPoint ) The system isn't 100% exact, a unit can already loose the buff, but if it dies right after that, it may still be in the unit group, but I think you don't need it to be so precise, and you can increase precision with making the periodic trigger run more times per second anyway. |
| 08-11-2004, 06:50 PM | #3 |
Anitarf - yea this is a inapproite comment but i like the unit group name.. "Gonnaloosetheirshoesunitgroup" |
