• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

(Simple) buff effect

Status
Not open for further replies.
Level 3
Joined
Feb 25, 2009
Messages
38
Yo!
so i wanted to make an aura that give a buff to nearby units. the buff will give a 20% chance to spawn a specific unit owned by the caster when the unit affected by the buff dies.

i have everything i need done, other than the trigger that spawns the actual unit, and i can't remember how to make the game do a random roll....

for example:
pick a random number between 1 and 5. if the picked number is 1, spawn unit. else, do nothing.
 
Level 3
Joined
Feb 25, 2009
Messages
38
i don't think that's how i make the game roll, just do something with the roll, because it doesn't spawn any units D:
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Debug the script. Test the rolling by displaying a debug message (like ROLL PASS).

If the message does not show after a large number of tries (about 500-1000 would be enough for certain) then there must be a error before or executing the roll. If the message does show, the error must exist in the actions the roll is meant to carry out.
 
Level 3
Joined
Feb 25, 2009
Messages
38
okay, i tried 10 times (each with 100 units killed, matching all conditions), but still no skeletons..

i used a trigger to set my hero as "GrandNecro"

then i use this trigger:
  • Aura of the Dead
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 2) Equal to 1
          • ((Dying unit) has buff Aura of the Dead ) Equal to True
        • Then - Actions
          • Unit - Create 1 Skeleton Warrior for (Owner of GrandNecro) at (Position of (Dying unit)) facing (Position of (Dying unit))
          • Game - Display to (All players) the text: YAY! IT WORKS!!
        • Else - Actions
          • Do nothing
it might be all messed up, but according to my self-learned knowledge, this SHOULD work...!
 
Level 3
Joined
Feb 25, 2009
Messages
38
ooh.. right... fak me... >_>

or wait.. does it work if i make the aura that gives the buff, target dead aswell? ;o

if no, how can i fix it?
 
Yep, they obviously don't :p
You can only detect abilities on dying units. When a unit gets the buff, add it in a global unit group and instead of checking whether it has that buff, check if it is in the unit group; if it is, spawn the skeleton and remove it from the group. To check when a unit gets the buff, you can use Unit - A unit comes in range of unit or a periodic event that counts nearby units (not recommended) or simply a custom aura system from the Spells section.

Do nothing is unnecessary, the trigger won't do anything either way.
 
Level 3
Joined
Feb 25, 2009
Messages
38
can someone please take the time to make a working trigger for this? i can't think of any ways to do it -_-

i'll +rep for it :D
 
Level 10
Joined
Jul 12, 2009
Messages
321
I know two ways to detect buffs when a unit dies:
1. Give the units a custom ability based on Spawn Hydra that summons a dummy unit; use a summoning event to detect when a unit spawns that dummy, and whether it has the buff. This happens when a unit dies but before it is "dead".
2. Use damage detection to detect when a unit takes damage greater than its current health, and whether it has the buff; after a short delay, check if it's dead (either use a short wait, or for more precision, add it to a group and start a 0 second timer after which you test all units in that group, then clear the group). The wait is needed because some other trigger might block the damage and the unit might live.
 
Level 3
Joined
Feb 25, 2009
Messages
38
i think that dummy theory would be the best in practical terms, but then i'd have to add the hydra skill to ALL units, as it's not a specific unit that's getting attacked. it would probably work just fine in the beginning, but it'd get awfully laggy after a while. i tried something similar before, and after around 5 min of playing my FPS dropped to around 2..

i thought about changing the skill so that it triggers when the unit has 1% hp, instead of when it dies, but i can't find a function for "Generic unit event - health", only specific unit...:vw_death:

i COULD proabaly make it a unit-group related trigger...
 
Level 5
Joined
Sep 1, 2010
Messages
168
I'd suggest going with the unit group
Just run every 1.5 seconds (or less, if you prefer (I'd suggest not more often than 0.5 secs); remember that auras last a bit longer on a unit when they exit the aura giving unit's range) a trigger that checks whether a unit has the specific buff and/or is dead and remove that unit from the unitgroup.
This way the group becomes smaller, faster to check and shouldn't drop your fps rate too much.

What might be a bigger issue with lags and so on would be removing leaks from creation if you haven't cleared them up already.
 
Level 3
Joined
Feb 25, 2009
Messages
38
seems like i'll be going with a unit-group trigger, then.

as i'm still on moderate triggering level, i have little or no knowledge on leaks D:
 
Level 3
Joined
Feb 25, 2009
Messages
38
thanks ^^

just a question for later on. can i have multiple units set as a specific unit variable, or will the second to be set as the unit replace the first?

i'm looking for something like "any unit in UnitGroup's health becomes less than X% of base health"-effect for another project...

EDIT: also, i can't figure out what event referrs to buffs.
  • Unit - A unit Starts the effect of an ability
this one?
 
Level 5
Joined
Sep 1, 2010
Messages
168
1)You can only check every unit in a unit group every xyz seconds and if the amount of life is less than xzt -> do something OR check when a unit is damaged, if that unit belongs to a specific unit group and if that unit's health is less than xZ!&@? do something.
(for damage checks you either need a damage detection system (there are several good ones on the hive) or use another trigger event- unit enters playable map area -> action: trigger: add to trigger (whatever you need) the event - triggering unit receives damage).
2)You can make no responses to buffs. But you can check when a unit starts the effect of an ability if that ability is equal to something or if (target/triggering) unit has a specific buff as a boolean comparison.

Hope that helps :)
 
Status
Not open for further replies.
Top