- Joined
- Jun 24, 2009
- Messages
- 1,409
I'm using this simple system to generate error messages and to stop the units from casting the abilities at wrong locations or enemies.
Sometimes it works. Sometimes not. Whenever it tries to stop the unit, the unit restarts casting the spell if it's a local area one.
What's the problem here? :S
Sometimes it works. Sometimes not. Whenever it tries to stop the unit, the unit restarts casting the spell if it's a local area one.
What's the problem here? :S
JASS:
function DebugError takes player ForPlayer, string msg returns nothing
local sound error=CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
if (GetLocalPlayer() == ForPlayer) then
if (msg!="") and (msg!=null) then
call ClearTextMessages()
call DisplayTimedTextToPlayer(ForPlayer, 0.85, 0., 2.00, "|cffffcc00"+msg+"|r")
endif
call StartSound(error)
endif
call KillSoundWhenDone(error)
set error=null
endfunction
-
Debug Error
-
Events
- Unit - A unit Begins casting an ability
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Ability being cast) Equal to Taste of Death
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Life of (Triggering unit)) Less than or equal to ((Max life of (Triggering unit)) x 0.11)
-
Then - Actions
- Unit - Order (Triggering unit) to Stop
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "You're too weak.")
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Ability being cast) Equal to Water Vortex
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Terrain pathing at (Target point of ability being cast) of type Walkability is off) Equal to True
-
Then - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "Invalid target.")
- Unit - Order (Triggering unit) to Stop
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Ability being cast) Equal to Steal
- (Ability being cast) Equal to Pickpocket
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Unit-type of (Target unit of ability being cast)) Equal to Footman
-
Conditions
-
Or - Any (Conditions) are true
- Then - Actions
-
Else - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "What the hell do you want to steal from an animal?")
- Unit - Order (Triggering unit) to Stop
- Skip remaining actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Ability being cast) Equal to Pickpocket
- (Ability being cast) Equal to Throat Cut
- (Ability being cast) Equal to Assassinate
- (Ability being cast) Equal to Steal
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Set TempLoc = (Position of (Triggering unit))
- Set TempLoc2 = (Position of (Target unit of ability being cast))
- Unit - Create 1 Dummy for Neutral Passive at TempLoc facing TempLoc2
- Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
- Set TempReal = (Facing of (Last created unit))
- Set TempReal2 = (Facing of (Target unit of ability being cast))
- Custom script: call RemoveLocation (udg_TempLoc)
- Custom script: call RemoveLocation (udg_TempLoc2)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
- TempReal Greater than or equal to (TempReal2 - 50.00)
- TempReal Less than or equal to (TempReal2 + 50.00)
-
Conditions
-
And - All (Conditions) are true
- Then - Actions
-
Else - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "You must behind your target!")
- Unit - Order (Triggering unit) to Stop
-
If - Conditions
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Ability being cast) Equal to Material Realm
-
Then - Actions
- Set TempLoc = (Position of (Triggering unit))
- Set TempGroup = (Units within 500.00 of TempLoc matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) is dead) Equal to True))))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in TempGroup) Equal to 0
-
Then - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "There are no corpses nearby.")
- Unit - Order (Triggering unit) to Stop
- Else - Actions
-
If - Conditions
- Custom script: call RemoveLocation (udg_TempLoc)
- Custom script: call DestroyGroup (udg_TempGroup)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Ability being cast) Equal to Spirit Dance
-
Then - Actions
- Set TempLoc = (Position of (Triggering unit))
- Set TempLoc2 = (Position of (Target unit of ability being cast))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Distance between TempLoc and TempLoc2) Less than or equal to 400.00
-
Then - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "Target is inside minimum range.")
- Unit - Order (Triggering unit) to Stop
- Else - Actions
-
If - Conditions
- Custom script: call RemoveLocation (udg_TempLoc)
- Custom script: call RemoveLocation (udg_TempLoc2)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Ability being cast) Equal to Drown
-
Then - Actions
-
For each (Integer A) from 0 to DMax, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- DHas[(Integer A)] Equal to True
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Target unit of ability being cast) Equal to DTarget[(Integer A)]
-
Then - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "This unit is already drowning.")
- Unit - Order (Triggering unit) to Stop
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer A) from 0 to DMax, do (Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Ability being cast) Equal to Ressurrection
- (Ability being cast) Equal to Lesser Ressurrection
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Target unit of ability being cast)) Not equal to Grave
-
Then - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "Must target a grave.")
- Unit - Order (Triggering unit) to Stop
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- ((Target unit of ability being cast) is in QRRevGroup) Equal to True
- ((Target unit of ability being cast) is in ZLRRevGroup) Equal to True
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "This unit is already ressurrecting.")
- Unit - Order (Triggering unit) to Stop
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Target unit of ability being cast)) Equal to Grave
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Ability being cast) Equal to Ressurrection
- (Ability being cast) Equal to Lesser Ressurrection
-
Conditions
-
Or - Any (Conditions) are true
- Then - Actions
-
Else - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "Only ressurrection can be cast on graves..")
- Unit - Order (Triggering unit) to Stop
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Ability being cast) Equal to Death Essence
- (Ability being cast) Equal to Unholy Frenzy
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Set TempInt = (Player number of (Triggering player))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (NecroMinionGroup[TempInt] is empty) Equal to True
-
Then - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "You don't have minions alive.")
- Unit - Order (Triggering unit) to Stop
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Ability being cast) Equal to Death Essence
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Life of (Triggering unit)) Less than or equal to ((Max life of (Triggering unit)) x 0.20)
-
Then - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "You're too weak.")
- Unit - Order (Triggering unit) to Stop
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Ability being cast) Equal to Raise Skeleton
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Life of (Triggering unit)) Less than or equal to ((Max life of (Triggering unit)) x 0.10)
-
Then - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "You're too weak.")
- Unit - Order (Triggering unit) to Stop
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Ability being cast) Equal to Soul Exchange
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Life of (Triggering unit)) Less than or equal to 99.00
- ((Target unit of ability being cast) belongs to an enemy of (Triggering player)) Equal to False
-
Then - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "You're too weak.")
- Unit - Order (Triggering unit) to Stop
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Ability being cast) Equal to Pentagram
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Life of (Triggering unit)) Less than or equal to ((Max life of (Triggering unit)) x 0.15)
-
Then - Actions
- Custom script: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "You're too weak.")
- Unit - Order (Triggering unit) to Stop
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events