HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Value changing midway through a trigger

08-05-2005, 07:22 AM#1
Tossrock
Quote:
Originally Posted by code
Spin Hit
Events
....Unit - A unit Starts the effect of an ability
Conditions
....(Ability being cast) Equal to Spin Effect
Actions
....Custom script: local player LocalPlayer
....Custom script: local unit SpinTarget
....Custom script: local unit Caster
....Set SpinTarget = (Target unit of ability being cast)
....Set LocalPlayer = (Owner of SpinTarget)
....Set Caster = (Casting unit)
....Set CamFaceOn[(Player number of LocalPlayer)] = False
....Game - Display to (All players) the text: (String((Player number of (Owner of (Target unit of ability being cast)))))
....If (All Conditions are True) then do (Then Actions) else do (Else Actions)
........If - Conditions
............(Target unit of ability being cast) Equal to BallHolder
........Then - Actions
............Special Effect - Destroy BallEffects[(Player number of LocalPlayer)]
............Set BallHolder = No unit
............Unit - Create 1 Ball for Neutral Passive at TempPoint facing TempPoint
............Custom script: call RemoveLocation (udg_TempPoint)
............Set Ball = (Last created unit)
............Unit - Remove Throw Ball from SpinTarget
............Unit - Add Catch to SpinTarget
............Unit - Add Steal to SpinTarget
........Else - Actions
....Game - Display to (All players) the text: (String((Player number of (Owner of (Target unit of ability being cast)))))
....Unit - Make SpinTarget face ((Facing of SpinTarget) + 180.00) over 0.05 seconds
....Wait 0.05 game-time seconds
....Unit - Make SpinTarget face ((Facing of SpinTarget) + 180.00) over 0.10 seconds
....Wait 0.10 game-time seconds
....Unit - Make SpinTarget face ((Facing of SpinTarget) + 180.00) over 0.20 seconds
....Wait 0.20 game-time seconds
....Unit - Make SpinTarget face ((Facing of SpinTarget) + 180.00) over 0.40 seconds
....Wait 0.40 game-time seconds
....Unit - Make SpinTarget face ((Facing of SpinTarget) + 180.00) over 0.80 seconds
....Wait 4.00 game-time seconds
....Game - Display to (All players) the text: (String((Player number of (Owner of (Target unit of ability being cast)))))
....If (All Conditions are True) then do (Then Actions) else do (Else Actions)
........If - Conditions
............Dead [(Player number of (Owner of (Target unit of ability being cast)))] Equal to False
........Then - Actions
............Set CamFaceOn[(Player number of LocalPlayer)] = True
............Game - Display to (All players) the text: (String((Player number of (Owner of (Target unit of ability being cast)))))
........Else - Actions
....Set TempGroup = (Units of type Caster)
....Unit Group - Pick every unit in TempGroup and do (Actions)
........Loop - Actions
............Unit - Remove (Picked unit) from the game
....Custom script: call DestroyGroup (udg_TempGroup)

My problem is, the first two underlined Actions display the correct number, but the second two are set to one, no matter what unit the spell is cast on. I can't think of any way around this, as I need to use that number in an If statement, so I can't use a Local number. This is rather vexing. Does anyone see anything that could cause it to change values like this?
08-05-2005, 07:43 AM#2
EdwardSwolenToe
Waits reset target of ability being cast. Try setting targ of ability being casted into a variable at the start of the trigger then referencing it off that.
08-05-2005, 11:54 AM#3
Anitarf
Cast event responses are bugged like that. Set the unit (or the player number) to a local variable before the waits, and then before the if, store it to a global again and use that global in the if.
08-05-2005, 06:23 PM#4
Tossrock
Thanks guys!