The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Tutorials (https://www.pokecommunity.com/forumdisplay.php?f=66)
-   -   Sierra's MEGA-HUGE XSE Scripting Tutorial (https://www.pokecommunity.com/showthread.php?t=164276)

SoulReturns April 3rd, 2014 4:30 PM

I think I have my script set up right, I'm using XSE:
Code:

#dynamic 0x800000
#org @start
lock
faceplayer
message @1 0x6
release
end

#org @1
= Script made\nby SoulReturns!


But I believe my problem lies in AdvanceMap; I chose XSE as my script editor, copied the "$000000" code in (mine was $800000), added a new event in the form of a player...

What my AdvanceMap looks like:
Spoiler:

[email protected]@com/[email protected]
Sorry, you'll have to replace the '@' with a . because I'm apparently not allowed to post links until I hit 15 posts.


What my XSE looks like:
Spoiler:

[email protected]@com/[email protected]
Sorry, you'll have to replace the '@' with a . because I'm apparently not allowed to post links until I hit 15 posts.


When I start the game, I get an unaffected Pallet Town. However when I tried changing the behavior of some of the already-existing NPC's, this change was reflected in the game (albeit a bit buggy).

Like I said I think I understand most of the code stuff. Just not sure how to make what I do appear :/ Or I have some fatal mistake and I'm living an illusion that I know how to do this. Lol.

Thanks for the help!

destinedjagold April 3rd, 2014 5:07 PM

Quote:

Originally Posted by SoulReturns (Post 8181598)
I think I have my script set up right, I'm using XSE:
Code:

#dynamic 0x800000
#org @start
lock
faceplayer
message @1 0x6
release
end

#org @1
= Script made\nby SoulReturns!


But I believe my problem lies in AdvanceMap; I chose XSE as my script editor, copied the "$000000" code in (mine was $800000), added a new event in the form of a player...

What my AdvanceMap looks like:


What my XSE looks like:


When I start the game, I get an unaffected Pallet Town. However when I tried changing the behavior of some of the already-existing NPC's, this change was reflected in the game (albeit a bit buggy).

Like I said I think I understand most of the code stuff. Just not sure how to make what I do appear :/ Or I have some fatal mistake and I'm living an illusion that I know how to do this. Lol.

Thanks for the help!

Try again with a clean ROM, and use Advance Map 1.92 (download link) instead of 1.95...

Nephelimo April 15th, 2014 11:18 AM

Hello and many thanx for the tutorials :)

I have a little problem that I have tried many different ways to solve it but I was unable to do so.

To my problem. I have this normal wildbattle script:

#dynamic 0x800000

#org @start
lock
faceplayer
cry 0x96 0x0
msgbox @talk1 0x6
wildbattle 0x96 0x5 0x0
fadescreen 1
hidesprite 0x800F
fadescreen 0
setflag 0x1201
release
end

#org @talk1
= Prepare for your destiny!



The script works perfectly as it. My problem is that I want to change the music of the battle. The pokemon in the scrip is MewTwo and I want to make a script for a legendary battle. But no matter what I have tried I cant make it to play the legendary music.

I did decompile the original firered MewTwo battlescript n the command for the legendary battle music which is named Encounter 4 if I remember in the rom is: playsong 0x156 0x0. But I cant get it to work. I have tried to put the line after the msgbox, it didnt work. After the wildbattle command, again it didnt work. The music remained to the normal battle. I even tired it as a fanfare but nowthin, all the same. If anyone knows how to do it please reply, I have searched all the tutorials here n on the net I found a couple but they were usin pokescript but ever since I discovered XSE I no longer use pokescript nor I even remember how to use it. Btw here is the full MewTwo battlescrip in case it helps to figure out what I am doin wrong n what I'm supposed to do.


'---------------
#org 0x1624F5
special 0x187
compare LASTRESULT 0x2
if 0x1 goto 0x81A7AE0
special 0x188
lock
faceplayer
checksound
cry 0x96 0x2
preparemsg 0x8177F9F '"Mew!"
waitmsg
waitcry
pause 0x14
playsong 0x156 0x0
waitkeypress
setwildbattle 0x96 0x46 0x0
setflag 0x807
special 0x138
waitstate
clearflag 0x807
special2 LASTRESULT 0xB4
compare LASTRESULT 0x1
if 0x1 goto 0x8162558
compare LASTRESULT 0x4
if 0x1 goto 0x8162561
compare LASTRESULT 0x5
if 0x1 goto 0x8162561
setflag 0x2BC
release
end

'---------------
#org 0x1A7AE0
release
end

'---------------
#org 0x162558
setflag 0x2BC
goto 0x81A922D

'---------------
#org 0x162561
setvar 0x8004 0x96
goto 0x81A9236

'---------------
#org 0x1A922D
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
release
end

'---------------
#org 0x1A9236
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
bufferpokemon 0x0 0x8004
msgbox 0x81A63C4 MSG_KEEPOPEN '"The [buffer1] flew away!"
release
end


'---------
' Strings
'---------
#org 0x177F9F
= Mew!

#org 0x1A63C4
= The [buffer1] flew away!







And thanx in advance to the whole community :)

Xencleamas April 27th, 2014 5:49 PM

WOW! THAT'S A VERY LONG POST! :D
Well, the details are all clear and understandable.
Nice post bro! This helps me a lot. :D
Hey, by the way, I'm also making my own hacked game. :D

Sniper April 30th, 2014 5:05 AM

Quote:

Originally Posted by Nephelimo (Post 8199507)
Hello and many thanx for the tutorials :)

I have a little problem that I have tried many different ways to solve it but I was unable to do so.

To my problem. I have this normal wildbattle script:

#dynamic 0x800000

#org @start
lock
faceplayer
cry 0x96 0x0
msgbox @talk1 0x6
wildbattle 0x96 0x5 0x0
fadescreen 1
hidesprite 0x800F
fadescreen 0
setflag 0x1201
release
end

#org @talk1
= Prepare for your destiny!



The script works perfectly as it. My problem is that I want to change the music of the battle. The pokemon in the scrip is MewTwo and I want to make a script for a legendary battle. But no matter what I have tried I cant make it to play the legendary music.

I did decompile the original firered MewTwo battlescript n the command for the legendary battle music which is named Encounter 4 if I remember in the rom is: playsong 0x156 0x0. But I cant get it to work. I have tried to put the line after the msgbox, it didnt work. After the wildbattle command, again it didnt work. The music remained to the normal battle. I even tired it as a fanfare but nowthin, all the same. If anyone knows how to do it please reply, I have searched all the tutorials here n on the net I found a couple but they were usin pokescript but ever since I discovered XSE I no longer use pokescript nor I even remember how to use it. Btw here is the full MewTwo battlescrip in case it helps to figure out what I am doin wrong n what I'm supposed to do.


'---------------
#org 0x1624F5
special 0x187
compare LASTRESULT 0x2
if 0x1 goto 0x81A7AE0
special 0x188
lock
faceplayer
checksound
cry 0x96 0x2
preparemsg 0x8177F9F '"Mew!"
waitmsg
waitcry
pause 0x14
playsong 0x156 0x0
waitkeypress
setwildbattle 0x96 0x46 0x0
setflag 0x807
special 0x138
waitstate
clearflag 0x807
special2 LASTRESULT 0xB4
compare LASTRESULT 0x1
if 0x1 goto 0x8162558
compare LASTRESULT 0x4
if 0x1 goto 0x8162561
compare LASTRESULT 0x5
if 0x1 goto 0x8162561
setflag 0x2BC
release
end

'---------------
#org 0x1A7AE0
release
end

'---------------
#org 0x162558
setflag 0x2BC
goto 0x81A922D

'---------------
#org 0x162561
setvar 0x8004 0x96
goto 0x81A9236

'---------------
#org 0x1A922D
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
release
end

'---------------
#org 0x1A9236
fadescreen 0x1
hidesprite LASTTALKED
fadescreen 0x0
bufferpokemon 0x0 0x8004
msgbox 0x81A63C4 MSG_KEEPOPEN '"The [buffer1] flew away!"
release
end


'---------
' Strings
'---------
#org 0x177F9F
= Mew!

#org 0x1A63C4
= The [buffer1] flew away!







And thanx in advance to the whole community :)


Use Cyclone instead :) It's easier when it comes to creating wild battles.

Nephelimo April 30th, 2014 5:48 PM

Quote:

Originally Posted by V.V (Post 8224392)
Use Cyclone instead :) It's easier when it comes to creating wild battles.

Cyclone is a tile editor n I'm not lookin for that. I just want the wildbattle script that can play the legendary music while in battle. And another question that came to me right now. How can I get the Regi battle music from Emerald to Firered?

Sniper April 30th, 2014 6:31 PM

Quote:

Originally Posted by Nephelimo (Post 8225326)
Cyclone is a tile editor n I'm not lookin for that. I just want the wildbattle script that can play the legendary music while in battle. And another question that came to me right now. How can I get the Regi battle music from Emerald to Firered?

Sorry, I meant PokeTronic. You need to export the music from Emerald by using sappy then import it to FireRed.

Nephelimo May 1st, 2014 7:07 AM

Quote:

Originally Posted by V.V (Post 8225362)
Sorry, I meant PokeTronic. You need to export the music from Emerald by using sappy then import it to FireRed.

Do u have a good copy of PokeTronic cause the ones that exist on download sites most times dont work plus have viruses. The last time I tried to download it from a couple of sites it was not workin plus I got a virus. So if u have it n u can give it tom me I'd be glad.

ztc0611 May 12th, 2014 3:45 PM

I can't figure out how to actually get the rom to use the code! NOTHING I CAN FIND WILL TELL ME! I can script a bit but I can never get the script into the ROM! Please help

machomuu May 12th, 2014 4:09 PM

Quote:

Originally Posted by ztc0611 (Post 8247398)
I can't figure out how to actually get the rom to use the code! NOTHING I CAN FIND WILL TELL ME! I can script a bit but I can never get the script into the ROM! Please help

Watch this rather terrible textless, voiceless tutorial I made in all of 5 minutes. It's bad, but it's to the point and I made it on the spot.

Spoiler:

Tyranitar Killer May 15th, 2014 12:36 AM

Nice tutorial, Just wondering two things you didn't put in,
1. How to do a script that stops you from passing untill you have done something
Here I want one where a guy stops you from entering a gym as the leader is gone until you have beaten 7 gyms
2. How do you get the Follow-me script

Sniper May 15th, 2014 12:41 AM

Quote:

Originally Posted by Tyranitar Killer (Post 8251446)
Nice tutorial, Just wondering two things you didn't put in,
1. How to do a script that stops you from passing untill you have done something
Here I want one where a guy stops you from entering a gym as the leader is gone until you have beaten 7 gyms
2. How do you get the Follow-me script

1. Use checkflag and
2. Check Research & Development section

Tyranitar Killer May 15th, 2014 1:00 AM

Quote:

Originally Posted by V.V (Post 8251450)
1. Use checkflag and
2. Check Research & Development section

By Follow-Me I meant you follow a character not vice versa, as in following Wally when he gets his 1st Pokemon

Sniper May 15th, 2014 1:06 AM

Quote:

Originally Posted by Tyranitar Killer (Post 8251463)
By Follow-Me I meant you follow a character not vice versa, as in following Wally when he gets his 1st Pokemon

You should've specify earlier, just add the same applymovement.

Tyranitar Killer May 15th, 2014 1:15 AM

Quote:

Originally Posted by V.V (Post 8251471)
You should've specify earlier, just add the same applymovement.

Is it too much to see a sample script of each,
I'm ok if you can't but if I see it I think I could understand a lot better
Thanks if you do, I understand if you dont

mappingnewb May 15th, 2014 11:19 PM

I'm having trouble fixing my scripts. I would modify my script on a separate .rbc file, then open up the old script from AdvanceMap, then paste the modified script over it, then click compile. When I close XSE and re-open the script from AdvanceMap, it just shows the old script. I've tried it many times, keeping the same offset. I don't want to have to change the offset and take up more space every time I modify the script :(

DaisukE May 18th, 2014 12:52 AM

Quote:

Originally Posted by deigoisawesome (Post 4227030)
0x3
Spoiler:

Description:
Used for signs etc. No lock or faceplayer effect. Only shows the sign textbox when used on an actual sign.

Script:
#dynamic 0x800000


#org @start
msgbox @sign 0x3
end

#org @hello
= You are here

Replace the pointer hello or the first one..
Just a small error in the script...may have been told before...but yah its just an small human error......just saying no offense...

Sniper May 18th, 2014 8:03 AM

Quote:

Originally Posted by mappingnewb (Post 8253205)
I'm having trouble fixing my scripts. I would modify my script on a separate .rbc file, then open up the old script from AdvanceMap, then paste the modified script over it, then click compile. When I close XSE and re-open the script from AdvanceMap, it just shows the old script. I've tried it many times, keeping the same offset. I don't want to have to change the offset and take up more space every time I modify the script :(

That's not good. Rather just put your new script for example:

Code:

#dynamic 0x800000

#org @start
msgbox @1 0x6
release
end

= This is my script


Input on XSE 1.1.1 then click the blue gears to compile rather than saving it to .rbc then put the offset in the NPC. I suggest you use A-map 1.92 if something comes up wrong just tell me. Re-read the tutorial to know if what script you would really want to put in.

Quote:

Originally Posted by parth9 (Post 8256303)
Replace the pointer hello or the first one..
Just a small error in the script...may have been told before...but yah its just an small human error......just saying no offense...

And no. If you edit a saved script on the rom. It would cause damage to other script causing it to bug. If the number of words is more than the original script, the space will grow bigger and that's why it leads to bug because it saves over to another saved script.

DaisukE May 18th, 2014 12:16 PM

Quote:

Originally Posted by V.V (Post 8256704)
That's not good. Rather just put your new script for example:

Code:

#dynamic 0x800000

#org @start
msgbox @1 0x6
release
end

= This is my script


Input on XSE 1.1.1 then click the blue gears to compile rather than saving it to .rbc then put the offset in the NPC. I suggest you use A-map 1.92 if something comes up wrong just tell me. Re-read the tutorial to know if what script you would really want to put in.



And no. If you edit a saved script on the rom. It would cause damage to other script causing it to bug. If the number of words is more than the original script, the space will grow bigger and that's why it leads to bug because it saves over to another saved script.


Do u even know scripting..no offense but u should have read carrefully what i posted...

I said the pointers are not set properly....and btw its not an compiled script...ugh.....and aif u r talking about editing a script in advance map...it would give u pointers like 0x(offset) but in xse its our made llike @start.....ummmm...kinda sorry if i was rude but please check that my posts spoiler in quotes.....sorry if i was rude..


Looks like it was just a misunderstanding

DoCNL May 22nd, 2014 9:50 AM

Hello everyone,

I'm having some trouble compiling my scripts...

The script I'm using is:
Quote:

'---------------
#org 0x527702
checkflag 0x994
if 0x1 goto 0x527703

'---------------
#org 0x527703
lockall
msgbox 0x8527704 MSG_KEEPOPEN '"Hmmm... \pI should beat the\nPokem..."
closeonkeypress
applymovement MOVE_PLAYER 0x8527705
waitmovement 0x0
releaseall
end


'---------
' Strings
'---------
#org 0x527704
= Hmmm... \pI should beat the\nPokemon league first!


'-----------
' Movements
'-----------
#org 0x527705
#raw 0x9 'Step Up (Normal)
#raw 0xFE 'End of Movements
I want to make a certain area where only players who have defeated the league champion can go, I added a script tile in the hall of fame that sets the players flag 994.

When I compiled it and added the offset to the script tile in Advance Map, it works and looks fine, but when I trigger it in game, the script resets into this:
Quote:

'---------------
#org 0x527702
checkflag 0xC269
callstd 0xFE
buffercontestype 0xAD 0xADAD
nop
(I used free space finder to find a free offset, when I checked it, it was empty/free, but after it resetted to the script above, it stays like that)

I have no idea what causes this :/.

More info:
Advance map version: 1.9.5
XSE version: 1.1.1
Pokemon version: Emerald
Experience: little ;D

Please get back to me a.s.a.p. :0.

Sincerely,
DoC

Mana May 22nd, 2014 11:26 AM

Ignoring the fact that flag 0x994 may not be entirely safe (http://www.pokecommunity.com/showthread.php?t=302347) add in an 8 here ->

if 0x1 goto 0x8527703

You actually don't need to use flags with script tiles, you can use variables to make them work with no checking in-script. Have a look at the link above for more details.

Christos May 22nd, 2014 11:58 AM

Quote:

Originally Posted by DoCNL (Post 8263606)
Hello everyone,
I'm having some trouble compiling my scripts...
The script I'm using is:
I want to make a certain area where only players who have defeated the league champion can go, I added a script tile in the hall of fame that sets the players flag 994.
When I compiled it and added the offset to the script tile in Advance Map, it works and looks fine, but when I trigger it in game, the script resets into this:
(I used free space finder to find a free offset, when I checked it, it was empty/free, but after it resetted to the script above, it stays like that)
I have no idea what causes this :/.
More info:
Advance map version: 1.9.5
XSE version: 1.1.1
Pokemon version: Emerald
Experience: little ;D
Mail: [email protected]
Please get back to me a.s.a.p. :0.
Sincerely,
DoC

You did look for free space, but the commands you used at 527702 take up space that is written over 527703 and 527704. For example, the checkflag command needs X bytes and the goto one needs Y bytes, so your next offset should be X+Y bytes after 527702. I suggest simply scripting dynamically, you simply define an offset at the beginning and the script editor compiles everything in free space and returns the offsets used to you. So for example:

#dynamic 0x80000

#org @start
checkflag 0x994
if 0x1 goto @next
end

#org @next
lockall
msgbox @message MSG_KEEPOPEN '"Hmmm[.] \pI should beat the\nPokém..."
closeonkeypress
applymovement MOVE_PLAYER @move
waitmovement 0x0
releaseall
end

#org @message
= Hmmm[.] \pI should beat the\nPokémon league first!

#org @move
#raw 0x9 'Step Up (Normal)
#raw 0xFE 'End of Movements


I put an end command after the checkflag, since if the flag is not set the game will freeze otherwise.
Also, if you're using trigger scripts, I suggest not using flags at all since they're unnecessary. Trigger scripts take a variable value and a number. So for example, if your script's variable value is 52C0 and its variable value is 0, the trigger script will always be executed as long as 52C0's value in the game is 0, which is the default value. So instead of setting a flag, once the setvar 0x52C0 0x1 command is executed in any script, your trigger script would not execute again, unless you set the variable's value to 0 again.

DoCNL May 23rd, 2014 1:20 AM

Oh thanks a lot for the help!

I thought the @stuff was outdated, since I probably messed up the first time using it lol.
Will take a look at what you two said in a couple of hours, when I'm home.

Thanks again!

-DoC

DoCNL May 23rd, 2014 9:50 AM

Hmm... It works better now, thanks a lot for the dynamic scripting explenation!~

But now when the flag isn't set and I pass the tile, the game freezes (sound still continues to roll). However when the flag is set, it works fine (it lets me pass without stopping or so).

How should I fix this? :o

Christos May 23rd, 2014 10:04 AM

Quote:

Originally Posted by DoCNL (Post 8265016)
Hmm... It works better now, thanks a lot for the dynamic scripting explenation!~

But now when the flag isn't set and I pass the tile, the game freezes (sound still continues to roll). However when the flag is set, it works fine (it lets me pass without stopping or so).

How should I fix this? :o

Can you post the script you compiled? And did you include an "end" command after the "goto" part in the beginning of the script like I said in my post?


All times are GMT -8. The time now is 8:11 PM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.