Blood Spiral is actually the most difficult spell I've made (all on my own) at the moment. However, that doesn't speak for much, because it's relatively simple. In fact, it's so simple that I guess just about anyone could do it. So I'll copy and paste the trigger here so that you can see how I do it.
- Code:
-
Blood Spiral
Events
Unit - A unit Dies
Conditions
(Level of Blood Spiral for (Killing unit)) Greater than or equal to 1
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Killing unit) has buff Blood Spiral ) Equal to True
Then - Actions
Else - Actions
Set SprlCt[(Player number of (Owner of (Killing unit)))] = 0
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 100) Greater than ((Level of Blood Spiral for (Killing unit)) + 5)
Then - Actions
Skip remaining actions
Else - Actions
Set SprlPt = (Position of (Killing unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
SprlCt[(Player number of (Owner of (Killing unit)))] Equal to ((Level of Blood Spiral for (Killing unit)) x 3)
Then - Actions
Else - Actions
Set SprlCt[(Player number of (Owner of (Killing unit)))] = (SprlCt[(Player number of (Owner of (Killing unit)))] + 1)
Unit - Create 1 Dummy Unit for (Owner of (Killing unit)) at SprlPt facing Default building facing degrees
Unit - Set level of Roar dummy for (Last created unit) to SprlCt[(Player number of (Owner of (Killing unit)))]
Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Roar
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation (udg_SprlPt)
- Code:
-
Variables used:
SprlCt - Integer Array (9)
SprlPt - Point
Okay, that actually looks more complicated than it really is, because I just make my triggers all sorts of messy. Blood Spiral in this state is far from being "the most effective possible", but it serves the purposes just well enough for me. I tried my very best to narrow it down to one trigger, which is how this came about. There are other ways to do it, though.
In order to understand how the trigger works, first I have to explain the variables. The variables are all listed not too far up, and the former is an array in order to make the skill
multi-instancable (or whatever the proper term is). You can actually replace the 9 with the amount of players usable in the game. Note that Blood Spiral doesn't work properly if a player has more than ONE Vampire. But in Zero's RPG, you're not supposed to have more than 1 of any Hero, anyway, so... I don't care! =D
- Code:
-
Events
Unit - A unit Dies
Conditions
(Level of Blood Spiral for (Killing unit)) Greater than or equal to 1
We start off with the simple part. The event is "Unit - A unit dies". Simply put, it causes the trigger to be activated when any unit dies. And the condition checks whether the killing unit has Blood Spiral learned (level equal to 1 or greater). Note that I don't remember whether this can leak, which is why I didn't use a variable for "Killing unit". >_>
- Code:
-
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Killing unit) has buff Blood Spiral ) Equal to True
Then - Actions
Else - Actions
Set SprlCt[(Player number of (Owner of (Killing unit)))] = 0
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 100) Greater than ((Level of Blood Spiral for (Killing unit)) + 5)
Then - Actions
Skip remaining actions
Else - Actions
Okay, then we move on to the first part of the actions. This is an if/then/else with an if/then/else inside it. Which is not really good practice, but it works for a lazy person like me, so there. First of all, this checks whether the killing unit has Blood Spiral. Why? Because if it has "Blood Spiral" (buff), then I don't even need to check whether Blood Spiral (ability) will trigger.
If it doesn't have that buff, however, then I make a random integer. If the player isn't lucky enough to get a number which matches the chance of triggering Blood Spiral at that level, then it's just too bad for him, because I'll skip the remaining actions which are the ones that provide Blood Spiral with its actual effects. I also set SprlCt for the killing player to be 0 here, because it means that Blood Spiral must have either 1. never triggered on this Vampire or 2. faded from this Vampire already, and I want SprlCt to reset from 0 units in both cases.
- Code:
-
Set SprlPt = (Position of (Killing unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
SprlCt[(Player number of (Owner of (Killing unit)))] Equal to ((Level of Blood Spiral for (Killing unit)) x 3)
Then - Actions
Else - Actions
Set SprlCt[(Player number of (Owner of (Killing unit)))] = (SprlCt[(Player number of (Owner of (Killing unit)))] + 1)
How annoying. More if/then/elses! Well, anyway, first of all, we define SprlPt here because using an event response in the trigger will just leak. So we can save a lot of leaks by having SprlPt here.
Then, we operate the third If/Then/Else in this trigger. We ensure that the killing Vampire's Blood Spiral isn't already at the unit cap according to the level of his Blood Spiral ability. If it is at the cap, then we do nothing. If it's not at the cap, then we add one to it, to show that we're increasing the effect of Blood Spiral by 1 level.
- Code:
-
Unit - Create 1 Dummy Unit for (Owner of (Killing unit)) at SprlPt facing Default building facing degrees
Unit - Set level of Roar dummy for (Last created unit) to SprlCt[(Player number of (Owner of (Killing unit)))]
Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Roar
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation (udg_SprlPt)
Then we create a dummy unit for the killing unit at where the Vampire is. The trigger then levels up its Roar ability to match the amount of units recently killed by the Vampire. Then we order the dummy unit to Roar, giving the Vampire the damage and armor buff. We then add a 2 second generic expiration timer to the dummy unit, so that he disappears in due time. Byebye!
Oh, and we also remove SprlPt so that it doesn't take up memory when this trigger isn't running. Yeah. SprlCt needs to stay in memory because it'll be referred to every time this trigger runs and succeeds.
Note that Roar will require a max level equal to the max amount of times Blood Spiral can stack up, and should affect either:
- 2 units, Hero, Ground, Allied, 0 AoE
- 1 unit, Hero, Not Self, 0 AoE
Yeah.
If you still have any queries, shoot. Don't feel bad about it, it's because I suck at explaining stuff.