View Single Post
  #8159    
Old May 7th, 2013 (12:09 PM).
Spherical Ice's Avatar
Spherical Ice
 
Join Date: Nov 2007
Location: UK
Send a message via Skype™ to Spherical Ice
Quote originally posted by LaDestitute:
Can someone proof-check this for me? I'm using a compare variable to set different NPC movement depending on variable value (with the three script events sharing the same variable, but different values) but it's not working as I thought.

Code:
#dynamic 0x800000

#org @start
countpokemon
compare 0x800D 0x1
if 0x1 goto @continue
goto @nopokemon

#org @nopokemon
compare 0x4000 0x1
if 0x1 goto @nopass0
if 0x2 goto @nopass1
if 0x3 goto @nopass2

#org @continue
release
end

#org @nopass0
applymovement 0x1 @move3
waitmovement 0x0
msgbox @1 0x6
applymovement 0x1 @move4
waitmovement 0x0
release
setflag 0x200
end

#org @nopass1
applymovement 0x1 @move1
waitmovement 0x0
msgbox @1 0x6
applymovement 0x1 @move2
waitmovement 0x0
release
setflag 0x200
end

#org @nopass2
applymovement 0x1 @move5
waitmovement 0x0
msgbox @1 0x6
applymovement 0x1 @move6
waitmovement 0x0
release
setflag 0x200
end

#org @move1
#raw 0x62 
#raw 0x1D
#raw 0x1D
#raw 0xFE

#org @move2
#raw 0x11
#raw 0x11
#raw 0xFE

#org @move3
#raw 0x62 
#raw 0x0A
#raw 0x1D
#raw 0x1D
#raw 0xFE

#org @move4
#raw 0x11
#raw 0x11
#raw 0x0B
#raw 0xFE

#org @move5
#raw 0x62 
#raw 0x0B
#raw 0x1D
#raw 0x1D
#raw 0xFE

#org @move6
#raw 0x11
#raw 0x11
#raw 0x0A
#raw 0xFE

#org @1
= I can't let you pass because you\ndon't have any Pokémon.\pIt's not safe to go out without\nat least one.
Code:
#dynamic 0x800000

#org @start
countpokemon
compare 0x800D 0x1
This means the script will only not activate if the player has one Pokémon in their party - use checkflag 0x828 instead.

Code:
if 0x1 goto @continue
goto @nopokemon

#org @nopokemon
compare 0x4000 0x1
if 0x1 goto @nopass0
if 0x2 goto @nopass1
if 0x3 goto @nopass2
You need to add the compare line everytime.

Code:
#org @continue
release
end

#org @nopass0
applymovement 0x1 @move3
waitmovement 0x0
msgbox @1 0x6
applymovement 0x1 @move4
waitmovement 0x0
release
setflag 0x200
end
Release always goes before end, without any commands in between.

Code:
#org @nopass1
applymovement 0x1 @move1
waitmovement 0x0
msgbox @1 0x6
applymovement 0x1 @move2
waitmovement 0x0
release
setflag 0x200
end

#org @nopass2
applymovement 0x1 @move5
waitmovement 0x0
msgbox @1 0x6
applymovement 0x1 @move6
waitmovement 0x0
release
setflag 0x200
end
Again, release goes directly before end.
Code:
#org @move1
#raw 0x62 
#raw 0x1D
#raw 0x1D
#raw 0xFE

#org @move2
#raw 0x11
#raw 0x11
#raw 0xFE

#org @move3
#raw 0x62 
#raw 0x0A
#raw 0x1D
#raw 0x1D
#raw 0xFE

#org @move4
#raw 0x11
#raw 0x11
#raw 0x0B
#raw 0xFE

#org @move5
#raw 0x62 
#raw 0x0B
#raw 0x1D
#raw 0x1D
#raw 0xFE

#org @move6
#raw 0x11
#raw 0x11
#raw 0x0A
#raw 0xFE

#org @1
= I can't let you pass because you\ndon't have any Pokémon.\pIt's not safe to go out without\nat least one.
So, the fixed script would look like this:

Code:
#dynamic 0x800000

#org @start
checkflag 0x828
if 0x1 goto @continue
goto @nopokemon

#org @nopokemon
compare 0x4000 0x1
if 0x1 goto @nopass0
compare 0x4000 0x1
if 0x2 goto @nopass1
compare 0x4000 0x1
if 0x3 goto @nopass2
goto @continue

#org @continue
release
end

#org @nopass0
applymovement 0x1 @move3
waitmovement 0x0
msgbox @1 0x6
applymovement 0x1 @move4
waitmovement 0x0
setflag 0x200
release
end

#org @nopass1
applymovement 0x1 @move1
waitmovement 0x0
msgbox @1 0x6
applymovement 0x1 @move2
waitmovement 0x0
setflag 0x200
release
end

#org @nopass2
applymovement 0x1 @move5
waitmovement 0x0
msgbox @1 0x6
applymovement 0x1 @move6
waitmovement 0x0
setflag 0x200
release
end

#org @move1
#raw 0x62 
#raw 0x1D
#raw 0x1D
#raw 0xFE

#org @move2
#raw 0x11
#raw 0x11
#raw 0xFE

#org @move3
#raw 0x62 
#raw 0x0A
#raw 0x1D
#raw 0x1D
#raw 0xFE

#org @move4
#raw 0x11
#raw 0x11
#raw 0x0B
#raw 0xFE

#org @move5
#raw 0x62 
#raw 0x0B
#raw 0x1D
#raw 0x1D
#raw 0xFE

#org @move6
#raw 0x11
#raw 0x11
#raw 0x0A
#raw 0xFE

#org @1
= I can't let you pass because you\ndon't have any Pokémon.\pIt's not safe to go out without\nat least one.
To be honest, you could save a lot of space by using the call command for the nopass parts but this will work.
__________________