View Single Post
Old February 27th, 2013 (5:49 AM).
karatekid552's Avatar
karatekid552 karatekid552 is offline
What happens if I push it?....
    Join Date: Nov 2012
    Location: Do you really want to know? Really?
    Gender: Male
    Nature: Bold
    Posts: 1,766
    Originally Posted by FBI agent View Post
    Lets see here.
    checktrainerflag 0x66 'Set when trainer is battled
    compare lastresult 0x0 'Check if flag is not set (i.e not battled)
    if 0x1 goto @finished 'If it's not battled goto @finish

    It's only working because you can't do that, and it runs anyways (Atleast not in PKSV's new version. Just do checkflag, if true.)

    What you should do is:
    checktrainerflag 0x66
    if 0x1 goto @finished

    Also, logically you're setting the trainerflag if you haven't battled (which is wrong). Here's a PKSV representation of what it should look like.


    #dynamic 0x740000
    #org @start
    checktrainerflag 0x66
    if TRUE jump @done
    msgbox @question
    callstd MSG_YESNO
    compare LASTRESULT YES
    if != jump @no
    settrainerflag 0x66
    msgbox @openbattle
    callstd MSG_NORMAL
    trainerbattle 0x3 0x66 0x1 @defeat
    jump @done

    #org @done
    msgbox @after
    callstd MSG_NORMAL

    #org @no
    msgbox @tired
    callstd MSG_NORMAL

    #org @question
    = Do you want to battle?

    #org @tired
    = Next time then.

    #org @after
    = That was a good battle!

    #org @openbattle
    = Prepare for battle!

    #org @defeat
    = Damn I lost

    Try that PKSV version, you can convert it to XSE easily, if you wish.
    Umm FBI, trainer flags work backwards. They are cleared when you beat them. Another name for settrainerflag is enabletrainer. They are interchangeable names for the same command. Same goes for cleartrainerflag, its other optional name is disabletrainer.

    I know that the commands themselves work that way, but the settrainerflag 0x0 command may be equivalent to a standard clearflag 0x500 (trainer flags are just regular flags starting at 500 if I remember correctly) so there is a chance that the main names for the commands are misleading. The only way to really tell would be to take a clean rom and right off the bat, checkflag 0x500 and see what it holds.

    Proof- I wrote a working script to make every trainer in the game ready to battle again. It didn't work when I logically used cleartrainerflag, so when I switched to setrainerflag, everybody wanted to battle again.

    Edit: Comrade likes your Signiture.

    Paired with Simba