• 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.
58
Posts
13
Years
Can anyone please help me with this script? I am not sure what's wrong with it but it doesn't compile. It says "No "#org/#seek directives were found" when I try to compile it.
What I'm trying to do is to make a NPC not let me past a point if I don't have the boulderbadge (since it is leaf green version I'm hacking). Actually, I just copied another NPC's script, edited the text and added the dynamic offset since I don't want to edit an old script, rather i want to make a new one.

(Let's call this one Script A)
Spoiler:


Now have a look at the picture in the attachement.

See, when you step infront of the door, the script activates which makes the NPC prevent you from going there.

The original scripts are:

Player (Let's call this script B):
Spoiler:


Other Script (Let's call it script C):
Spoiler:


Sorry for the long post.

P.S. I'm gonna need a script like Script C above to go with my script A, but I'd like to make the second script on my own, as long as you tell me whats wrong with script A.
 
Last edited:

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
Can anyone please help me with this script? I am not sure what's wrong with it but it doesn't compile. It says "No "#org/#seek directives were found" when I try to compile it.
What I'm trying to do is to make a NPC not let me past a point if I don't have the boulderbadge (since it is leaf green version I'm hacking). Actually, I just copied another NPC's script, edited the text and added the dynamic offset since I don't want to edit an old script, rather i want to make a new one.

(Let's call this one Script A)
Spoiler:


Now have a look at the picture in the attachement.

See, when you step infront of the door, the script activates which makes the NPC prevent you from going there.

The original scripts are:

Player (Let's call this script B):
Spoiler:


Other Script (Let's call it script C):
Spoiler:


Sorry for the long post.

P.S. I'm gonna need a script like Script C above to go with my script A, but I'd like to make the second script on my own, as long as you tell me whats wrong with script A.

You forgot to put the '#' infront of the dynamic command in Script A.
 

metapod23

Hardened Trainer
673
Posts
15
Years
  • Seen Aug 18, 2016
Pretty much. I could do that easily, if I didn't need the variables to change the level accordingly. x.x I also wanted to see if I could make it check the level, then change the OW with dynamic OWs. (Maybe activated with a walk-script on the first tiles in the map, or a level map. But from what I read the level maps are limited? I haven't got the first part to work, so I won't bcrazy with that right now.)So if it would call you battling a Pidgey at lvl 18, it'd be a Pidgeotto instead.

I was looking for a way to replace the "randomly generate Arrests in grass" I don't know, I was just experimenting with the new code available. I wasn't too big on scripting up 'til now, so I had no idea what anything meant when it was released. But now I'm trying to get my hands more dirty because I couldn't achieve what I wanted in my crazy hacks.

Without being able to figure out exactly what needs to be done to make special 0x58 to work, I can't really be much help, unfortunately (I kind of want to use this in my hack now, too, but can't get it to work). Hopefully someone else will read this and explain what needs to be done. I've tried a few different ways - on two occasions I've managed to get random leveled Sandslash and then Sunflora to appear, but I don't know why (neither was my intention).

EDIT: Though I haven't found a way to get special 0x58 to work, I have discovered a sort of way to do this with special 0x56:

Code:
setvar 0x8004 0x10
setvar 0x8005 0xffff
setvar 0x8006 0x0
setvar 0x8007 0x0
special 0x56
release
end

^ This would make only Pidgey of the levels that are already in that map to appear.

ATM, I couldn't say how to make various Pokemon show up in the map. At best, using special 0x56, it would require using the Walking Script, which, on every step would use the "random" command to generate a new Pokemon (with special 0x56) of a different level (using setvar 0x4051) to appear - none of which should be necessary if I understood how special 0x58 worked ...

Thanks, but that didn't help. As soon as he gets out of view, he returns to its original place and does nothing anymore.

If you want him to move to a permanent location and stay there every time you enter the map, you must create a header script with "movesprite2" in it, set to activate after this event has completed (with a flag or a variable).

If you just want to hide the sprite after it has walked away, give the sprite an ID # equal to an unused flag, and put in your script: setflag 0x(flag#); hidesprite 0x(sprite#).
 
Last edited:

Pogeygothaxed

Pokémon exDeltaSpecies Creator
231
Posts
14
Years
Without being able to figure out exactly what needs to be done to make special 0x58 to work, I can't really be much help, unfortunately (I kind of want to use this in my hack now, too, but can't get it to work). Hopefully someone else will read this and explain what needs to be done. I've tried a few different ways - on two occasions I've managed to get random leveled Sandslash and then Sunflora to appear, but I don't know why (neither was my intention).

EDIT: Though I haven't found a way to get special 0x58 to work, I have discovered a sort of way to do this with special 0x56:

Code:
setvar 0x8004 0x10
setvar 0x8005 0xffff
setvar 0x8006 0x0
setvar 0x8007 0x0
special 0x56
release
end
^ This would make only Pidgey of the levels that are already in that map to appear.

ATM, I couldn't say how to make various Pokemon show up in the map. At best, using special 0x56, it would require using the Walking Script, which, on every step would use the "random" command to generate a new Pokemon (with special 0x56) of a different level (using setvar 0x4051) to appear - none of which should be necessary if I understood how special 0x58 worked ...



If you want him to move to a permanent location and stay there every time you enter the map, you must create a header script with "movesprite2" in it, set to activate after this event has completed (with a flag or a variable).

If you just want to hide the sprite after it has walked away, give the sprite an ID # equal to an unused flag, and put in your script: setflag 0x(flag#); hidesprite 0x(sprite#).

Using the Swarm to force an appearance of only one Pokemon is a great idea. Also, I came up with this after scrolling up and down the manual.
Code:
#dynamic 0x800000
#org @start
setvar 0x8005 0x0 'Changes the data for Pokemon to appear - in this case, anywhere
setvar 0x8006 0x0 'Loads from pointers set 
setvar 0x8008 0xf480 'Sets pointer to new Data - memory block for wild pokemon
setvar 0x8009 0x0203  'Second half of the offset
Writebytetooffset 0x12 0x0203f480 'Writes levels to memory block
Writebytetooffset 0x10 0x0203f480 'Writes Pokemon to memory block
special 0x58 'calls Wild Data switch
special 0x59 'calls the cancel of the switch end
Apparently, 0203f480 is a memory block that was made for the Wild Pokemon data. I assume that's what he was referring to when he said dynamically switching with it. You would Writebyte to it using the format Minlv =1 byte, maxlv = 1 byte, species = 2 byte, which would be a total of 4. Feel free to correct me on this if I'm mistaking anything as I'm still learning Hex.

There's also pointers that point to Location data for Pokemon.
Code:
Pointer to Grass pokémon Data
0203f48c 
Pointer to Water pokémon data
0203f490
Pointer to Tree pokémon data
0203f494
Pointer to Fishing pokémon data
0203f498
You would probably load one of these with 8006 depending on where you wanted the data to switch. i.e. if you only wanted to change grass or water. I used 0x0 for all, but you could also use 01 and 0x02 as stated in the manual then point to their locations above. That being said, I believe since the table is only 28 bytes, it wasn't meant to store the data for changing ALL of the Pokemon on the map, instead, it's reserved for only one location type. i.e. Grass.

It's supposed to be set up the same as special 0x56, but in that special you also add the level...which wouldn't be needed, since it's called with the species when the switch triggers? So I think it's only 2 bytes and not 4. 1+1=lvs=2bytes+2bytes for Pokemon = 4 + 2 for location = 6: 6*12 = 72, so you'd need 72 bytes for this method. Obviously 72>28, so...I'm not sure how to set it up completely, since I remember you saying there needs to be 12 slots. However, if used with Swarm, you'd only need 6 bytes, because there's only one Pokemon that will appear?

Thus leading me to my next theory: you were correct when you said that you need to make your own table and then point to it. The dynamic part is where you can switch, on the fly, which table the map uses. i.e. You could change which table the grass uses, the water, or both, at anytime. Makes sense.

All of this is in the manual, you just have to look around for it...I'm still not sure if I put it together correctly.

edit: don't try using the script, I just made an explain one of the layout that might be used when creating the switch.

edit2: I forgot to mention, if you wanted to include the Change Battle Level you could probably do that by making the table, setting the level, and then assigning the hex of the level the variable of 4051, then set 4051 to use one of the switch controls. i.e 0x1yy, etc. I haven't tested this yet, though.
 
Last edited:

deoxys121

White Kyurem Cometh
1,254
Posts
13
Years
Changing First Encounter

I'd like to know if there is a way to change which Pokemon you encounter in Pokemon Ruby after you choose your starter. I would like to make this change to a specific Pokemon for an important plot point. I am able to open the scripts that appear on the Route 101 Map using AdvanceMap 1.90 and PKSV. This is the script from the Bag which contains the Pokeballs, but I'm not sure if this is where I start. Any help would be appreciated. I have little experience with scripting, but would like to learn more.

Code:
#org 0x814EA7F
'-----------------------------------
lock
faceplayer
setflag RS_POKEMON
setflag 0x52
fadescreen FADEOUT_BLACK
disappear 0x4
movesprite 0xFF 0x6 0xD
applymovement PLAYER 0x81A083F ' raw_27 end
pauseevent 0x0
special CHOOSE_POKEMON
waitspecial
applymovement 0x2 0x814EAD7 ' walk_right_slow end
pauseevent 0x0
msgbox 0x816D191 ' PROF. BIRCH: Whew......
callstd MSG_NOCLOSE ' Non-closing message
special HEAL_POKEMON
setflag 0x2D0
clearflag 0x2D1
setflag 0x2BC
setvar 0x4084 0x2
setvar 0x4060 0x3
clearflag 0x4000
warp 0x1 0x4 0xFF 0x6 0x5
waitspecial
release
end


#org 0x816D191
= PROF. BIRCH: Whew...\pI was in the tall grass studying wild\nPOK\eMON when I was jumped.\pYou saved me.\nThanks a lot!\pOh?\pHi, you're \v\h01\v\h05!\pThis is not the place to chat, so come\nby my POK\eMON LAB later, okay?

#org 0x81A083F
M raw_27 end

#org 0x814EAD7
M walk_right_slow end
 

metapod23

Hardened Trainer
673
Posts
15
Years
  • Seen Aug 18, 2016
Using the Swarm to force an appearance of only one Pokemon is a great idea. Also, I came up with this after scrolling up and down the manual.
Code:
#dynamic 0x800000
#org @start
setvar 0x8005 0x0 'Changes the data for Pokemon to appear - in this case, anywhere
setvar 0x8006 0x0 'Loads from pointers set 
setvar 0x8008 0xf480 'Sets pointer to new Data - memory block for wild pokemon
setvar 0x8009 0x0203  'Second half of the offset
Writebytetooffset 0x12 0x0203f480 'Writes levels to memory block
Writebytetooffset 0x10 0x0203f480 'Writes Pokemon to memory block
special 0x58 'calls Wild Data switch
special 0x59 'calls the cancel of the switch end
Apparently, 0203f480 is a memory block that was made for the Wild Pokemon data. I assume that's what he was referring to when he said dynamically switching with it. You would Writebyte to it using the format Minlv =1 byte, maxlv = 1 byte, species = 2 byte, which would be a total of 4. Feel free to correct me on this if I'm mistaking anything as I'm still learning Hex.

There's also pointers that point to Location data for Pokemon.
Code:
Pointer to Grass pokémon Data
0203f48c 
Pointer to Water pokémon data
0203f490
Pointer to Tree pokémon data
0203f494
Pointer to Fishing pokémon data
0203f498
You would probably load one of these with 8006 depending on where you wanted the data to switch. i.e. if you only wanted to change grass or water. I used 0x0 for all, but you could also use 01 and 0x02 as stated in the manual then point to their locations above. That being said, I believe since the table is only 28 bytes, it wasn't meant to store the data for changing ALL of the Pokemon on the map, instead, it's reserved for only one location type. i.e. Grass.

It's supposed to be set up the same as special 0x56, but in that special you also add the level...which wouldn't be needed, since it's called with the species when the switch triggers? So I think it's only 2 bytes and not 4. 1+1=lvs=2bytes+2bytes for Pokemon = 4 + 2 for location = 6: 6*12 = 72, so you'd need 72 bytes for this method. Obviously 72>28, so...I'm not sure how to set it up completely, since I remember you saying there needs to be 12 slots. However, if used with Swarm, you'd only need 6 bytes, because there's only one Pokemon that will appear?

Thus leading me to my next theory: you were correct when you said that you need to make your own table and then point to it. The dynamic part is where you can switch, on the fly, which table the map uses. i.e. You could change which table the grass uses, the water, or both, at anytime. Makes sense.

All of this is in the manual, you just have to look around for it...I'm still not sure if I put it together correctly.

edit: don't try using the script, I just made an explain one of the layout that might be used when creating the switch.

edit2: I forgot to mention, if you wanted to include the Change Battle Level you could probably do that by making the table, setting the level, and then assigning the hex of the level the variable of 4051, then set 4051 to use one of the switch controls. i.e 0x1yy, etc. I haven't tested this yet, though.

I have tried different things with 0x0203f480, including manually writing every byte of the data (i.e. writebytetooffset 0x03 0x0203f480; writebytetooffset 0x03 0x0203f481; writebytetooffset 0x97 0x0203f482; writebytetooffset 0x00 0x0203f483) < Trying to get Mew to appear just to make certain whether it's working or not - and haven't had any success. If you do figure out the correct method, please let me know.
 
58
Posts
13
Years
Please reffer to my post on the previous page. (Post #5470)
My script finally DID compile, and I made a new script on which if you step it activates the first script (script A). Now it freezes when I step on the script tile ingame. Is there anything else wrong with the script (except the fact that I forgot to put a # infront of dynamic)?
 

Satoshi Ookami

Memento Mori
14,254
Posts
15
Years
Please reffer to my post on the previous page. (Post #5470)
My script finally DID compile, and I made a new script on which if you step it activates the first script (script A). Now it freezes when I step on the script tile ingame. Is there anything else wrong with the script (except the fact that I forgot to put a # infront of dynamic)?
You might've forgotten to put 0003 into Unknown bar and some number into var number.
 

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
Please reffer to my post on the previous page. (Post #5470)
My script finally DID compile, and I made a new script on which if you step it activates the first script (script A). Now it freezes when I step on the script tile ingame. Is there anything else wrong with the script (except the fact that I forgot to put a # infront of dynamic)?

Try and check your variables of your script tile on Advance Map.
mappy2.png

If you're hacking FireRed, try putting 0003 on Unknown and 4050 on Var number.
 

Pichuxhack

Pichu Trainer
9
Posts
13
Years
  • Seen Aug 19, 2016
I'm trying to make a script so that you can catch your starter like how you catch pokemon in the safari zone but after you play one game the zone locks up
 

deoxys121

White Kyurem Cometh
1,254
Posts
13
Years
Issue with Legendary Battle Script

I'm trying to create a script in Pokemon Ruby for which you battle a Level 50 Reshiram (I have replaced Kyogre with Reshiram in my hack, so it would use Kyogre's Poke ID). I used Poketronic to create the script, and chose 8900 for the invisibility flag and 8901 for the done flag. I inserted it at 6B8E74, and set this script to a person event in AdvanceMap 1.90. I set 8901 as the person ID, reflective of the done flag. With all of this set up, everything works just fine except that the sprite does not disappear after the battle, and you can keep battling and catching it over and over. I want to remove this. I opened the script using PKSV, and this is what the output was.

Code:
#org 0x86B8E74
'-----------------------------------
lock
faceplayer
battle KYOGRE 50 PINKSCARF
cry 0xA1 0x194
end
I just need to know what I have to do in order to make the sprite disappear permanently after catching or defeating it as would happen with any other legendary battle.

I also would like to know how I would create a script to recreate the circumstances for battling Landorus that exist in Black and White. That being you can only battle Landorus if you interact with a certain object while you have Tornadus and Thundurus in your party. In my hack, I have replaced Regirock with Tornadus, Regice with Thundurus, and Registeel with Landorus.
 
Last edited:
3
Posts
13
Years
  • Seen Apr 19, 2011
Well, I'm creating a Hack Rom with a friend, but we are beginners. The script I'm trying to create is a wild Scyther that after the battle, became a statue. I tried to do so:
(NOTE: Using the system XSE)

#org 0x800000
lock
faceplayer
checkflag 0x200
if 0x1 goto 0x8800010
startwildbattle 0x07B 0x14 0x0
checksound
cry 0x07B 0x2
pause 0x28
waitcry
setflag 0x200
setflag 0x861
special 0x138
waitstate
clearflag 0x861
release
end
#org 0x800010
msgbox 0x880001A
callstd 0x6
release
end
#org 0x80001A
= A scary demon pokémon...
What did I do wrong?
 
17
Posts
13
Years
  • Seen Apr 15, 2011
i am trying to make it so to fight the gym leader you have to activate three computers in the correct order, but it dosent seem to be working,
Computer 1:
Code:
#org 0x8741CE8
'-----------------------------------
lock
faceplayer
compare 0x210 0x3
if == jump 0x8741D0F ' Equal To
compare 0x210 0x4
if == jump 0x8741D0F ' Equal To
setvar 0x210 0x2
msgbox 0x8741D69 ' You press the power ...
callstd MSG_SIGN ' Signpost-style message
release
end

#org 0x8741D0F
'-----------------------------------
setvar 0x210 0x1
msgbox 0x8741D1C ' Suddenly the other t...
release
end


#org 0x8741D69
= You press the power button and the terminal shuts off.

#org 0x8741D1C
= Suddenly the other terminals turned back on\n This must be the wrong computer
Computer 2:
Code:
#org 0x8741DA0
'-----------------------------------
lock
faceplayer
compare 0x210 0x1
if == jump 0x8741DC7 ' Equal To
compare 0x210 0x4
if == jump 0x8741DC7 ' Equal To
setvar 0x210 0x3
msgbox 0x8741E21 ' You press the power ...
callstd MSG_SIGN ' Signpost-style message
release
end

#org 0x8741DC7
'-----------------------------------
setvar 0x210 0x1
msgbox 0x8741DD4 ' Suddenly the other t...
release
end


#org 0x8741E21
= You press the power button and the terminal shuts off.

#org 0x8741DD4
= Suddenly the other terminals turned back on\n This must be the wrong computer
Computer 3:
Code:
#org 0x8741E58
'-----------------------------------
lock
faceplayer
compare 0x210 0x1
if == jump 0x8741E7F ' Equal To
compare 0x210 0x2
if == jump 0x8741E7F ' Equal To
setvar 0x210 0x4
msgbox 0x8741ED9 ' You press the power ...
callstd MSG_SIGN ' Signpost-style message
release
end

#org 0x8741E7F
'-----------------------------------
setvar 0x210 0x1
msgbox 0x8741E8C ' Suddenly the other t...
release
end


#org 0x8741ED9
= You press the power button and the terminal shuts off.

#org 0x8741E8C
= Suddenly the other terminals turned back on\n This must be the wrong computer

does anyone see whats wrong, i use pksv and pkmn ruby.
the gym leader will only fight you if the var 0x210 is set to 0x4.
 

Complans

Trainer
98
Posts
14
Years
  • Seen Aug 27, 2015
Well, I'm creating a Hack Rom with a friend, but we are beginners. The script I'm trying to create is a wild Scyther that after the battle, became a statue. I tried to do so:
(NOTE: Using the system XSE)


What did I do wrong?

At the start you put "#org 0x800000". It is meant to be #dynamic 0x(offset) and then followed by a line which starts the script eg. #org @start
 
3
Posts
13
Years
  • Seen Apr 19, 2011
Thanks

Thanks to everyone who tried to help. Complans, you solved my problem! Thank you very much.
 
Status
Not open for further replies.
Back
Top