The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Script XSE scripting issue! Please Help. (https://www.pokecommunity.com/showthread.php?t=393146)

ContestTrainer May 23rd, 2017 5:30 PM

XSE scripting issue! Please Help.
 
1 Attachment(s)
Hello! And thank you in advanced for checking out this thread.
I'm currently working on a hack, Blood Stained Leaf
- (since the only other person working on it isn't going to release there beta or continue it ) -
and I've recently started using XSE instead of PKSV.
I've been having alot of issues with a few scripts- one in particular
Basically I am trying to do a gender script where when you step on it depending on your gender depends on what you get?

The original Script: ( please scroll down to my next reply for the updated script )
#dynamic 0x800000
#org @start
lock
faceplayer
checkgender
compare 0x800D 0x1
= if 0x1 goto @girl
compare 0x800D 0x0
= if 0x0 goto @boy
release
end

#org @boy
givepokemon 0x4 0x5 0x50 0x0 0x0 0x0
setflag 0x828
setflag 0x82F
setflag 0x829

end

#org @girl
givepokemon 0xD7 0x5 0x50 0x0 0x0 0x0
setflag 0x828

end

Attachment 82003

DrFuji May 24th, 2017 1:19 AM

Quote:

Originally Posted by ContestTrainer (Post 9655855)
Hello! And thank you in advanced for checking out this thread.
I'm currently working on a hack, Blood Stained Leaf
- (since the only other person working on it isn't going to release there beta or continue it ) -
and I've recently started using XSE instead of PKSV.
I've been having alot of issues with a few scripts- one in particular
Basically I am trying to do a gender script where when you step on it depending on your gender depends on what you get?

The Script:
Spoiler:
#dynamic 0x800000
#org @start
lock
faceplayer
checkgender
compare 0x800D 0x1
= if 0x1 goto @girl
compare 0x800D 0x0
= if 0x0 goto @boy
release
end

#org @boy
givepokemon 0x4 0x5 0x50 0x0 0x0 0x0
setflag 0x828
setflag 0x82F
setflag 0x829

end

#org @girl
givepokemon 0xD7 0x5 0x50 0x0 0x0 0x0
setflag 0x828

end


Attachment 82003

While you've got most of the script right there are a few spots that are incorrect or could be eliminated/ shortened. Here's a better version of your script with changes in red:

Code:

#dynamic 0x800000

#org @start
lock
faceplayer
// The lock and faceplayer commands can be removed entirely as you're interacting with a green S-tile rather than an NPC
checkgender
compare 0x800D 0x1
= if 0x1 goto @girl // XSE doesn't use equal signs as commands
// I've deleted your check for whether the player is a boy as you've already checked if they are a girl (process of elimination and all that).
givepokemon 0x4 0x5 0x50 0x0 0x0 0x0
setflag 0x828
setflag 0x82F
setflag 0x829
end

#org @girl
givepokemon 0xD7 0x5 0x50 0x0 0x0 0x0
setflag 0x828
end


Don't forget to either insert a checkflag command or set a variable to ensure that the player only activates this script once, otherwise they will be able to get a million Pokemon.

ContestTrainer May 24th, 2017 8:30 AM

Ah thank you so much! But what's the check flag to keep a million Pokemon from spawning? This is an issue I've always struggled with. ( thank you again! )
Edit: Oh dear. I put the script into the game and it didn't work? It gave me a start offset I put it in. And I checked the script it only had a dynamic org offset and nop in the script. I shrugged it off and tested it and nothing happened...? why does this keep happening??? Example.
( I'm trying to add a count pokemon script so when you get the starter you won't get two hundred more- that would work right? )
the new script:

#dynamic 0x740857
#org 0x740857
checkflag 0x828
checkgender
setflag 0x828
compare LASTRESULT 0x1
if 0x1 goto 0x8740E2A
givepokemon 0x4 0x5 0x50 0x0 0x0 0x0
setflag 0x828
setflag 0x82F
setflag 0x829
countpokemon
compare 0x800D 0x1
if 0x1 goto @end
end

#org 0x740E2A
givepokemon 0xD7 0x5 0x50 0x0 0x0 0x0
setflag 0x828
countpokemon
compare 0x800D 0x1
if 0x1 goto @end
end


#org @end
return
end

Froosty May 24th, 2017 7:51 PM

Quote:

Originally Posted by ContestTrainer (Post 9656363)
Ah thank you so much! But what's the check flag to keep a million Pokemon from spawning? This is an issue I've always struggled with. ( thank you again! )
Edit: Oh dear. I put the script into the game and it didn't work? It gave me a start offset I put it in. And I checked the script it only had a dynamic org offset and nop in the script. I shrugged it off and tested it and nothing happened...? why does this keep happening??? Example.
( I'm trying to add a count pokemon script so when you get the starter you won't get two hundred more- that would work right? )
the new script:

#dynamic 0x740857
#org 0x740857
checkflag 0x828
checkgender
setflag 0x828
compare LASTRESULT 0x1
if 0x1 goto 0x8740E2A
givepokemon 0x4 0x5 0x50 0x0 0x0 0x0
setflag 0x828
setflag 0x82F
setflag 0x829
countpokemon
compare 0x800D 0x1
if 0x1 goto @end
end

#org 0x740E2A
givepokemon 0xD7 0x5 0x50 0x0 0x0 0x0
setflag 0x828
countpokemon
compare 0x800D 0x1
if 0x1 goto @end
end


#org @end
return
end

With the dynamic tag there,
the script gets inserted to the free space location starting from that point,
i.e. it might or might not get inserted in the same location you specified.

When compiling you get the offset where it got inserted.
use that and you might get it done.. i.e. running the script


All times are GMT -8. The time now is 9:14 AM.


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.