It's cleaner to write using property events instead of periodicly comparing the player's "Food Used" or so.
-
KnifeMissile
-

Events
-


Time - Every 0.04 seconds of game time
-

Conditions
-

Actions
-


Set UnitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Projectile Knife))
-


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



Loop - Actions
-




Set Pos1 = (Position of (Picked unit))
-




Set Pos2 = (Pos1 offset by 20.00 towards (Facing of Char) degrees)
-




Set Pos3 = (Position of Char)
-




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





If - Conditions
-






((Picked unit) is alive) Equal to True
-





Then - Actions
-






Unit - Move (Picked unit) instantly to Pos2, facing (Facing of Char) degrees
-






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







If - Conditions
-








(Number of units in (Units within 80.00 of Pos2 matching (((Owner of (Matching unit)) Not equal to Player 1 (Red)) and (((Matching unit) is alive) Equal to True)))) Greater than 0
-







Then - Actions
-








Unit - Kill (Picked unit)
-








Set UnitGroup = (Units within 80.00 of Pos2 matching ((Owner of (Matching unit)) Not equal to Player 1 (Red)))
-








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









Loop - Actions
-










Special Effect - Create a special effect attached to the head of (Picked unit) using Abilities\Spells\Undead\AbsorbMana\AbsorbManaBirthMissile.mdl
-










Special Effect - Destroy (Last created special effect)
-










Unit - Cause Char to damage (Picked unit), dealing (CharDamage / 2.00) damage of attack type Spells and damage type Normal
-








Custom script: call DestroyGroup (udg_UnitGroup)
-







Else - Actions
-





Else - Actions
-




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





If - Conditions
-






(Distance between Pos3 and Pos2) Greater than 1000.00
-





Then - Actions
-






Unit - Remove (Picked unit) from the game
-





Else - Actions
-




Custom script: call RemoveLocation (udg_Pos1)
-




Custom script: call RemoveLocation (udg_Pos2)
-




Custom script: call RemoveLocation (udg_Pos3)
-


Custom script: call DestroyGroup (udg_UnitGroup)
^Very heavy operations. Picking All units In map and internaly again making 2 group creatin + enumeration for each alive unit on map seems costly.
This:
-
(Number of units in (Units within 80.00 of Pos2 matching (((Owner of (Matching unit)) Not equal to Player 1 (Red)) and (((Matching unit) is alive) Equal to True)))) Greater than 0
... this line creates a unit group and leaks. (and is unreadable as a 1-liner) And it is used also in other triggers, btw.
Also the location of "Char" is static in the trigger and doesn't need to be reset on each roll.
And filtering the unit for being alive is better before points are created. The filter should be on very top.
-
Hookshot Init
-

Events
-


Time - Elapsed game time is 0.00 seconds
-

Conditions
-

Actions
-


Set Pos1 = (Center of (Playable map area))
-


Set Pos2 = (Center of (Playable map area))
-


Lightning - Create a Magic Leash lightning effect from source Pos1 to target Pos2
-


Set HookLightning = (Last created lightning effect)
-


Lightning - Change color of (Last created lightning effect) to (0.70 0.80 1.00) with 1.00 alpha
-


Custom script: call RemoveLocation (udg_Pos1)
-


Custom script: call RemoveLocation (udg_Pos2)
^2 different locations are not needed here. Also you might consider to use a permanent Point "CenterOfMap" which is just never destroyed and used over and over again.
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-

If - Conditions
-


Or - Any (Conditions) are true
-



Conditions
-




MoveDown Equal to True
-




MoveRight Equal to True
-




MoveUp Equal to True
-




MoveLeft Equal to True
-

Then - Actions
-


Custom script: call SetUnitAnimationByIndex(udg_Char, 2)
-

Else - Actions
^This part is repeated very often. I think this task should be handled internaly be the move system if possible.
The custom movement trigger:
-
Move
-

Events
-


Time - Every 0.02 seconds of game time
-

Conditions
-


MovementDisabled Equal to False
-


CharDead Equal to False
-


(Char has buff Stunned (Pause)) Equal to False
-


Or - Any (Conditions) are true
-



Conditions
-




MoveDown Equal to True
-




MoveRight Equal to True
-




MoveLeft Equal to True
-




MoveUp Equal to True
-

Actions
-


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



If - Conditions
-




CurrentlyAttacking Equal to False
-



Then - Actions
-




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





If - Conditions
-






And - All (Conditions) are true
-







Conditions
-








(Char has buff Dash ) Equal to True
-








(Char has buff StopCharDash ) Equal to False
-





Then - Actions
-






Set StatMovementReal = 30.00
-






Custom script: call SetUnitAnimationByIndex(udg_Char, 2)
-





Else - Actions
-






Set StatMovementReal = (StatMovement x 0.02)
-




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





If - Conditions
-






(Char has buff Slowed) Equal to True
-





Then - Actions
-






Set StatMovementReal = (StatMovementReal / 2.00)
-





Else - Actions
-



Else - Actions
-




Set StatMovementReal = 1.00
-


Set FacingIndicator = (Position of Char)
-


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



If - Conditions
-



Then - Actions
-




Set Pos1 = (Position of Char)
-




Set Pos2 = (Pos1 offset by StatMovementReal towards 90.00 degrees)
-




Custom script: call RemoveLocation (udg_Pos1)
-




Set Pos1 = (Pos2 offset by 32.00 towards 90.00 degrees)
-




Unit - Create 1 Path Checker for Neutral Passive at Pos1 facing Default building facing degrees
-




Set Pos3 = (Position of (Last created unit))
-




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





If - Conditions
-






Or - Any (Conditions) are true
-







Conditions
-








(Terrain type at Pos1) Equal to UnwalkableTerrain
-








(Distance between Pos3 and Pos1) Greater than or equal to 5.00
-





Then - Actions
-






Unit - Remove (Last created unit) from the game
-






Set Pos2 = (Position of Char)
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveUp Equal to True
-










MoveLeft Equal to False
-










MoveRight Equal to False
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 90.00 degrees
-







Else - Actions
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveLeft Equal to True
-










MoveUp Equal to True
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 135.00 degrees
-







Else - Actions
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveRight Equal to True
-










MoveUp Equal to True
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 45.00 degrees
-







Else - Actions
-






Custom script: call RemoveLocation (udg_Pos1)
-






Custom script: call RemoveLocation (udg_Pos2)
-





Else - Actions
-






Unit - Remove (Last created unit) from the game
-






Unit - Move Char instantly to Pos2, facing (Angle from FacingIndicator to Pos2) degrees
-






Custom script: call RemoveLocation (udg_Pos1)
-






Custom script: call RemoveLocation (udg_Pos2)
-



Else - Actions
-


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



If - Conditions
-



Then - Actions
-




Set Pos1 = (Position of Char)
-




Set Pos2 = (Pos1 offset by StatMovementReal towards 180.00 degrees)
-




Custom script: call RemoveLocation (udg_Pos1)
-




Set Pos1 = (Pos2 offset by 32.00 towards 180.00 degrees)
-




Unit - Create 1 Path Checker for Neutral Passive at Pos1 facing Default building facing degrees
-




Set Pos3 = (Position of (Last created unit))
-




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





If - Conditions
-






Or - Any (Conditions) are true
-







Conditions
-








(Terrain type at Pos1) Equal to UnwalkableTerrain
-








(Distance between Pos3 and Pos1) Greater than or equal to 5.00
-





Then - Actions
-






Unit - Remove (Last created unit) from the game
-






Set Pos2 = (Position of Char)
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveLeft Equal to True
-










MoveUp Equal to False
-










MoveRight Equal to False
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 180.00 degrees
-







Else - Actions
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveLeft Equal to True
-










MoveUp Equal to True
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 135.00 degrees
-







Else - Actions
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveLeft Equal to True
-










MoveDown Equal to True
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 225.00 degrees
-







Else - Actions
-






Custom script: call RemoveLocation (udg_Pos1)
-






Custom script: call RemoveLocation (udg_Pos2)
-





Else - Actions
-






Unit - Remove (Last created unit) from the game
-






Unit - Move Char instantly to Pos2, facing (Angle from FacingIndicator to Pos2) degrees
-






Custom script: call RemoveLocation (udg_Pos1)
-






Custom script: call RemoveLocation (udg_Pos2)
-



Else - Actions
-


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



If - Conditions
-



Then - Actions
-




Set Pos1 = (Position of Char)
-




Set Pos2 = (Pos1 offset by StatMovementReal towards 0.00 degrees)
-




Custom script: call RemoveLocation (udg_Pos1)
-




Set Pos1 = (Pos2 offset by 32.00 towards 0.00 degrees)
-




Unit - Create 1 Path Checker for Neutral Passive at Pos1 facing Default building facing degrees
-




Set Pos3 = (Position of (Last created unit))
-




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





If - Conditions
-






Or - Any (Conditions) are true
-







Conditions
-








(Terrain type at Pos1) Equal to UnwalkableTerrain
-








(Distance between Pos3 and Pos1) Greater than or equal to 5.00
-





Then - Actions
-






Unit - Remove (Last created unit) from the game
-






Set Pos2 = (Position of Char)
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveRight Equal to True
-










MoveDown Equal to False
-










MoveUp Equal to False
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 0.00 degrees
-







Else - Actions
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveRight Equal to True
-










MoveUp Equal to True
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 45.00 degrees
-







Else - Actions
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveRight Equal to True
-










MoveDown Equal to True
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 315.00 degrees
-







Else - Actions
-






Custom script: call RemoveLocation (udg_Pos1)
-






Custom script: call RemoveLocation (udg_Pos2)
-





Else - Actions
-






Unit - Remove (Last created unit) from the game
-






Unit - Move Char instantly to Pos2, facing (Angle from FacingIndicator to Pos2) degrees
-






Custom script: call RemoveLocation (udg_Pos1)
-






Custom script: call RemoveLocation (udg_Pos2)
-



Else - Actions
-


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



If - Conditions
-



Then - Actions
-




Set Pos1 = (Position of Char)
-




Set Pos2 = (Pos1 offset by StatMovementReal towards 270.00 degrees)
-




Custom script: call RemoveLocation (udg_Pos1)
-




Set Pos1 = (Pos2 offset by 32.00 towards 270.00 degrees)
-




Unit - Create 1 Path Checker for Neutral Passive at Pos1 facing Default building facing degrees
-




Set Pos3 = (Position of (Last created unit))
-




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





If - Conditions
-






Or - Any (Conditions) are true
-







Conditions
-








(Terrain type at Pos1) Equal to UnwalkableTerrain
-








(Distance between Pos3 and Pos1) Greater than or equal to 5.00
-





Then - Actions
-






Unit - Remove (Last created unit) from the game
-






Set Pos2 = (Position of Char)
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveDown Equal to True
-










MoveLeft Equal to False
-










MoveRight Equal to False
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 270.00 degrees
-







Else - Actions
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveDown Equal to True
-










MoveRight Equal to True
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 315.00 degrees
-







Else - Actions
-






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







If - Conditions
-








And - All (Conditions) are true
-









Conditions
-










MoveDown Equal to True
-










MoveLeft Equal to True
-







Then - Actions
-








Unit - Move Char instantly to Pos2, facing 225.00 degrees
-







Else - Actions
-






Custom script: call RemoveLocation (udg_Pos1)
-






Custom script: call RemoveLocation (udg_Pos2)
-





Else - Actions
-






Unit - Remove (Last created unit) from the game
-






Unit - Move Char instantly to Pos2, facing (Angle from FacingIndicator to Pos2) degrees
-






Custom script: call RemoveLocation (udg_Pos1)
-






Custom script: call RemoveLocation (udg_Pos2)
-



Else - Actions
-


Custom script: call RemoveLocation (udg_FacingIndicator)
^"DRY concept" : don't repeat yourself. Similar code is written again and again. The code must check for pressed keys once, and then do appropriate actions.
Don't have many seperated action blocks for each pressed key seperatly.
Also, creating so many dummy units to keep checking the path is too costly and unefficient. One dummy that is used over and over again, or even better would be something like this:
Check Walkability
You might want to use
SetUnitX/Y
over MoveUnit, because it doesn't interrupt the current animation.
At those triggers:
-
Actions
-

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


If - Conditions
-



Or - Any (Conditions) are true
-




Conditions
-





MoveDown Equal to True
-





MoveRight Equal to True
-





MoveLeft Equal to True
-


Then - Actions
-


Else - Actions
-



Unit - Remove Ability: Dash from Char
-



Animation - Reset Char's animation
-



Set MoveUp = False
->
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-

If - Conditions
-


MoveDown Equal to False
-


MoveRight Equal to False
-


MoveLeft Equal to False
-

Then - Actions
-


Unit - Remove Ability: Dash from Char
-


Animation - Reset Char's animation
-

Else - Actions
-
Set MoveUp = False
Periodic triggers should only run if needed. For example the regen trigger, and the floating text trigger.
Something that use brackets, like (Picked Unit) does mean it is a function call.
Function calls are much slower than variable lookups.
So if something like (Picked Unit) or something similar is used multiple times, it makes sense to store it into a temp variable.
It's not easy to read other's map code and interpret everything, so some things are not easy to state out.
But there are several confusing lines for an person from outside, for example:
-
Push Box
-

Events
-


Time - Every 0.02 seconds of game time
-

Conditions
-

Actions
-


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



Loop - Actions
-




Set Pos1 = (Position of (Picked unit))
-




Set Pos2 = (Pos1 offset by 5.00 towards (Mana of (Picked unit)) degrees)
-




Unit - Move (Picked unit) instantly to Pos2
-




Custom script: call RemoveLocation (udg_Pos1)
-




Custom script: call RemoveLocation (udg_Pos2)
-


Wait 0.25 seconds
-


Unit Group - Remove all units from PushedBox
-


Trigger - Turn off (This trigger)
I have no idea why (Mana of (Picked unit)) as offset reference for example.
Or also the life check for destructables in range in the interact trigger.