Jump to content

Recommended Posts

Posted (edited)

Hi all!

First off I just want to thank Kaphotics for all the general knowledge and videos available on this topic, thank you very much!

I have some general questions about some of the known commands for b2w2 scripting.

I plan on having an interactable Victini, that when talk to it, you have the option to let it join your team (gift pokemon). Right now I have only added the interactable npc Victini to my chosen map, so now for the rest! I've been looking at some of the code for other gift pokemon in the game (eevee and deerling). I see it starts with a script, prompts yesorno, and then the script starts jumping through functions (yes and party is not 6/full, yes but party full, and no).

1) Jump Function X (offset#)

For the jump function commands, X is usually a small number (like 17, 24, etc), but neither the name of the function it's going to or the offset #. What is X? What is it doing, what does it mean for the code?

2) Functions

Do functions need to be added to the header like scripts or can I just add my functions after my new script, no pointer required at the beginning?

3) Logic06

What is this?

4) Flags

I don't think I'll need flags for my code specifically, because after Victini joins (yes and party not 6/full), the npc will be removed from the map. If this works out correctly the way I want it to, there won't be a Victini to interact with to prompt the script again and keep receiving a gift Victini. But in general, how to you determine a flag value/number? Can this just be any value not already used by another script in the game (and if so, how do you figure out which values are already in use by other scripts or free to use)? Or are there a specific set of flag values used for different purposes within the game?

Edit: Found answer to this one!

These are all of my questions, thank you for any and all help!

 

 

 

 

 

 

Edited by Chezamon
x1 answered questions
Posted

1. "Jump" is for jumping ahead/backwards a specific amount of bytes. Each instruction consumes a variable amount of bytes based on the amount of arguments it may have. The scripting execution environment just reads the script file, and based on where the current command is, it jumps somewhere else to continue executing next.

https://en.wikipedia.org/wiki/JMP_(x86_instruction)

2. Scripts are self-contained, so there can be multiple scripts if the file header is updated to have the relevant count & offsets to tell the game where to find script # 7, for example.

3. Not all script commands are well understood/documented (at least at the time a post may have been written/updated). If no script commands had function names, only their command # (e.g. "6"), the only way to infer what they do is to observe how the game carries out the script code and how the if-else logic results in an observable effect in-game. Logic06 is basically "this command does something with boolean/comparison logic, and is script command 06, therefore we'll call it Logic06 instead of Command06".

  • Thanks 1
  • 2 weeks later...
Posted

Sorry for the late reply, just getting back to this now! 

Thank you very much! I'm happy to report that I have a working Victini event, with overworld/npc flag and all. ❤️ Plans changed a bit and I turned him into a static encounter, with plans for a special event egg in the postgame instead. I was definitely overthinking the jump functions.

 

Thank you so much again for all your info and videos on scripting! This is my first time scripting... anything. But it's pretty fun!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...