• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Script Help Thread (DO NOT REQUEST SCRIPTS)

Status
Not open for further replies.

Aemirch

Hobbler
26
Posts
10
Years
  • Hi, if I use the "getplayerpos" which variables can I use?
    The ones considered to be safe.
    Are unused ones ok?
    If you are sure they are unused, then yes.
    And let's say the player is at (10,1B) and I want to check it.

    Do I say 'compare 0x(x-variable) 0x10'?
    and then 'if 0x01 got @blah'.
    Yes, you got that right.

    Also where would I sneak in syntax such as > 0x10 or <0x10?
    Is there such a syntax in the first place? I think not.
     
    5,256
    Posts
    16
    Years
  • Code:
    #define B_< 0x0
    #define B_<< 0x0
    #define B_= 0x1
    #define B_== 0x1
    #define B_> 0x2
    #define B_>> 0x2
    #define B_<= 0x3
    #define B_>= 0x4
    #define B_!= 0x5
    #define B_<> 0x5

    If you have XSE's std.rbh file, you can just use that key. For example:
    Code:
    compare LASTERESULT 0x1
    if B_! goto @inequal

    If LASTRESULT isn't equal to 1.

    Code:
    compare LASTERESULT 0x1
    if B_<= goto @lessthanorequal

    If LASTRESULT is less than, or equal to, 1.

    If you understand basic mathematical notation that key should be self-explanatory.
     

    thetripplenine

    tripple.
    98
    Posts
    11
    Years
  • writebytetooffset 0x2 0x2026B00
    writebytetooffset 0x3 0x2026B01
    writebytetooffset 0xDA 0x2024EBE
    writebytetooffset 0x67 0x2026A5A

    So the pokedex just isn't showing the sprites and stuff everything else is working.

    Here's the script incase I messed up:
    Spoiler:
     
    34
    Posts
    10
    Years
    • Seen Sep 11, 2013
    Well I feel like this is a bit of an easy question. I am trying to do the legendary battle script and this is what I have wrote.
    #dynamic 0x900000

    #org @start
    lock
    faceplayer
    msgbox @1 0x6
    cry 0x249 0x0
    wildbattle 0x249 0x1E 0x8B
    fadescreen 0x1
    fadescreen 0x0
    hidesprite 0x800F
    setflag 0x200
    release
    end

    #org @1
    = Lugia: Rawr.

    But every time I go to it I click on the Pokemon to battle it, nothing happens. Any ideas? Also thanks to anyone who helps in advance!
     

    Herpahermaderp

    I liek Mudkipz
    66
    Posts
    11
    Years
  • Well I feel like this is a bit of an easy question. I am trying to do the legendary battle script and this is what I have wrote.
    #dynamic 0x900000

    #org @start
    lock
    faceplayer
    msgbox @1 0x6
    cry 0x249 0x0
    wildbattle 0x249 0x1E 0x8B
    fadescreen 0x1
    fadescreen 0x0
    hidesprite 0x800F
    setflag 0x200
    release
    end

    #org @1
    = Lugia: Rawr.

    But every time I go to it I click on the Pokemon to battle it, nothing happens. Any ideas? Also thanks to anyone who helps in advance!

    You're cry and wildbattle offsets are wrong, it shouldn't be 249, it should be F9, since you have to convert the Pokemon's Pokedex ID to hex to use it in scripts. Also, it's recommended to use flags higher than 900, as most flags before that are used by other parts of the game, unless if you are using JPAN's hacked engine, then it doesn't matter. Other than that it looks good.
     
    Last edited:

    karatekid552

    What happens if I push it?....
    1,771
    Posts
    11
    Years
  • You're cry and wildbattle offsets are wrong, it shouldn't be 249, it should be F9, since you have to convert the Pokemon's Pokedex ID to hex to use it in scripts. Also, it's recommended to use flags higher than 900, as most flags before that are used by other parts of the game, unless if you are using JPAN's hacked engine, then it doesn't matter. Other than that it looks good.

    NO FLAGS OVER 900!

    How many freaking times do I have to say it?!?

    I'm sorry if that comes off as rude, but you can severly cripple your game by using flags over 900 as they overlap the same storage ram used for vars and PC boxes. So unless you want bad eggs and vars that don't work properly, heed my warning. I will very soon have a tutorial published which will describe this completely.

    Also, you don't have to convert to hex when writing a script. If you don't put the "0x" before a number, the script editor will read it in decimal. So, in a script:

    setflag 0xA

    Is the same as:

    setflag 10


    (Flag 10/0xA is a temporary flag that will not stay set and therefore will not work for the uses in scripts, this is only an example)
     
    5
    Posts
    11
    Years
    • Seen Jul 7, 2015
    My script for applymovement wont work. It moves me but not the sprite of the NPC. After it moves me it then locks up and doesn't let me move at all.

    I'm using XSE.

    I'm Using the Firered Rom.

    Script:
    Spoiler:
     
    Last edited:
    21
    Posts
    10
    Years
    • Seen Jun 15, 2013
    Okay so I know most people here prefer to script in the XSE style for a variety of reasons and I do plan on learning XSE when I finish my current project but for now I'm going to continue the way I started out before finding this website.

    This script's purpose is to make it so that when the player steps on a certain tile, it will apply movements to two team rocket grunts (person event #s 2 and 3), have them run left, stop, say something about how Team Rocket is the best, then run up, and, after doing so, remove the respective sprites. Then Professor Oak walks up to where they made the turn and stops. The script then ends. After compiling it into the game and testing it out, however, the rom freezes when I step onto the script tile.

    #org $script
    checkflag 0x1201
    if 0x01 goto $nothing
    applymovement 2 $rocketonerun
    $rocketonerun 1 ; #binary 0x1F 0X1F 0X1F 0X1F 0xFE
    applymovement 3 $rockettworun
    $rockettworun 1 ; #binary 0x1F 0X1F 0X1F 0X1F 0xFE
    pausemove 0
    message $talk
    $talk 1 = You'll never catch\n us Oak!\p Team Rocket\n will prevail!
    boxset 6
    applymovement 2 $rocketonerun1
    $rocketonerun1 1 ; #binary 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0xFE
    applymovement 3 $rockettworun1
    $rockettworun1 1 ; #binanry 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0xFE
    pausemove 0
    removesprite 2
    setflag 0x1202
    removesprite 3
    setflag 0x1203
    applymovement 4 $oakwalk
    $oakwalk1 ; #binary 0x12 0x12 0x12 0x12 0x12 0xFE
    pausemove 0
    setflag 0x1201
    release
    end

    #org $nothing
    end

    edit: I believe I found my own problem. Totally forgot that vars are used with script tiles. With that in mind, would this be correct?

    #org $script
    applymovement 2 $rocketonerun
    $rocketonerun 1 ; #binary 0x1F 0X1F 0X1F 0X1F 0xFE
    applymovement 3 $rockettworun
    $rockettworun 1 ; #binary 0x1F 0X1F 0X1F 0X1F 0xFE
    pausemove 0
    message $talk
    $talk 1 = You'll never catch\n us Oak!\p Team Rocket\n will prevail!
    boxset 6
    applymovement 2 $rocketonerun1
    $rocketonerun1 1 ; #binary 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0xFE
    applymovement 3 $rockettworun1
    $rockettworun1 1 ; #binanry 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0xFE
    pausemove 0
    removesprite 2
    setflag 0x1202
    removesprite 3
    setflag 0x1203
    applymovement 4 $oakwalk
    $oakwalk1 ; #binary 0x12 0x12 0x12 0x12 0x12 0xFE
    pausemove 0
    setvar 0x6000 0x0001
    release
    end

    Also if I wanted to have a tile right next to this one and I wanted to make it so that if you stepped on one of the tiles, neither one of them would activate upon stepping on them again, would I use the same var for each tile?
     
    Last edited:
    34
    Posts
    10
    Years
    • Seen Sep 11, 2013
    NO FLAGS OVER 900!

    How many freaking times do I have to say it?!?

    I'm sorry if that comes off as rude, but you can severly cripple your game by using flags over 900 as they overlap the same storage ram used for vars and PC boxes. So unless you want bad eggs and vars that don't work properly, heed my warning. I will very soon have a tutorial published which will describe this completely.

    Also, you don't have to convert to hex when writing a script. If you don't put the "0x" before a number, the script editor will read it in decimal. So, in a script:

    setflag 0xA

    Is the same as:

    setflag 10


    (Flag 10/0xA is a temporary flag that will not stay set and therefore will not work for the uses in scripts, this is only an example)
    So why isn't it working then? Is it operator error? Lol
     
    5,256
    Posts
    16
    Years
  • Okay so I know most people here prefer to script in the XSE style for a variety of reasons and I do plan on learning XSE when I finish my current project but for now I'm going to continue the way I started out before finding this website.

    This script's purpose is to make it so that when the player steps on a certain tile, it will apply movements to two team rocket grunts (person event #s 2 and 3), have them run left, stop, say something about how Team Rocket is the best, then run up, and, after doing so, remove the respective sprites. Then Professor Oak walks up to where they made the turn and stops. The script then ends. After compiling it into the game and testing it out, however, the rom freezes when I step onto the script tile.

    #org $script
    checkflag 0x1201
    if 0x01 goto $nothing
    applymovement 2 $rocketonerun
    $rocketonerun 1 ; #binary 0x1F 0X1F 0X1F 0X1F 0xFE
    applymovement 3 $rockettworun
    $rockettworun 1 ; #binary 0x1F 0X1F 0X1F 0X1F 0xFE
    pausemove 0
    message $talk
    $talk 1 = You'll never catch\n us Oak!\p Team Rocket\n will prevail!
    boxset 6
    applymovement 2 $rocketonerun1
    $rocketonerun1 1 ; #binary 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0xFE
    applymovement 3 $rockettworun1
    $rockettworun1 1 ; #binanry 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0xFE
    pausemove 0
    removesprite 2
    setflag 0x1202
    removesprite 3
    setflag 0x1203
    applymovement 4 $oakwalk
    $oakwalk1 ; #binary 0x12 0x12 0x12 0x12 0x12 0xFE
    pausemove 0
    setflag 0x1201
    release
    end

    #org $nothing
    end

    edit: I believe I found my own problem. Totally forgot that vars are used with script tiles. With that in mind, would this be correct?

    #org $script
    applymovement 2 $rocketonerun
    $rocketonerun 1 ; #binary 0x1F 0X1F 0X1F 0X1F 0xFE
    applymovement 3 $rockettworun
    $rockettworun 1 ; #binary 0x1F 0X1F 0X1F 0X1F 0xFE
    pausemove 0
    message $talk
    $talk 1 = You'll never catch\n us Oak!\p Team Rocket\n will prevail!
    boxset 6
    applymovement 2 $rocketonerun1
    $rocketonerun1 1 ; #binary 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0xFE
    applymovement 3 $rockettworun1
    $rockettworun1 1 ; #binanry 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E 0xFE
    pausemove 0
    removesprite 2
    setflag 0x1202
    removesprite 3
    setflag 0x1203
    applymovement 4 $oakwalk
    $oakwalk1 ; #binary 0x12 0x12 0x12 0x12 0x12 0xFE
    pausemove 0
    setvar 0x6000 0x0001
    release
    end

    Also if I wanted to have a tile right next to this one and I wanted to make it so that if you stepped on one of the tiles, neither one of them would activate upon stepping on them again, would I use the same var for each tile?

    NO FLAGS OVER 900!

    How many freaking times do I have to say it?!?

    I'm sorry if that comes off as rude, but you can severly cripple your game by using flags over 900 as they overlap the same storage ram used for vars and PC boxes. So unless you want bad eggs and vars that don't work properly, heed my warning. I will very soon have a tutorial published which will describe this completely.

    seriously how hard is it to read.
     
    21
    Posts
    10
    Years
    • Seen Jun 15, 2013
    seriously how hard is it to read.

    I did read. With that said, that doesn't account for the script not working properly. From what it seems the scripts will still work but will cause other parts of the game to run less smoothly/not at all so I still believe that there is a problem evident in the script itself and I would like help regarding that.
     
    5,256
    Posts
    16
    Years
  • Well, the reason for that is likely because you haven't set a variable number to the script tile - but the point still stands, change your flags. (this question has been asked before, anyway, you could've searched)
     

    karatekid552

    What happens if I push it?....
    1,771
    Posts
    11
    Years
  • I did read. With that said, that doesn't account for the script not working properly. From what it seems the scripts will still work but will cause other parts of the game to run less smoothly/not at all so I still believe that there is a problem evident in the script itself and I would like help regarding that.

    You are also using Pokescript, a script editor that hasn't been updated since 2006. Hacking has changed and most people use either PSKV or XSE. You will find very few people here who use or even know the syntax for Pokescript which makes it much hard to help you.
     
    50
    Posts
    12
    Years
  • Soo I'm using PKSV, and I wrote a script that just hasn't been working properly and I can't seem to figure out why. It's for FireRed, and this is it with the dynamic offsets:

    Spoiler:


    The problem was originally that it would just freeze up when I entered the room (I set it as a Map Script, and I selected 02), but then I repointed it and it would show this weird text that didn't end, and once I repointed it again, it would display the correct text but it would just completely freeze after the line "He lives behind us,", and so I repointed several more times and it hasn't fixed itself, so I'm not sure what the problem is..
    If anyone could help that would be awesome!
     

    karatekid552

    What happens if I push it?....
    1,771
    Posts
    11
    Years
  • Soo I'm using PKSV, and I wrote a script that just hasn't been working properly and I can't seem to figure out why. It's for FireRed, and this is it with the dynamic offsets:

    Spoiler:


    The problem was originally that it would just freeze up when I entered the room (I set it as a Map Script, and I selected 02), but then I repointed it and it would show this weird text that didn't end, and once I repointed it again, it would display the correct text but it would just completely freeze after the line "He lives behind us,", and so I repointed several more times and it hasn't fixed itself, so I'm not sure what the problem is..
    If anyone could help that would be awesome!

    Flag 0x11 is a temporary flag, meaning it won't stay set. Look for my tutorial that will come out in the next coming days when DrFuji comes back. It will explain all of this.

    I would try using @null instead of :null. It may work both ways, but consistancy helps readablility and accuracy.

    Either way, there is no need for a flag at all. By setting the var, it will prevent the script from running again, so you can remove that whole sequence right away.

    Other than that, it looks pretty good. Here is a revised script:

    Spoiler:
     
    50
    Posts
    12
    Years
  • Flag 0x11 is a temporary flag, meaning it won't stay set. Look for my tutorial that will come out in the next coming days when DrFuji comes back. It will explain all of this.

    I would try using @null instead of :null. It may work both ways, but consistancy helps readablility and accuracy.

    Either way, there is no need for a flag at all. By setting the var, it will prevent the script from running again, so you can remove that whole sequence right away.

    Other than that, it looks pretty good. Here is a revised script:

    Spoiler:

    I used the new script you gave me and it seems a bit better, as it's not totally locking out, but it keeps starting over and repeating the text after it reaches "he lives behind us," so nothing else can happen :/ Thanks for trying though!
    Anyonee else have any idea?
     

    ExitWound

    Boggle
    79
    Posts
    16
    Years
    • Seen Sep 22, 2016
    I need some help. I'm utterly confused at the moment... I have a script where you can battle somebody 3 different times, each time having stronger Pokémon. He should give you 3 different items each time you beat him, until he is rebattle-able. He's suppose to give you Leftovers the first time you beat him, PP Max the second, and a Master ball the third. When rebattle-able, he should give a PP Up each time you beat him. As of right now, he only gives the Leftovers and Master ball. No PP Max and no PP Up. What is going on with this script?

    Code:
    #dynamic 0x6C4340
    
    #org @start
    checkflag 0x850
    if 0x1 goto @start1
    trainerbattle 0x1 0xa1 0x0 @before @after @later
    end
    
    #org @start1
    checkflag 0x851
    if 0x1 goto @start2
    trainerbattle 0x1 0x29b 0x0 @before1 @after1 @later1
    end
    
    #org @start2
    settrainerflag 0x29d
    trainerbattle 0x1 0x29d 0x0 @before2 @after2 @later2
    end
    
    #org @later
    setflag 0x850
    msgbox @msg1 0x2
    giveitem 0xc8 0x1 0x0
    release
    end
    
    #org @later1
    setflag 0x851
    msgbox @msg2 0x2
    giveitem 0x47 0x1 0x0
    release
    end
    
    #org @later2
    checkflag 0x852
    if 0x1 goto @beaten
    setflag 0x852
    msgbox @msg3 0x2
    giveitem 0x1 0x1 0x0
    release
    end
    
    #org @beaten
    msgbox @msg4 0x2
    giveitem 0x45 0x1 0x0
    release
    end
    
    #org @before
    = I am legend.
    
    #org @after
    = I... am...\pI'm speechless...
    
    #org @msg1
    = You are truly gifted...\lBut next time, you will fail.\pTake this, and remember me.
    
    #org @before1
    = This time, you will not be so\nlucky.
    
    #org @after1
    = How is this possible!?
    
    #org @msg2
    = I promise...\nI will defeat you.
    
    #org @before2
    = This time, you will lose.
    
    #org @after2
    = Again, I am beaten...
    
    #org @msg3
    = You are a King among peasants.
    
    #org @msg4
    = For the umpteenth time, I have\nfailed.\pClearly, you are the greatest.\pSo long as you defeat me, you\nmay have this.
     
    Status
    Not open for further replies.
    Back
    Top