if (the castNum of sprite 20 = the number of cast "E") and ((posx = 13) and (posy = 2)) and not getmap then
set getmap to 1
play frame "getmap"
end if
end if
updateStage()
if talknumber <= 3 then
set p to 0
if the castNum of sprite 20 = the number of cast "N" then
if ((posx = 3) and (posy = 9)) or ((posx = 10) and (posy = 9)) or ((posx = 17) and (posy = 5)) or ((posx = 8) and (posy = 20)) then
set p to 1
end if
else
if the castNum of sprite 20 = the number of cast "E" then
if ((posx = 9) and (posy = 30)) or ((posx = 9) and (posy = 23)) or ((posx = 5) and (posy = 16)) or ((posx = 14) and (posy = 19)) or ((posx = 20) and (posy = 25)) then
set p to 1
end if
else
if the castNum of sprite 20 = the number of cast "S" then
if ((posx = 30) and (posy = 14)) or ((posx = 23) and (posy = 14)) or ((posx = 16) and (posy = 18)) or ((posx = 25) and (posy = 3)) then
set p to 1
end if
else
if the castNum of sprite 20 = the number of cast "W" then
if ((posx = 14) and (posy = 3)) or ((posx = 14) and (posy = 10)) or ((posx = 18) and (posy = 17)) or ((posx = 3) and (posy = 8)) then
set p to 1
end if
end if
end if
end if
end if
if p = 1 then
play frame "TALK_" & string(talknumber)
end if
else
set r to random(100)
if r <= 8 then
go("ENEMY")
else
if r >= 98 then
play frame "tostart"
end if
end if
end if
else
if getAt(getAt(map, posy - 1), posx) = 2 then
if (posx = 2) and (posy = 3) then
repeat with i = 3 to 5
set the cursor of sprite i to 0
end repeat
go("goal")
else
if (posx = 21) and (posy = 8) and (talknumber <= 2) then