View Single Post
  #20330    
Old January 10th, 2012 (08:26 AM). Edited January 10th, 2012 by Binary.
Binary's Avatar
Binary
え?
 
Join Date: Aug 2007
Age: 20
Quote originally posted by SKRoy:
I made this script:

Spoiler:
#dynamic 0x800000

#org @start
checkflag 0x1016
if 0x1 goto @done
applymovement 0x05 @move
waitmovement 0x0
trainerbattle 0x0 0x149 0x0 @before @after
message @1
callstd 0x6
applymovement 0x05 @move2
waitmovement 0x0
setflag 0x1016
hidesprite 0x5
release
end

#org @1
= I must go now. I'm gonna train my\nEspeon. Next time I win! Bye!

#org @before
= Hey stupid! I trade my starter\nPOKéMON for a Espeon! I want to\ptry my new Espeon. Let's fight!

#org @after
= Noooo! How can I lose?

#org @done
release
end

#org @move
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

#org @move2
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0xFE


The meaning of this script is that when the fight is over that he talks to you and walk away, but after the fight you must talk to him again before he talk and go away. How can I fix this?
trainerbattle 0x0 is used mainly for trainers on routes and stuff. So the later part of the script after the trainerbattle command is only executed when you talk to the NPC again after battle (like with trainers on routes).

The correct way to do this would be to use trainerbattle 0x1.
trainerbattle 0x1 0x[TRAINER ID] 0x0 @before @after @later
Notice the third pointer, it's the pointer from where the script continues after the player wins the battle.

Spoiler:
#dynamic 0x800000

#org @start
checkflag 0x1016
if 0x1 goto @done
applymovement 0x05 @move
waitmovement 0x0
trainerbattle 0x0 0x149 0x0 @before @after @later
end

#org @later
message @1 0x6
applymovement 0x05 @move2
waitmovement 0x0
setflag 0x1016
hidesprite 0x5
release
end

#org @1
= I must go now. I'm gonna train my\nEspeon. Next time I win! Bye!

#org @before
= Hey stupid! I trade my starter\nPOKéMON for a Espeon! I want to\ptry my new Espeon. Let's fight!

#org @after
= Noooo! How can I lose?

#org @done
release
end

#org @move
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

#org @move2
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0xFE

SCRIPT HELP THREAD
__________________