I'm trying to right a script that occurs when the player gets near a ladder. The player then loses controls, two zombies come out of hiding and after a short staredown for about two seconds, they fight and when both zombies die, the ladder works again and the player can climb up. Here is what I have so far:
scn aaaLadderBattleScript
ref player
float timer
float fQuestDelayTime
short DoOnce
short OnlyOnce
short distance
begin GameMode
set fQuestDelayTime to .1
set player to Player.GetSelf
if (aaaCloseToLadderGlobal && OnlyOnce == 0)
if (DoOnce == 0)
DisablePlayerControls
aaaLadderZombie1.Enable
aaaLadderZombie1.Enable
PlaySound aaaBranchBreak
set aaaLadderTime to 1
set DoOnce to 1
endif
set timer to timer + GetSecondsPassed
if (timer > 4)
EnablePlayerControls
set aaaLadderTime to 0
set OnlyOnce to 1
set fQuestDelayTime to 3
endif
endif
if (aaaLadderZombie1.GetDead && aaaLadderZombie2.GetDead)
aaaZWLadderBottom.Enable
aaaFakeLadder.Disable
set fQuestDelayTime to 100
endif
end
EDIT:
How do I make the zombies go to the two X markers I put for them called aaaZWLadderZombieMarker1 and aaaZWLadderZombieMarker2?
EDIT AGAIN:
I Tried some things. I made a package that should activate when I flip a global variable to 1. This global will flip to 1 when the player is within 400 units of the ladder which has a script:
scn aaaIsCloseToFakeLadder
short distance
begin GameMode
set distance to GetDistance Player
message "%.0f" distance
if (GetDistance player < 400)
set aaaCloseToLadderGlobal to 1
else
set aaaCloseToLadderGlobal to 0
endif
end
This thing never says I'm close enough to it and never activates the script. This script activates, but always results in false.