• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to start this trigger (buffs)

Status
Not open for further replies.
Level 6
Joined
Jan 17, 2014
Messages
166
Hi y'all,

Im making a unit who has 3 spells. Each spell gives a buff. And when the first buff is placed, a timer should go for 5 sec. After that timer is finished, the trigger should look at the unit and count howmany buffs there are (1,2 or 3). Then (optinal: remove the buffs and) give damage equal to the buffs. Like 50 damage for 1 buff, 125 damage for 2 buffs and 175 for 3 buffs.

My problem is, what triggers should i use. And how do i begin.
Thx in advance
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Not sure if there exists an equation to calculate the damage. Let's say you save damage amount in an array upon map initialization.
e.g.
  • Set Dmg[1] = 50.00
  • Set Dmg[2] = 125.00
  • Set Dmg[3] = 175.00
Now the trigger will depend on whether this spell should be MUI/MPI or not. If it can be used by only one unit in game, then you do something like this:
1) Unit casts an ability
2) the ability is one of the following: Ability1, Ability2, Ability3
3) Turn off the trigger
4) Save the caster and the target.
5) Make some kind of wait that lasts for 5 seconds
6) Run a trigger that sets some random int value to 0.
7) That trigger will check each buff separately in its own If/Then/Else.
8) If target has specific buff (buff from Ability1/Ability2/Ability3), increase value of int by 1
9) Lastly, after all three ITEs, if value of int is greater than 0, deal Dmg[int value] to the target and switch the initial trigger back on.

---
If it were to be MUI or MPI, you would need to use a boolean variable called for example "AlreadyActive" or something. Default value should be false and when unit casts the spell, you change the value to true. Whenever unit casts one of the three spells, you check the value of the boolean and let the trigger continue only if the value is set to False... basically instead of switching trigger off and then back on, you would set the value of boolean to True and then back to False.
A better option here than variables would be hashtable, but the approach would be the same.

If it were to be MPI, you would use player's index as the index for the caster.
For MUI, you would need to index each unit separately with its own unique index assigned via the triggger.
--
The reason for switching off the trigger, or setting the boolean value is so when the caster casts another of the 3 spells, it won't re-activate the trigger.
 
Status
Not open for further replies.
Top