• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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.
5
Posts
11
Years
  • Seen Feb 1, 2014
You should try using a flag greater than 1000, 201 is a flag currently being used by the game and may cause glitches in it. That's why people have XSE tutorials on PC.

Changed the event to 1001, but now the guy won't give the item even though he says statement1.

Now I feel really stupid.

#dynamic 0x800000
#org @start
lock
faceplayer
checkflag 0x900
if 0x1 goto @nomore
msgbox @talk1 0x6
callstd 0x4
release
end
#org @nomore
msgbox @talk2 0x6
callstd 0x4
release
end
#org @talk1
= Hey, you're my first visitor! I'm\nso happy. Here, please take this\litem as a reward. I don't really\lhave any use for it.
callstd 0x4
giveitem 0xB8 0x1 0x0
compare LASTRESULT 0x0
if 0x1 goto @bagfull
goto @talk2
callstd 0x4
setflag 0x900
release
end
#org @talk2
= The Soothe Bell raises a pokemon's\nhappiness. Some pokemon will even\levolve when they max their\lhappiness towards you.
#org @bagfull
= Too Bad!\nThe BAG is full.
 

tajaros

Hi I'm dawg
855
Posts
11
Years
Changed the event to 1001, but now the guy won't give the item even though he says statement1.

Now I feel really stupid.

Didn't you read my post? Anyways I'll just fix your script.

#dynamic 0x800000

#org @start
lock
faceplayer
checkflag 0x200
if 0x1 goto @done
msgbox @hey 0x6
checkitemroom 0xB8 0x0
compare 0x800D 0x0
if 0x1 goto @full
giveitem 0xB8 0x1 0x0
setflag 0x200
release
end

#org @done
msgbox @func 0x6
release
end

#org @full
msgbox @fullbag 0x6
release
end

#org @hey
= Hey, you're my first visitor!\pI'm so happy.\pHere, please take this item as a\nreward.\pI don't really have any use for\nit.

#org @func
= The Soothe Bell raises a Pokémon's\nHappiness.\pSome Pokémon will even evolve when\nthey max their happiness towards\lyou.

#org @fullbag
= Too Bad!\pYour BAG is full.

This script works perfectly the problems in your script are what's with callstd? You don't really need that. Also Why have a decision script without the checkitemroom command? Oh and the third statement doesn't have a pointer.

Hope this helps... :3
 
5
Posts
11
Years
  • Seen Feb 1, 2014
Didn't you read my post? Anyways I'll just fix your script.



This script works perfectly the problems in your script are what's with callstd? You don't really need that. Also Why have a decision script without the checkitemroom command? Oh and the third statement doesn't have a pointer.

Hope this helps... :3

Thanks a lot, it worked. Except XSE didn't recognize "checkitemroom", probably only because I'm not using PokéScript :P
 
74
Posts
12
Years
  • Seen Nov 3, 2019
Ok, for the Bulbasaur thing, you have to use this bit of code there:
setvar 0x8004 0x1 special2 0x800D 0x17C compare 0x800D 0x0
if 0x1 goto @(pointer for uncaught)
compare 0x800D 0x1
if 0x1 goto @(pointer for caught)

If player party is full, and he/she caught the Bulbasaur, the Bulbasaur transfer to PC box, It will work too? If doesn't work, having other script to check it? Thanks.

P.S. Sorry for my bad english. :)
 
Hai, i have a problem, I made a quick script for my NPC i made, and it does something odd whenever i go up and talk to him.
What happens is, it either freezes the screen. turns the screen white, or turns the screen red, here is the script:
#org $script
lock
faceplayer
message $example
$example 1 =Hello there!
boxset 6
release
end
 

itman

Back to ROM hacking. :D
98
Posts
16
Years
  • Age 30
  • Seen Feb 5, 2014
Hai, i have a problem, I made a quick script for my NPC i made, and it does something odd whenever i go up and talk to him.
What happens is, it either freezes the screen. turns the screen white, or turns the screen red, here is the script:
#org $script
lock
faceplayer
message $example
$example 1 =Hello there!
boxset 6
release
end
(I assume you're using pokescript due to the use of '$', so I wrote this assuming it's for pokescript)

#org $script
lock
faceplayer
message $example
boxset 6
release
end

#org $example
= Hello there!
 
(I assume you're using pokescript due to the use of '$', so I wrote this assuming it's for pokescript)

#org $script
lock
faceplayer
message $example
boxset 6
release
end

#org $example
= Hello there!
I have no idea what is wrong but now it will not react whenever i try to talk to the guy, I'm using pokescript and Advance map to put the script in, could anyone also explain some stuff about the script?
I know lock locks the player and faceplayer makes him look at the main character, but can you change the: $script part in the #org $script?
I'm just wondering, seems like most people use their own little text there, like this: #org $lolfaic
But anyhow, if you need me to show you what is happening i could easily upload a video of it on youtube if you would like that?
 

itman

Back to ROM hacking. :D
98
Posts
16
Years
  • Age 30
  • Seen Feb 5, 2014
I have no idea what is wrong but now it will not react whenever i try to talk to the guy, I'm using pokescript and Advance map to put the script in, could anyone also explain some stuff about the script?
I know lock locks the player and faceplayer makes him look at the main character, but can you change the: $script part in the #org $script?
I'm just wondering, seems like most people use their own little text there, like this: #org $lolfaic
But anyhow, if you need me to show you what is happening i could easily upload a video of it on youtube if you would like that?

Try it now...I haven't used pokescript in like 3 years xD

#org $script
lock
faceplayer
message $example
boxset 6
release
end

#org $example
$example 1 = Hello there!
 
241
Posts
11
Years
I've only been scripting a few weeks, and I'm trying to make a relatively simple script where a man checks if you have a badge and moves if you do. I used the pallet town sign girl as a model. Currently he talks but doesn't move...help?

Spoiler:
 

miksy91

Dark Energy is back in action! ;)
1,480
Posts
15
Years
I've only been scripting a few weeks, and I'm trying to make a relatively simple script where a man checks if you have a badge and moves if you do. I used the pallet town sign girl as a model. Currently he talks but doesn't move...help?

Spoiler:
I won't be much of help saying specifically what to fix and where (never used XSE to hack 3rd gen) but by the looks of it, you've got something here written wrong:

callstd 0x4
closeonkeypress
compare PLAYERFACING 0x4
if 0x1 call @move1

If "closeonkeypress" stands for closing the text box after A button is displayed then that's not the problem. What's "callstd 0x4" for? If you're simply going to load the variable "PLAYERFACING" somewhere in ram and compare it to 0x1 (with "if 0x1 then..."), I don't see a point in having that kind of command there.

In GSC, "if codes" cannot be used to call anything so that may be your problem as well. In GSC, they're type "if 0x1 "pointer" (or instead of "pointer", put that jump @move1 here).
Try ending the scripts without "if call" codes by replacing them to "jumps". Also that way, if the person can only be talked from two directions like I assume by your script, you should change the ending of the script a little bit (this time, I made an assumption that subscripts are ended with "return" while the main scripts ends with "end"):

Code:
compare PLAYERFACING 0x4
if 0x1 @move1 (not sure if this instruction is now right or not)
applymovement 0x16 @movetwo
waitmovement 0x0
release
end
 
@move1
applymovement 0x16 @moveone
waitmovement 0x0
release
end

And if the upper doesn't solve the problem, try what happens if you take out that "0x4" next to PLAYERFACING (it can be right to have it there but doesn't sound right to me, really depends on how "compare" command works).
 
Last edited:
241
Posts
11
Years
I won't be much of help saying specifically what to fix and where (never used XSE to hack 3rd gen) but by the looks of it, you've got something here written wrong:

callstd 0x4
closeonkeypress
compare PLAYERFACING 0x4
if 0x1 call @move1

If "closeonkeypress" stands for closing the text box after A button is displayed then that's not the problem. What's "callstd 0x4" for? If you're simply going to load the variable "PLAYERFACING" somewhere in ram and compare it to 0x1 (with "if 0x1 then..."), I don't see a point in having that kind of command there.

In GSC, "if codes" cannot be used to call anything so that may be your problem as well. In GSC, they're type "if 0x1 "pointer" (or instead of "pointer", put that jump @move1 here).
Try ending the scripts without "if call" codes by replacing them to "jumps". Also that way, if the person can only be talked from two directions like I assume by your script, you should change the ending of the script a little bit (this time, I made an assumption that subscripts are ended with "return" while the main scripts ends with "end"):

Code:
compare PLAYERFACING 0x4
if 0x1 @move1 (not sure if this instruction is now right or not)
applymovement 0x16 @movetwo
waitmovement 0x0
release
end
 
@move1
applymovement 0x16 @moveone
waitmovement 0x0
release
end
And if the upper doesn't solve the problem, try what happens if you take out that "0x4" next to PLAYERFACING (it can be right to have it there but doesn't sound right to me, really depends on how "compare" command works).

-callstd 0x4 I believe just assigns the correct text box to the above message.
-When I remove call from the if command and debug it it says it assumes call, and when I reopen the script it adds call back in.
-When I removed 0x4 from compare PLAYERFACING it gives me an error saying I'm missing a parameter.

I think I might need to use a different command than compare PLAYERFACING. The man with this script is standing directly infront of a gym door, so he can be approached from 3 sides. From below or from the left I want him to move right and from the right I want him to move left. I believe the script I modeled this after is the same, so I don't know why it isn't working...

Here's the original again:
Spoiler:
 

miksy91

Dark Energy is back in action! ;)
1,480
Posts
15
Years
Then I believe the problem is with the parameter adjusted to the PLAYERFACING command there. Also are you certain the values with if commands have to be certainly 0x1 and 0x5 there?

Personally, I'd assume the four directions would be numbered from 00 to 03 or from 01 to 04. Again I'm talking about G/S/C here but in it, Gamefreak programmed facing values so that when you were facing down, your facing in ram would be set to 00, if up 01, if left 02 and if right 03. If this is the case in the game you're hacking, the values would most likely be 01 and 03 (because you can approach him from below making you face up and from the left making you face right).

Also one thing to note would be that you don't need to compare PLAYERFACING twice. This is how the coding works out; compare PLAYERFACING actually (very likely) moves a byte from certain ram address, "PLAYERFACING", to another ram location, let's call this "RAM". "if" instructions are made to check whether "RAM" is set to a certain value and if it is, then continue interpreting after the pointer (like you have here, 0x8801135 and 0x8801141).
Because "if" insctructions don't affect "RAM" in any way, you can have a multiply of them in an order if you're using them for checking the exactly same thing (like is done here).

But yeah, try changing the values followed by "if" and if that doesn't work, check what XSE has told about PLAYERFACING command and its usage.
Also as it's not a problem with this script, you don't have to change it but it's often simplifies stuff a lot if you use "if" instructions to jump to another part of that main-/subscript instead of calling anything. As you said it didn't work out by removing the "call" part, try re-writing it with jump and see if something else happens (or check what XSE has written about this instruction as well).

Hopefully this will work out :)
 

Saigyouji Yuyuko

Meikai no Ohime-sama
5
Posts
11
Years
;Notes
;Placeholders will be, of course, replaced by proper pointers when empty regions that fit their size requirements are found.
;Pokemart sales will be divided by three clerks.
;Only samples to showcase my theory will be posted here; I wouldn't bother with the complete code as of yet.
;Please tell me if there is something wrong with anything within this theory. I would love to have the layout perfected before I start bothering with actually finding the free space and creating the actual scripts.
;If it is alright, can someone give me estimations as to the total space needed for the entire codeset [or at least tell me how to estimate]? I have a hundred and ten megabytes free space in my ROM.
;---------------------------------------------
#org [Placeholder_Masterscriptclerk1]
lock
faceplayer
msgbox 0x81A6211
checkflag FR_BADGE_8
if true jump [Placeholder_Mart8Clerk1]
checkflag FR_BADGE_7
if true jump [Placeholder_Mart7Clerk1]
checkflag FR_BADGE_6
if true jump [Placeholder_Mart6Clerk1]
checkflag FR_BADGE_5
if true jump [Placeholder_Mart5Clerk1]
checkflag FR_BADGE_4
if true jump [Placeholder_Mart4Clerk1]
checkflag FR_BADGE_3
if true jump [Placeholder_Mart3Clerk1]
checkflag FR_BADGE_2
if true jump [Placeholder_Mart2Clerk1]
checkflag FR_BADGE_1
if true jump [Placeholder_Mart1Clerk1]
mart [Placeholder_Mart0Clerk1Mart]
msgbox 0x81A5190
callstd MSG_NOCLOSE
release
end
;---------------------------------------------
;Clerk 2 cannot be unlocked until the 3rd badge and 3 until the 5rd badge, so their codes will follow this pattern:
'-----------------------------------
#org [Placeholder_Masterscriptclerk3]
lock
faceplayer
checkflag FR_BADGE_5
if false jump [Placeholder_DiaUnavailableClerk]
msgbox 0x81A6211
checkflag FR_BADGE_8
if true jump [Placeholder_Mart8Clerk3]
checkflag FR_BADGE_7
if true jump [Placeholder_Mart7Clerk3]
checkflag FR_BADGE_6
if true jump [Placeholder_Mart6Clerk3]
mart [Placeholder_Mart5Clerk3Mart]
msgbox 0x81A5190
callstd MSG_NOCLOSE
release
end
;------------------------------
#org [Placeholder_DiaUnavailableClerk]
msgbox [Placeholder_Unavailableclerk]
end
;-------------------------------
#org [Placeholder_Mart1Clerk1]
showmsg
pokemart [Placeholder_Mart1Clerk1Mart]
msgbox 0x81A5190
callstd MSG_NOCLOSE
release
end
;------------------------------------
#org [Placeholder_Mart4Clerk1]
showmsg
pokemart [Placeholder_Mart4Clerk1Mart]
msgbox 0x81A5190
callstd MSG_NOCLOSE
release
end
;------------------------------------

#org 0x81A6211
= Hi, there!\nMay I help you?

#org 0x81A5190
= Please come again!

#org [Placeholder_Unavailableclerk]
= I am sorry, but you may not buy wares\nfrom me until you gain more\lbadges.

#org [Placeholder_Mart0Clerk1Mart]
item POKEBALL
item POTION
item ANTIDOTE
item PARLYZHEAL
item AWAKENING
endmart

#org [Placeholder_Mart1Clerk1Mart]
item POKEBALL
item POTION
item ANTIDOTE
item PARLYZHEAL
item AWAKENING
item BURNHEAL
item ICEHEAL
endmart

#org [Placeholder_Mart4Clerk1Mart] [is retaining the pokeballs, basic status healers and basic potions a good idea?]
item POKEBALL
item GREATBALL
item ULTRABALL
item POTION
item SUPERPOTION
item ANTIDOTE
item PARLYZHEAL
item AWAKENING
item BURNHEAL
item ICEHEAL
item FULLHEAL
endmart

;I want to know if there's anything wrong with this and if it will work.
 

metalflygon08

BIG PECKS
189
Posts
14
Years
  • Seen Jul 31, 2016
I've been scripting for a while now, but never have figured out how to do this.

(Scripting in HGSS fyi)

How do you do the scripts where you step somewhere and an event happens from that? (like the oak before you can leave Pallet town in 1st gen)
 
RAWR!
Canz someon halp me?
This would be a very helpful forum if someone did.
LOL, it already is quite helpful, but still, need that script helped on.
Just a basic script making a guy talk to you, that is it, just like the fat guy in PKMN Sapphire, i am using Advance Map 1.95 and poke script.
 
241
Posts
11
Years
Then I believe the problem is with the parameter adjusted to the PLAYERFACING command there. Also are you certain the values with if commands have to be certainly 0x1 and 0x5 there?

Personally, I'd assume the four directions would be numbered from 00 to 03 or from 01 to 04. Again I'm talking about G/S/C here but in it, Gamefreak programmed facing values so that when you were facing down, your facing in ram would be set to 00, if up 01, if left 02 and if right 03. If this is the case in the game you're hacking, the values would most likely be 01 and 03 (because you can approach him from below making you face up and from the left making you face right).

Also one thing to note would be that you don't need to compare PLAYERFACING twice. This is how the coding works out; compare PLAYERFACING actually (very likely) moves a byte from certain ram address, "PLAYERFACING", to another ram location, let's call this "RAM". "if" instructions are made to check whether "RAM" is set to a certain value and if it is, then continue interpreting after the pointer (like you have here, 0x8801135 and 0x8801141).
Because "if" insctructions don't affect "RAM" in any way, you can have a multiply of them in an order if you're using them for checking the exactly same thing (like is done here).

But yeah, try changing the values followed by "if" and if that doesn't work, check what XSE has told about PLAYERFACING command and its usage.
Also as it's not a problem with this script, you don't have to change it but it's often simplifies stuff a lot if you use "if" instructions to jump to another part of that main-/subscript instead of calling anything. As you said it didn't work out by removing the "call" part, try re-writing it with jump and see if something else happens (or check what XSE has written about this instruction as well).

Hopefully this will work out :)

Here's what I did try to fix this script:

Spoiler:

----------------------------------------
EDIT: OK I decided to try a door unlocked/locked script instead, which turns out to be seemingly much simpler. This is my script:
Spoiler:

...all it does is lock you and never let you go...

The win part was just me trying to fix the lock-up, but it should really work without that part...
---------------------------------------
EDIT 2.0: Fixed the door lock script! Here's my solution in case anyone else wants to do the same thing
Spoiler:
 
Last edited:
Status
Not open for further replies.
Back
Top