• 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.

[Trigger] How could I push back a unit??

Status
Not open for further replies.
Level 2
Joined
Dec 31, 2006
Messages
16
For my cinematic i need a trigger that pushes one of the heros backwards, because he took a strong blow (with the blunt face of a greatsword). I tried many triggers but none of them worked. My idea is when my guy pwns the other with the greatsword he will be thrown back. Any help will be apreciated.
 
Level 6
Joined
Oct 23, 2006
Messages
223
i think you can do it with gui, but you'd have to use multiple triggers and timers. Correct me if im wrong, but you want the effect to go something like in LOTR where in the units are knocked back(flying in the air then landing on their backs). This is possible in a cinematic but not efficient in-game. You could try adjusting flying heights and use angling for the unit to it's on its back.
 
Level 16
Joined
Oct 30, 2004
Messages
1,277
Happytauren what are you on about? He says its for a cinematic and you definately dont need jass for it.

You will need to periodicly move the unit in a polar offset. Trigger would be like this (hero_1 is unit type variable which has the unit pushed stored to it):

push
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Unit - Move Hero_1 instantly to ((Position of Hero_1) offset by 5.00 towards 0.00 degrees)
 
Level 3
Joined
May 28, 2005
Messages
47
The only problem with the WEU built in spells is that they cause mass map kb for some reason, and are not as good of a use as a custom trigger.

You should set a boolean variable and set it to true when you want the attack done.

If it's a cinematic you don't even need it to be MUI...

Code:
Event:
 -Every 0.01 Seconds of The Game
Condition:
 -GreatSword = True
Actions:
 - Run GREAT SWORD checking conditions

GREAT SWORD

Event:
 -
Condition:
 - 
Actions:
 - Set Target = (One about to get attacked)
 - Set Attacker = (One attacking)
 - Set Target's Animation Speed = (something slower)
 - Play Attacker's Stand Ready Animation
 - (Insert Random Special Effect Such as Holy Light on Attacker)
 - Order Attacker to attack Target
 - (Use a blood animation on Target)
 - Turn on PUSH BACK

PUSH BACK
Events:
 - Every 0.01 seconds of game time
Conditions:
 - 
Actions:
 - Move Target instantly to ((Position of Target) offset by 8.00 towards (Facing of Attacker) degrees)
 - Create a special effect at Position of Target using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
 - Destroy Last created special effect
 
Last edited:
Level 8
Joined
Sep 13, 2006
Messages
431
...
Actions:
- Move Target instantly to ((Position of Target) offset by 8.00 towards (Facing of Target) degrees)
[/code]

Wouldn't you want (Facing of Attacker) degrees? Unless I am mistaken, I would assume that the target would be facing the attacker, so moving it toward the facing of the target would move the unit closer to the attacking unit.
 
Level 4
Joined
Sep 26, 2005
Messages
40
it's easy in gui
i've done it several times in my map and no leaks or lag. solid

First.. i'd have something like.. Add a dummy spell that is able to be casted on the unit by the attacking unit that deals no damage.. maybe something like storm bolt and if the hero is an ally.. allow it to hit allies.. and set the Cast Range to something between 80-150.. around that.. i'd probably do 100 so this way he has to get close to look like he is smacking the unit.. you might want to change the animation from "spell" to "attack" depending on what unit you are using. (note: i dont remember if stormbolt lets you hit allies or not but i will refer to this spell)


Then at the moment you want it to go off, add the ability via trigger.. then order that unit to Storm bolt the other unit..

then have the following triggers

Trigger1 Start
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to StormBolt
(Unit-type of (Casting unit)) Equal to <heroname>
Actions
Set VAR_CastU = (Casting unit)
Set VAR_TargetU = (Target unit of ability being cast)
Set VAR_Targetu_Posi = (Position of VAR_TargetU)
Set VAR_Caster_Posi = (Position of VAR_CastU)
Set VAR_Distance_Between = (Distance between VAR_Caster_Posi and VAR_Targetu_Posi)
Set VAR_Dist_Move_Real = 0.00
Set VAR_RevChanger_Real = -0.02
Trigger - Turn on Trigger2 Move <gen>

------------------------------------------------------------------------

Then have the 2nd trigger work like this:

Trigger2 Move
Events
Time - Every 0.04 seconds of game time
Conditions

Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(VAR_TargetU has buff Stunned) Equal to False
Then - Actions
Trigger - Turn off (This trigger)
Custom script: call RemoveLocation( udg_VAR_Targetu_Posi )
Custom script: call RemoveLocation( udg_VAR_Caster_Posi )
Skip remaining actions
Else - Actions
Do nothing


Set VAR_Dist_Move_Real = ((1500.00 - VAR_Distance_Between) x VAR_RevChanger_Real)
Set VAR_Targetu_Posi = (Position of VAR_TargetU)
Set VAR_Distance_Between = (Distance between VAR_Caster_Posi and VAR_Targetu_Posi)
Unit - Move VAR_TargetU instantly to (VAR_Targetu_Posi offset by VAR_Dist_Move_Real towards (Angle from VAR_Targetu_Posi to VAR_Caster_Posi) degrees)
Custom script: call RemoveLocation( udg_VAR_Targetu_Posi )


------------------------------------------------------

And that's it. no leaks and nice and clean. do it exactly like this for a smooth trigger that looks like it has friction.

the Distance Real var's are there to judge distance to move based on how close they are to the unit.. the closer they are the greater distance per .04 it will move.. and the value of the 1500 that is used in the VAR_Dist_Move_Real arithetic means the unit will progressively slow down as they approach that range.. making it look like friction.. by the time the unit reaches around 1500 it will no longer move.


Oh and in the object editor have the StormBolt (or whatever spell you use to create the buff) duration last for as long as you think it will take to push as far as you want it to.. as soon as this trigger detects that the buff has worn off, it will shut itself down and stop moving.


edit> oh and the "VAR_Distance_Between" is a real value
 
Last edited:
Level 3
Joined
May 28, 2005
Messages
47
True, true, but if one is going to take the time to post, one should at least post the right thing. And, using facing angle is quicker than trying to figure out exactly what numerical value to use. Nevertheless, you are correct...

... I didn't even use WE to make that LOL-- I just did it off my head.
 
Status
Not open for further replies.
Top