| 07-07-2005, 09:43 AM | #1 |
Alright, i'm attempting to make an ability similar to Omnistrike. For those of you who don't play DotA, what it does is make the casting hero invulnerable and half invisible, then "blinks" him all around the target unit, he attacks, then blinks to a different position, then attacks again. I can set this up fine, what i'm having trouble doing is making it pick a random unit near the hero if the original target is dead. The current triggers are thus: Code:
Windstrike
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Windstrike
Actions
Set WindstrikeCaster = (Casting unit)
Set WindstrikeTarget = (Target unit of ability being cast)
Unit - Make WindstrikeCaster Invulnerable
Animation - Change WindstrikeCaster's vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
Special Effect - Create a special effect attached to the weapon of WindstrikeCaster using Abilities\Weapons\ZigguratMissile\ZigguratMissile.mdl
Set WindstrikeSFX[1] = (Last created special effect)
Special Effect - Create a special effect attached to the chest of WindstrikeCaster using Abilities\Weapons\ZigguratMissile\ZigguratMissile.mdl
Set WindstrikeSFX[2] = (Last created special effect)
Unit - Add Windstrike (Attack) to WindstrikeCaster
Unit - Turn collision for WindstrikeCaster Off
Trigger - Turn on WindstrikeAttack <gen>
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Windstrike for WindstrikeCaster) Equal to 1
Then - Actions
For each (Integer A) from 1 to 3, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(WindstrikeTarget is dead) Equal to True
Then - Actions
Set WindstrikeTarget = (Random unit from (Units within 2000.00 of (Position of WindstrikeCaster) matching (((Owner of (Matching unit)) Not equal to (Owner of WindstrikeCaster)) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is Magic Immune) Equal to False))))
Else - Actions
Do nothing
Unit - Move WindstrikeCaster instantly to ((Position of WindstrikeTarget) offset by 100.00 towards (Random angle) degrees), facing (Position of WindstrikeTarget)
Unit - Order WindstrikeCaster to Night Elf Warden - Shadow Strike WindstrikeTarget
Special Effect - Create a special effect at (Position of WindstrikeCaster) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Special Effect - Destroy (Last created special effect)
Wait until (WindstrikeHasAttacked Equal to True), checking every 0.10 seconds
Set WindstrikeHasAttacked = False
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Windstrike for WindstrikeCaster) Equal to 2
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(WindstrikeTarget is dead) Equal to True
Then - Actions
Set WindstrikeTarget = (Random unit from (Units within 2000.00 of (Position of WindstrikeCaster) matching (((Owner of (Matching unit)) Not equal to (Owner of WindstrikeCaster)) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is Magic Immune) Equal to False))))
Else - Actions
Do nothing
For each (Integer A) from 1 to 5, do (Actions)
Loop - Actions
Unit - Move WindstrikeCaster instantly to ((Position of WindstrikeTarget) offset by 100.00 towards (Random angle) degrees), facing (Position of WindstrikeTarget)
Unit - Order WindstrikeCaster to Night Elf Warden - Shadow Strike WindstrikeTarget
Special Effect - Create a special effect at (Position of WindstrikeCaster) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Special Effect - Destroy (Last created special effect)
Wait until (WindstrikeHasAttacked Equal to True), checking every 0.10 seconds
Set WindstrikeHasAttacked = False
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Windstrike for WindstrikeCaster) Equal to 3
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(WindstrikeTarget is dead) Equal to True
Then - Actions
Set WindstrikeTarget = (Random unit from (Units within 2000.00 of (Position of WindstrikeCaster) matching (((Owner of (Matching unit)) Not equal to (Owner of WindstrikeCaster)) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is Magic Immune) Equal to False))))
Else - Actions
Do nothing
For each (Integer A) from 1 to 7, do (Actions)
Loop - Actions
Unit - Move WindstrikeCaster instantly to ((Position of WindstrikeTarget) offset by 100.00 towards (Random angle) degrees), facing (Position of WindstrikeTarget)
Unit - Order WindstrikeCaster to Night Elf Warden - Shadow Strike WindstrikeTarget
Special Effect - Create a special effect at (Position of WindstrikeCaster) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Special Effect - Destroy (Last created special effect)
Wait until (WindstrikeHasAttacked Equal to True), checking every 0.10 seconds
Set WindstrikeHasAttacked = False
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Windstrike for WindstrikeCaster) Equal to 4
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(WindstrikeTarget is dead) Equal to True
Then - Actions
Set WindstrikeTarget = (Random unit from (Units within 2000.00 of (Position of WindstrikeCaster) matching (((Owner of (Matching unit)) Not equal to (Owner of WindstrikeCaster)) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is Magic Immune) Equal to False))))
Else - Actions
Do nothing
For each (Integer A) from 1 to 9, do (Actions)
Loop - Actions
Unit - Move WindstrikeCaster instantly to ((Position of WindstrikeTarget) offset by 100.00 towards (Random angle) degrees), facing (Position of WindstrikeTarget)
Unit - Order WindstrikeCaster to Night Elf Warden - Shadow Strike WindstrikeTarget
Special Effect - Create a special effect at (Position of WindstrikeCaster) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Special Effect - Destroy (Last created special effect)
Wait until (WindstrikeHasAttacked Equal to True), checking every 0.10 seconds
Set WindstrikeHasAttacked = False
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Windstrike for WindstrikeCaster) Equal to 5
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(WindstrikeTarget is dead) Equal to True
Then - Actions
Set WindstrikeTarget = (Random unit from (Units within 2000.00 of (Position of WindstrikeCaster) matching (((Owner of (Matching unit)) Not equal to (Owner of WindstrikeCaster)) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is Magic Immune) Equal to False))))
Else - Actions
Do nothing
For each (Integer A) from 1 to 11, do (Actions)
Loop - Actions
Unit - Move WindstrikeCaster instantly to ((Position of WindstrikeTarget) offset by 100.00 towards (Random angle) degrees), facing (Position of WindstrikeTarget)
Unit - Order WindstrikeCaster to Night Elf Warden - Shadow Strike WindstrikeTarget
Special Effect - Create a special effect at (Position of WindstrikeCaster) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Special Effect - Destroy (Last created special effect)
Wait until (WindstrikeHasAttacked Equal to True), checking every 0.10 seconds
Set WindstrikeHasAttacked = False
Else - Actions
Do nothing
Wait until ((Custom value of WindstrikeCaster) Equal to (((Level of Windstrike for WindstrikeCaster) x 2) + 1)), checking every 0.20 seconds
Trigger - Run WindstrikeEnd <gen> (ignoring conditions)Code:
WindstrikeEnd
Events
Conditions
Actions
Trigger - Turn off WindstrikeAttack <gen>
Unit - Set the custom value of WindstrikeCaster to 0
Unit - Turn collision for WindstrikeCaster On
Unit - Remove Windstrike (Attack) from WindstrikeCaster
Special Effect - Destroy WindstrikeSFX[1]
Special Effect - Destroy WindstrikeSFX[2]
Animation - Change WindstrikeCaster's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
Unit - Make WindstrikeCaster VulnerableCode:
WindstrikeAttack
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Windstrike (Attack)
Actions
Unit - Set the custom value of WindstrikeCaster to ((Custom value of WindstrikeCaster) + 1)
Set WindstrikeHasAttacked = TrueAt the moment he casts an ability which deals 100 damage. But i can convert that to him attacking easily enough. The problem is that if the WindstrikeTarget unit dies, the ability pauses, it doesn't pick a new WindstrikeTarget (Yes i'm also aware that the trigger leaks. I'll fix that up when i have the ability working.) Also, is there any way to make a unit uncontrollable? (So i can still select him, but i can't issue orders while the spell is in effect) because thats another way to stuff the spell up. |
| 07-07-2005, 06:15 PM | #2 |
All thouse if-then-elses are a pain to watch... since the number of attacks insreases by 2 per level, can't you just make it loop from 1 to (1 + (Level of ability * 2))? |
| 07-07-2005, 07:25 PM | #3 |
yikes.. mods should make a sticky thread on the trigger section which explains that, i just see the same mistake all the time.. well, first of all, i have a few suggestions.. make a unit group var and set all the units within 2000 range matching your condition and add them all to that group then pick every unit in that group and do that it will work faster (i tried it) second.. i dont suggest you'd use a dummy unit to damage the targets unless you want them to take that certain spell shadow strike.. if its only damage i suggest you use your caster's attack animation together with "order casting unit to damage target for x damage" and one last thing, use a PolledWait (game time seconds) of 0.25 seconds between each attack for it to look normal. |
| 07-07-2005, 09:36 PM | #4 |
I'm pretty sure one of Lord Vexorian's templates is specifically based on omnislash. |
| 07-07-2005, 09:43 PM | #5 | |
Quote:
yep, Cold Slash in one of his spells, but it's not that good since its too slow. i didnt test it though to see if the moving between units there can be decreased. |
| 07-07-2005, 09:57 PM | #6 |
I didn't base cold slash on omnislash, I have actually never seen the omnislash from dota , nor dota itself, so I don't know if it is too slow or too fast I don't know. In wc3search there are thousands of spells called omnislash, but that's not the point of this thread. HE is asking for a way of picking a new random unit. |
| 07-08-2005, 03:44 AM | #7 |
i think the way he did it is just fine, but adding all units into a group and then picking each one will be better with a boolean of course and a polledwait of 0.25. |
| 07-08-2005, 06:02 AM | #8 |
My problem is, quite simply, that its not working. The caster attacks fine, he turns invis, yadda yadda yadda. But when the target dies before the number of attacks is up, the spell "pauses" and the caster becomes perminantly invulnerable. What i want it to do is pick a random nearby unit that is alive, an enemy of the owner of windstrikecaster and not spell immune. It doesn't do this. |
| 07-08-2005, 06:52 AM | #9 |
i've got a working trigger of this spell, but its in jass, so i dont think its gonna help you out... |
| 07-08-2005, 09:17 AM | #10 |
Yeah, i'm not a JASS triggerer :P |
| 07-08-2005, 09:47 AM | #11 | |
Quote:
Additionaly, you would need another fail-safe. If, after looking for a new target, the trigger doesn't find it (so, if the target unit variable is equal to no-unit) you should run the WindstrikeEnd trigger. Another problem might be a player issuing an oder while the windstrike is on, you would need another fail-safe for that, unless you already have it. Also, Integer A is a global variable, so any other trigger that uses it and runs while this trigger is running would mess things up. Use a special integer variable for this which no other trigger uses, in combination with the third looping action (the one that doesn't use integers A or B, but a variable you specify). And lastly, after you get things working, do clear your memory leaks a bit. |
| 07-08-2005, 01:34 PM | #12 | |
Quote:
Also, I hope this is a singleplayer map, because global variables for multiplayer spells is a big nono. |
| 07-08-2005, 10:36 PM | #13 | |
Quote:
|
| 07-09-2005, 01:04 AM | #14 |
For your info it IS a singleplayer map. But instead of polishing off the trigger and finishing everything shiny like, then discovering it doesn't work. I'm attempting to get the trigger to work BEFORE i polish it off and make everything shiny and clean. Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Windstrike for WindstrikeCaster) Equal to 1
Then - Actions
For each (Integer A) from 1 to 3, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(WindstrikeTarget is dead) Equal to True
Then - Actions
Set WindstrikeTarget = (Random unit from (Units within 2000.00 of (Position of WindstrikeCaster) matching (((Owner of (Matching unit)) Not equal to (Owner of WindstrikeCaster)) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is Magic Immune) Equal to False))))
Else - Actions
Do nothing
Unit - Move WindstrikeCaster instantly to ((Position of WindstrikeTarget) offset by 100.00 towards (Random angle) degrees), facing (Position of WindstrikeTarget)
Unit - Order WindstrikeCaster to Night Elf Warden - Shadow Strike WindstrikeTarget
Special Effect - Create a special effect at (Position of WindstrikeCaster) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Special Effect - Destroy (Last created special effect)
Wait until (WindstrikeHasAttacked Equal to True), checking every 0.10 seconds
Set WindstrikeHasAttacked = FalseThe If/Then/Else that checks if the target is alive or dead is inside the loop. But its not selecting a target. I believe it may be to do with all the conditions. I'll attempt a version where it just picks a random unit and see what happens. |
