Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Test Knockback

Events


Unit - A unit Starts the Effect of an Ability

Conditions


(Unit-type of (Triggering unit)) Equal to Twilight Enforcer

Actions


Set Knockback_CastingUnit = (Position of (Triggering unit))


Set Knockback_CastingUnit_Unit = (Triggering unit)


Set Knockback_TargetedUnit = (Position of (Target unit of ability being cast))


Trigger - Turn on Test Knockback periodic <gen>


Wait 0.06 game-time seconds


Trigger - Turn off Test Knockback periodic <gen>
Test Knockback periodic

Events


Time - Every 0.06 seconds of game time

Conditions

Actions


Unit - Move Knockback_CastingUnit_Unit instantly to (Point(((X of Knockback_CastingUnit) + (Facing of Knockback_CastingUnit_Unit)), ((Y of Knockback_CastingUnit) + (Facing of Knockback_CastingUnit_Unit))))


Set Knockback_CastingUnit = (Position of Knockback_CastingUnit_Unit)
u should also know that waits are inaccurate. so that .06 wait can wait from .225 till about .31 seconds. also this is not MUI so it will bug if 2 or more units cast at almost the same time.
What you do is:
- set caster's point P
- move caster to x coordinate of point P + facing; and y coordinate of point P + facing
Einheit - Move Knockback_CastingUnit_Unit instantly to (Point(((X of Knockback_CastingUnit) + (Facing of Knockback_CastingUnit_Unit)), ((Y of Knockback_CastingUnit) + (Facing of Knockback_CastingUnit_Unit))))
Movement Ini

Events

Conditions

Actions


Set Caster = Blood Mage 0000 <gen>


Set Target = Mountain King 0001 <gen>


Trigger - Turn on Moveent Loop <gen>
Moveent Loop

Events


Time - Every 0.03 seconds of game time

Conditions

Actions


Set p1 = (Position of Caster)


Set p2 = (Position of Target)


Set p3 = (p2 offset by 5.00 towards (Angle from p1 to p2) degrees)


Unit - Move Target instantly to p3


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


-------- Clear leaks --------


Custom script: call RemoveLocation(udg_p1)


Custom script: call RemoveLocation(udg_p2)


Custom script: call RemoveLocation(udg_p3)
GUI

Events


Unit - A unit enters (Playable map area)

Conditions


(Owner of (Triggering unit)) Equal to Player 1 (Red)

Actions


Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees


Wait 2.00 seconds


Unit - Kill (Last created unit)
function Trig_GUI_Conditions takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == Player(0) ) ) then
return false
endif
return true
endfunction
function Trig_GUI_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call TriggerSleepAction( 2 )
call KillUnit( GetLastCreatedUnit() )
endfunction
//===========================================================================
function InitTrig_GUI takes nothing returns nothing
set gg_trg_GUI = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_GUI, GetPlayableMapRect() )
call TriggerAddCondition( gg_trg_GUI, Condition( function Trig_GUI_Conditions ) )
call TriggerAddAction( gg_trg_GUI, function Trig_GUI_Actions )
endfunction
GUI is exactly what it stands for: the Graphical User Interface.
This is the triggering you're used to: the events, conditions and actions are all converted from a raw language to a user interface.
GUI is opposed to JASS: JASS is the only coding language Warcraft 3 uses (and all GUI is automatically converted to JASS when saving the map).
'MUI' is a category we use to differentiate between spells.
Spells uploaded on the hive have to be at least MUI (and systems at least MPI) in order to be approved.
The order is this: Normal -> MPI -> MUI -> SUMI.
Normal: only 1 unit can cast it at any given time. More than 1 unit and it will bug.
MPI: 2+ different players can cast the ability at the same time. A single player can only have 1 instance active at a time or it will bug.
MUI: 2+ different units (players don't matter here) can cast the spell. If a single unit tries to cast it multiple times at the same moment, it might bug.
SUMI: every single unit can cast the spell multiple times at once without bugging.
So you do not want to use Bribe's system, correct?
Making a knockback-system that is MUI isn't that easy if you didn't even know what MUI meant before now.
Mui simply means Multi-unit instanceability - it means that your spell can be used by more than 1 unit at the same time. Currently my spell is not MUI. As an example, I will use the trigger I provided for you with the movement.
This is how it goes:
UnitA starts casting Push on UnitB
Unit A will be now considered "Caster" and UnitB will be considered "Target".
Now after some time, UnitC starts casting this ability on UnitD.
UnitC will be now considered "Caster" and UnitD "Target".
Because variables "Caster" and "Target" can only "remember" 1 unit each, it will "forget" UnitA and UnitB - that will mean that UnitB will no longer be moved away from UnitA.
Just a quick note here: never change the size of an array. It will always be able to store 8192 values (from 0 to 8191).To make spell MUI, it is usually best to convert variable into array (when you open up a variable in variable editor, check the "array" box and set the number "size". Size means how many informations it can save. If you have Size 1, it will save up to 2 information (for example 2 units), if size 10, it will save up to 11 informations.
Set p1 = (Position of Caster)
Set p2 = (Position of Target)
Set p3 = (p2 offset by 5.00 towards (Angle from p1 to p2) degrees)
Unit - Move Target instantly to p3
-------- ------------------------ --------
-------- Clear leaks --------
Custom script: call RemoveLocation(udg_p1)
Custom script: call RemoveLocation(udg_p2)
Custom script: call RemoveLocation(udg_p3)
Really now... I guess I must've misunderstood that part about size in tutorials, or maybe it was written incorrectly to begin with. Anyway thanks - didn't know thatJust a quick note here: never change the size of an array. It will always be able to store 8192 values (from 0 to 8191).
What "size" does, is initialize those values up to that index. So if you set size to 100, then it will initialize 101 values at map init (which, most of the time, is just the default value anyway). This slows down the loading and might crash the thread (meaning that your trigger "Map Initialization" won't run).
The only exceptions where you can do this are "Dialog" and "Timer" (because you cannot create those 2 with GUI, so you'll have to initialize them).
Yes that is possible as well, but very limiting. Just imagine - how should the game find out under which unit variable should save caster and target?By testing a bit, I noticed, that if I set the offset value as negative, it pulls the target in, instead of shoving it away.
However, heres my Question:
I know this effect is GUI, but what if I use fpr every knockback spell, an own Variable, example:
Casting Unit: A ; Targeted Unit B
Variable AB
Casting Unit C ; Targeted Unit D
Variable CD
Then I dont have the Problem that multiple Targets are in the same Variable and it bugs.
Untitled Trigger 001

Events

Conditions

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




A_caster Equal to No unit



Then - Actions




Set A_caster = (Triggering unit)




Set A_target = (Target unit of ability being caster)



Else - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






B_caster Equal to No unit





Then - Actions






Set B_caster = (Triggering unit)






Set B_target = (Target unit of ability being caster)





Else - Actions






-------- and so on... --------
Untitled Trigger 001

Events

Conditions

Actions


Set i = (i + 1)


Set Caster[i] = (Triggering unit)


Set Target[i] = (Target unit of ability being cast)
Yes, you can use groups.Another Question: How can I shove multiple Units away?
Maybe by:
Pick up every Unit in unit Group and do Action:
*trigger*
Would that work correctly?
Untitled Trigger 001

Events

Conditions

Actions


Set p1 = (Position of Caster)


Unit Group - Pick every unit in PushGroup and do (Actions)



Loop - Actions




Set p2 = (Position of (Picked unit))




Set p3 = (p2 offset by 5.00 towards (Angle from p1 to p2) degrees)




Unit - Move Target instantly to p3




Custom script: call RemoveLocation(udg_p2)




Custom script: call RemoveLocation(udg_p3)


Custom script: call RemoveLocation(udg_p1)
u should also know that waits are inaccurate. so that .06 wait can wait from .225 till about .31 seconds. also this is not MUI so it will bug if 2 or more units cast at almost the same time.
Test Knockback

Ereignisse


Unit - A unit Starts the Effect of an Ability

Bedingungen


(Unit-type of (Triggering unit)) Equal to Twilight Enforcer

Aktionen


Set Knockback_CastingUnit = (Triggering unit)


Set Knockback_TargetedUnit = (Target unit of ability being cast)


Trigger - Turn on Test Knockback periodic <gen>


Wait 0.25 game-time seconds <- HERE IS THE PROBLEM I THINK


Trigger - Turn off Test Knockback periodic <gen>
Test Knockback periodic

Ereignisse


Time - Every 0.01 seconds of game time

Bedingungen

Aktionen


Set Knockback_p1caster = (Position of Knockback_CastingUnit)


Set Knockback_p2target = (Position of Knockback_TargetedUnit)


Set Knockback_p3 = (Knockback_p2target offset by 12.00 towards (Angle from Knockback_p1caster to Knockback_p2target) degrees)


Unit - Move Knockback_TargetedUnit instantly to Knockback_p3


Custom script: call RemoveLocation(udg_Knockback_p1caster)


Custom script: call RemoveLocation(udg_Knockback_p2target)


Custom script: call RemoveLocation(udg_Knockback_p3)
u should use a knockback system here on the hive.
If u dont want to then use a counter and make the trigger MUI.
basically u index the instances into an array. then u move the unit instantly to point every .03 and for the counter do counter = counter + 1. when it hits 9 then u de-index the units ( thats about a .27 wait time)
What if I used a real counter every 0.03 seconds that increased that counter by 'counter + 0.03? Won't that be accurate?
Wait; so in GUI the value of 0.03 is not constant?
So now we are waiting for his next post about the problem?
Test Knockback
Ereignisse
Unit - A unit Starts the Effect of an Ability
Bedingungen
(Unit-type of (Triggering unit)) Equal to Twilight Enforcer
Aktionen
Set Knockback_CastingUnit = (Triggering unit)
Set Knockback_TargetedUnit = (Target unit of ability being cast)
Trigger - Turn on Test Knockback periodic <gen>
Wait 0.25 game-time seconds <- HERE IS THE PROBLEM I THINK
Trigger - Turn off Test Knockback periodic <gen>
Test Knockback periodic
Ereignisse
Time - Every 0.01 seconds of game time
Bedingungen
Aktionen
Set Knockback_p1caster = (Position of Knockback_CastingUnit)
Set Knockback_p2target = (Position of Knockback_TargetedUnit)
Set Knockback_p3 = (Knockback_p2target offset by 12.00 towards (Angle from Knockback_p1caster to Knockback_p2target) degrees)
Unit - Move Knockback_TargetedUnit instantly to Knockback_p3
Custom script: call RemoveLocation(udg_Knockback_p1caster)
Custom script: call RemoveLocation(udg_Knockback_p2target)
Custom script: call RemoveLocation(udg_Knockback_p3)
Thanks anyway to all of you, for being so patient with me, and asking my possibly stupid or noobish questions![]()
Oh and @deathismyfriend, I am backing you up with this post.
As for ur problem this will not work for knockback because a knockback system needs to be MUI ( multi unit instanceable). if its not MUI when a second unit goes to get knocked back it will bug up and stop working.
to make it MUI u need to use indexing / de-indexing. I have a chapter in my tutorial Things a GUIer Should Know. in my sig. its called how to index. That will show u how to make things MUI.
There are some real good knockback systems here on the hive if u search for it. They already have the bugs worked out. So it would be easy to use.
Actions

Set TempLoc1 = (Position of Unit)

Set TempLoc2 = (TempLoc1 offset by 100.00 towards (Facing of Unit) degrees)

Unit - Move Unit instantly to TempLoc2

Custom script: call RemoveLocation(udg_TempLoc1)

Custom script: call RemoveLocation(udg_TempLoc2)
1) I'm not quite sure I understand what you mean.
If you make new variables for each spell, the spells will obviously not conflict with each other, but that doesn't make the ability MUI (it's possible that the ability still conflicts with itself when cast multiple times).
2)
The angle uses the function "Unit - Unit Facing Angle".
Actions
Set TempLoc1 = (Position of Unit)
Set TempLoc2 = (TempLoc1 offset by 100.00 towards (Facing of Unit) degrees)
Unit - Move Unit instantly to TempLoc2
Custom script: call RemoveLocation(udg_TempLoc1)
Custom script: call RemoveLocation(udg_TempLoc2)
3) First of all: set your World Editor properties correctly.
To do this, go to File -> Preferences and enable "Automatically create unknown variables while pasting trigger data".
After that, open the map of the system you wish to import.
Usually this contains a little "how to import"-commentary, you should read that (it tells you exactly what to import).
In the trigger editor, you should just copy the category that contains all system-related triggers. Go to your map and paste it.
The system is now imported into your map.
Sometimes you also need to import objects. This is exactly the same method: copy and paste.
Twilight Enforcer casts spell on Unit A = 1 active instance.
Then spell ends/is interrupted => 0 active instances of the spell
Now Twilight Enforcer casts spell on Unit B => 1 active instance again.
For spell to not be MUI but work correclty, either points a) or b) have to be true and point c) has to be always true.
