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

Alright, I've been trying to program my own knockback...

Status
Not open for further replies.
Level 1
Joined
Dec 3, 2006
Messages
1
And I've created two different spells (both just triggers, no JASS). Unfortunately, something's wrong with both of them.

The first one I based off of Pushback Nova, simply based off the pushback part (I'm eventually going to make it a stat-based spell, so I need to trigger the damage separately). The problem with it is that whenever I use it, the enemies all get pushed back in the same direction. This remains after I move around some, too. (the spell is based off howl of terror. The howl effect lasts .60 seconds)

Code:
Knockback
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Howl of Terror) Equal to True)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is alive) Equal to True
                        ((Picked unit) is A ground unit) Equal to True
                    Then - Actions
                        Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 15.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees)
                        Wait 0.10 seconds
                        Unit - Remove All buffs from (Picked unit)
                    Else - Actions
                        Do nothing

As for the second spell I tried to program, it was based off of This topic. The spell has 2 parts (and is based off battle roar). The problem with this one is...well, it does nothing besides the regular effects of the spell.

First part:
Code:
Sword Whirl
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Sword Whirl 
    Actions
        Unit Group - Add all units of (Units within 450.00 of (Position of (Triggering unit))) to swordwhirl

And the second part:
Code:
Sword whirl 2
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units within 700.00 of (Position of (Triggering unit))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is in swordwhirl) Equal to True
                    Then - Actions
                        Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 300.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees)
                    Else - Actions
                        Do nothing

So...any help? I'd be glad to get any advice on getting either one of these abilities to work.
 
Level 27
Joined
Feb 22, 2006
Messages
3,052
For the first spell

Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 15.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees)

there is no triggering unit. The event is time based.

For the second spell

Unit Group - Pick every unit in (Units within 700.00 of (Position of (Triggering unit))) and do (Actions)
Loop - Actions


instantly to ((Position of (Picked unit)) offset by 300.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees)

Same issue. There is NO triggering unit for those triggers. Therefore, it records the position of the triggering unit as 0,0.

3rd problem: This has so many leaks, you're gonna lag so hard your unborn firstborn is gonna feel it.
--donut3.5--
 
Level 1
Joined
Dec 19, 2006
Messages
2
For Sword whirl,
Create a new unit variable called sword_caster or something like that.
Set Sword Whirl 2 initially off.


Sword Whirl
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Sword Whirl
Actions
Unit Group - Add all units of (Units within 450.00 of (Position of (Triggering unit))) to swordwhirl
Set Sword_Caster = (Triggering Unit)
Trigger - Turn on sword whirl 2 <gen>


Sword whirl 2
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units within 700.00 of (Position of (Sword_Caster))) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in swordwhirl) Equal to True
Then - Actions
Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 300.00 towards (Angle from (Position of (Sword_Caster)) to (Position of (Picked unit))) degrees)
Set swordwhirl = (No Unit)
Set Sword_Caster = (No Unit)
Trigger - Turn off (This trigger)
Else - Actions
Set swordwhirl = (No Unit)
Set Sword_Caster = (No Unit)
Trigger - Turn off (This trigger)

This would probally stop the leaks and make ur spell work.


For Knockback cre8 a new untargateable spell like starfall. Set all effects to 0, time to 0.01.
Set Knockback 2 initially off.
Create a New unit variable called knockback_caster
Create a New Real variable called Knockback_Counter



Knockback
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Starfall(Not renamed version of knockback)
Actions
Set Knockback_Caster = (Triggering unit)
Trigger - Turn on Knockback 2 <gen>


Knockback 2
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units within (700.00 )) of (Position of (Knockback_Caster)) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
Loop - Actions
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Knockback_Counter Less than 50.00
Then - Actions
Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 15.00 towards (Angle from (Position of (Knockback_Caster)) to (Position of (Picked unit))) degrees)
Set Knockback_Counter = (Knockback_Counter + 1.00)
Else - Actions
Set Knockback_Counter = 0.00
Trigger - Turn off (This trigger)

That should solve ur spell problems. But only 1 player can cast the spell at 1 time for Knockback =( (Spell last 0.5 sec) To solve that make like 12 triggers for 12 players n make 12 copys of each variable changing the name n modify accordingly.
 
Last edited:
Status
Not open for further replies.
Top