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!
set 1nteger var1ab|e wh1ch 1s array.
4n1t 1s attac2ed. can y04 wa1t t1|| t0n0rr0w. 2eyb0ard g0ne crazy.
EDIT: Can you wait till tomorrow? My keyboard gone crazy.
I'm using on-screen keyboard...
Condition - Level of [Ability] for Attacked Unit is Greater than or Equal to 1
Actions - Create 1 Dummy Caster at Location of Attacked Unit
Actions - Order Last Created Unit to cast Warden - Fan of Knives
- [Ability] is (assuming this is for a unit, not a hero) a 1-level ability that requires an upgrade (?). So if it's upgraded, then this trigger can continue. Elsewise, it can't.
- Look up a Tutorial on how to make Dummy Casters, or ask someone else. But make sure it has Negative HP Regen and a low HP amount (like 5) so it "kills itself".
- Give it a dummy-version of Fan of Knives (no mana, .01 cooldown, 1 lvl, etc etc)
- If you have time, fix the memory leak made by referencing the location. (not necessary, but good practice)
you can add to this trigger after spawn of dummy caster add expiration timer 5 sec to last created unit thats all
dummy unit is unit with locust abbility and no colision and no attack type and no movement
Locust ability covers 'no collision'
Edit it's model path to " .mdl" to make it invisible, set it's moving type to flying to ensure you can cast it everywhere.. the actual trigger goes like this:
Events
Unit - A Unit is attacked
Conditions
Level of *your ability* for (Triggering Unit) is equal to 1
Actions
If random integer between 1 and 5 equals 1, then do:
Set temppoint = (Position of (Triggering Unit))
Unit - Create 1 *dummy* for (Owner of (Triggering Unit)) at temppoint facing default degrees degrees
Unit - Add *your fan of knives ability* to (last created unit)
Unit - Order (last created unit) to Night elf Warden - Fan of Knives
Unit - Add a 2 seconds standard expiration timer to (last created unit)
First, don't triplepost
Second, temppoint = (Position of (Triggering Unit)) is a point variable
Third, If random integer is: If/then/else construction - integer comparison - random number
*Dummy Casters* - "Dummy Casters" are, as stated above, dummy units that can cast secondary spells, giving your triggered spell extra effects. The most basic example I can think of would be "Frozen Lightning"; your hero casts Forked Lightning, a dummy caster casts Frost Nova. That's 2 spells at once, making a "Frozen Lightning" spell.
There is no tutorial (yet) for them. I kinda meant [Search] the forums and ask around.
In this example, you want the Dummy Caster to be able to cast your [Fan of Knives] (FoK) for you, because if the hero did it, the "dummy" FoK would appear briefly on his command card... Unprofessional and ugly.
Thus you need a "dummy" ability that just takes up space on your hero; a passive skill, with no effects whatsover (i.e., if you base it off of Critical Strike, remove the "x2 damage modifier" thing. No effect.
Then the trigger (which will activate when any unit attacks any other, anywhere) checks to see if the Attacked Unit (you want this to be the hero) has levels in the dummy ability. If not, do nothing. If so, then you need to do the spell effects (FoK).
However!, since you want this to be a 20% chance, you can't just "check for ability, if yes, go ahead". That's what this line:
Code:
If [B]random integer between 1 and 5 equals 1[/B], then do:
does. You could do "random integer (number) between 1 and 100 equal to or less than 20", but why use bigger numbers when smaller will work just fine? So 1 out of 5 times your hero (with the dummy ability) is attacked, the Trigger will start up.
The trigger, then, is simply summoning the Dummy Caster (DC) and ordering it to use the dummy FoK, thus doing your spell effect. The rub is, you want to refer to that unit as little as possible. That means, the fewer times you do something to "Last Created Unit", the better. (Because what happens if anyone on the map manages to train a unit in between the code? Rare, but it could happen, and then your trigger is compromised.)
You can get rid of "Give (last created unit) ___ ability" by just giving your DC unit that ability in the first place (it doesn't matter how many abilities he has, right?).
You can also get rid of the "Give (last created unit) X second Expiration Timer", by just giving your DC low HP (like 5 or 10) and negative HP Regen (like -1.00). (given that example, he would "die off" in 5 or 10 seconds, obviously).
That way, you are only creating him, then ordering him; extremely unlikely that the trigger will "miss" or "get confused".
~~~
Finally, Squiggy did part of the work for you; that's important because you need to fix memory leaks (by setting the "creation point" of the DC to a variable and then removing the variable).
However, I believe you must also "localize" (make the variable "local" or "private" to that run of the trigger), because what happens if two people cast the spell at once? Mess-up. Thus (naming the ability "Retribution"):
Retribution xx Test Map
Events
Unit - A unit Is attacked
Conditions
(Level of Retribution for (Attacked unit)) Greater than 0
Actions
If random integer between 1 and 5 equals 1, Then do:
Custom script: local location udg_TempPoint
Set TempPoint = (Position of (Attacked unit))
Unit - Create 1 Dummy Caster for (Owner of (Attacked unit)) at TempPoint facing Default building facing degrees
Unit - Order (Last created unit) to Night Elf Warden - Fan Of Knives
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: set udg_TempPoint = null
Else do (Actions)
**NOTE: I'm not sure how "localizing" works when you use a big If/Then/Else; I believe it messes that up. So you may need 3 separate triggers, with each conditions saying "Level of [Ability] for (Attacked Unit) Equal to 1 / 2 / 3". :/
Kyrbi0,you are right.
but i don't know how that function integer between 1 and 5
works.
when i setup chance ability, i always setup integer variable that is changed every time
unit is attacked. do you get what i'm saying?
i think that you missed that function.
first, it's Maths- Random Number under Integer comparison (to verify xD)
Second, without using variables, your map will suck badly as you will have like 21354346 leaks
You know that if you even want to do something at the position of a unit, you have to set a variable to that position?
Otherwise, you'll leak that location..
...Finally, Squiggy did part of the work for you; that's important because you need to fix memory leaks (by setting the "creation point" of the DC to a variable and then removing the variable)....
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.