Jump to content

Recommended Posts

Posted

I tried to make an NPC that gives you a Tyrogue if you talk with him, the problem is I can't find a tutorial for this or any instructions for this specific type of script.

I've looked into what NPCs in the game give you a pokemon, I found Amanita gives an Eevee, located her in Castelia City and found out she uses Script 988. I tried to look into script 988 but couldn't make out much of it.

In the header it says there are 5 scripts, which is consistent with what NPRE says, but that's it, as NPRE shows 5 scripts and 28 function which I don't know what they do, and I can't pinpoint the exact part of the script responsible with giving the player a pokemon, as NPRE says it's Function 13 (I think?). It's one of the pictures.

Meanwhile running scrparse.lua in desmume says there are 22 scripts in script file 988, as in one of the pictures.

file1.jpg

file2.jpg

Untitled-1.png

Can anyone help me? I really don't know what to make of this.

file1.jpg.0a3f55ff8febb982e87668ecfeac3f

file2.jpg.ab7bd0db654730e149cf8fde31aa2a

Untitled-1.png.bc14fe755d743caaab814131d

Posted

I've decided to try to find the script used to give off the Deerling on the route 6 weather institute. But I've got a few questions that maybe someone can answer as there's a problem I can't understand.

In the overworld I'm trying to add the NPC, the NPCs already there have scripts assigned to them that have erratic numbers, instead of being assigned lower numbers like 08 00, 02 00 etc. they have numbers like 5A 1B or D0 07 as the number of their script. But in the script file for that overworld there are only 10 scripts, getting to that number seems irrational, does anyone know what this means?

Posted
  Kaphotics said:
That'd be calling another script in another script file.

0x1B5A = 7002

0x07D0 = 2000

Does this mean that if I give my NPC the script number 0B 00, as there's 10 addresses in the header of the script file, it should execute normally (After I add the script and edit the header to accommodate the increase of course)?

Posted
  Melanogaster said:
Does this mean that if I give my NPC the script number 0B 00, as there's 10 addresses in the header of the script file, it should execute normally (After I add the script and edit the header to accommodate the increase of course)?

Correct.

The script number an overworld will use is then used with the Script's Header to start execution at the desired offset.

OW Script# -> fetch Script File (for map/zone) if < 255, else load external (undocumented, really)

Script File Header -> get offset of Script# -> start new script @ offset.

Posted

The script works ingame, it give the player the Deerling. But there are 2 problems I'm not sure how to fix, the first being why am I asked 2 times instead of just once like the original NPC does, and the second is the NPC will give me Deerlings ad Infinitum.

This is the code I've taken from that NPC and am using on the current NPC:

  Reveal hidden contents

And this is what I've tried to decipher from the code, can anyone tell me if I did it wrong? It's just that some parts make no sense.

  Reveal hidden contents
Posted

02 00 is "EndScript"

10 00 AA 01 = CheckFlag 0x01AA

08 00 00 00 = Logical Comparison

11 00 01 00 = Value 1

1F 00 FF 45 00 00 00 = IfResult (False 0xFF = -1) then jump to 0x00000045

...

Can always try Spiky's DS Map Editor (SDSME) which should have script editing support; also my edited version of NPRE should show most of the script names (including give pokemon)

Posted
  Kaphotics said:
02 00 is "EndScript"

10 00 AA 01 = CheckFlag 0x01AA

08 00 00 00 = Logical Comparison

11 00 01 00 = Value 1

1F 00 FF 45 00 00 00 = IfResult (False 0xFF = -1) then jump to 0x00000045

...

Can always try Spiky's DS Map Editor (SDSME) which should have script editing support; also my edited version of NPRE should show most of the script names (including give pokemon)

My first question regards the Jump and If, is the 0x00000045 the point in the script at which it will jump, as in the 45th byte in the script?

NPRE for some reason crashes when I try to view my script. I think because it's broken at the end I believe, but that's how it was in the original script so I'm not sure what's wrong.

I've managed to decrypt the whole script using

http://pastebin.com/raw.php?i=vrkp0SN8

, but there's some things I can't understand.

For example, why is the function for give pokemon called 4 times?

This is the finished decrypted script I believe:

  Reveal hidden contents

Is there a place I can see a more detailed explanation of some functions, like for example D2 00 XX XX or 4C 00 XX - Set Var Hero?

Posted
  Kaphotics said:
repeats 4 times as it is giving 4 different forms (seasonal).

00D2 = SetVar Season

jump statements are "bytes forward from current position", which is at the end of the (if-then)jump statement.

Ok, I managed to make it work properly, text and everything. But the guy who gives the pokemon keeps giving it every time you ask for it, how do I change it?

10 00 AA 01 - Store Flag or 4C 00 00 - Set Var Hero have any relevance to my issue?

Posted

You'd have to check the flag at the start of the script.

Check Flag -> Branch to 2 results (flag vs no flag) and handle it.

Store Flag -> Compare ~= 1 -> if false goto A... else... B

004C 00 is used for text lines, as text-line variables load from stored variables.

I'd check the gift pokemon scripts (probably the Eevee would be best) to learn from.

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...