Making a Re-Patch

'''I would like to start this page off by saying if you plan to make a short side story I do not recommend reading this page and instead would wish to re-direct you to this page for [http://monstergirlquest.wikia.com/wiki/Making_a_Side_Story making side-stories. ]'''

I tried my best making this guide as user-friendly as possible for those who have no knowledge at all on how to program.

Is this the best option best for you?
Before you delve deeper into this page it is best if you ask yourself these questions, with the first one being one having a different answer from the rest. If you can then you may want to try to make your mod as a side story instead unless there you feel one of the conditions below is also true. If you answered yes to any of these 3 questions you may indeed want to look at this page so continue reading.
 * Is my story something I can finish under 10 thousand lines and if not is it something I can finish in a second installment?
 * Is my story going to be a long one that would require saving and loading in between plays like the normal game or is it something you can play and finish in 1 or 2 sittings?
 * Do I plan to add stuff that might be too hard or even impossible in a side story?
 * Am I willing to look at how the game works or at least learn through trial and error?

The tools for the job
Note some of these that you download you do not exactly install so read on before you believe you have encountered a problem.

Before you can start working on your re-patch mod you will need to download the following programs :
 * The tools for onscripter (Onscripter is the language in which the game runs.)
 * Click here for the Onscripter Tools
 * The tools to unpackage the NSA files (optional but it lets you see the character, background, and voice files used by the game)
 * Here is Crass / Crage. Use this to open the NSA files.
 * Optional -- A good programmer-oriented text editor (unless you are fine with working on wordpad or notepad...)
 * Microsoft Visual Studio works fine also Notepad++ if you do not happen to have MVS (or prefer NP++)
 * If using Notepad++ I have hand-written the every single command and variable used in MGQ. Here

Opening and Repackaging the script
Alright now I will explain each tool with screenshots (or a video later on....)

the Onscripter tools will be a bunch of executable files that must be opened via the command line if you plan to use them. You can read the readme file for more instructions in how to handle them but I will tell you how to use the two main ones you will need (unpackaging the script [mainly for the first time] into a text-file and re-packaging the script [for actual game usage] )

I would first suggest moving all those executable and everything included to a folder and move it to your desktop (or wherever you feel comfortable.)In my case I have a folder called Onscripter and inside are all those files.

Now then, open up the command prompt. You can do this by hitting the windows key or going to Start then on the search bar type in (without quotes) "cmd" then hit enter. This will give you a black box.

You may see the windows version and what not (I cleared it out of mine before showing the screenshot with "cls")

Next you are most likely gonna need to change the directory (where the command prompt is looking). So type in "cd" and type in the entire directory of where you have your folder with all those executables. In my case I said I have it in my desktop under a folder called Onscripter so I will type that in....

NOTE: If you need to go to a different disk (say for example D:\games\MGQ) use the command /D before the location as it will tell the command prompt that you want to change the Drive too.

So in this example the command should be "cd /D D:\games\MGQ". (Take note of the difference between / and \)



When you hit enter (and you did it correctly), you will notice that the command prompt is now looking inside that place you specified. Make sure you have a copy of the script you are going to unpackage inside the same folder with those executable and type in (without quotes again) "nscdec nscript.dat" this will create a text file called "result" where the script is now readable as a text file. Open it with whatever program you want (like I said I suggest something more orientated for programming like Notepad++) and congratulation now you can see the script in all its Rated R glory. You are free to jump to the next section if you already have opened (or don't care to get) the NSA files.

Extracting with Crass
Good now you can see what the script file says but now you have to be able to see all the files. Inside the arc files as well no?

Extract the Crass download somewhere (I made a folder for this copy since I changed mine a little bit). After extracting it go inside and look for and open the CrageGUI executable.

Click the check-mark on Source Path (this way it grabs all the NSA files) then go browse and look for the folder that has all the NSA files (obviously I suggest going to the folder for Chapter 2 of the game since it has the files of both Chapter 1 and 2) Click OK then Execute

Let the program run as it works on extracting  all the files which will be quite alot of resources.



Once its done with all the files unless you went to advanced and change the destination you should find folder inside called output_dir and all the goodies will be inside and you can browse them for reference when you are programming.

Programming Vocabulary
Now I understand not everyone that wishes to make a re-patch has programming knowledge so I will give a quick breakdown on some of the common terms and commands used by the game.

However for a full list of everything that is possible please look at the Reference book found here. Before you go asking around as to what does print mean cause you won't get an answer from me...

Please note all these screenshots are done while using Notepad++ so I cannot help you if you are using anything else.

Ok when you first open up the script you will see some code and will probably be lost already unless you know how to swim already (err...program. I can't swim either...)



first let me explain the simple some of the little nits and bits.

; -- whenever you see this that means everything to the right of it on that line is a comment. A comment is simply that. A comment the program (the game in this case) will not read it and is simply there for the programmer to be able to read it while he is working here. Most comments won't make sense considering they were originally written in Japanese and thus when the character encoding was switched they turned to weird jibberish. If you wish to know check the screenshot below.

Then you are free to either read it yourself if you got the knowledge of use any translator you know. Just be sure to set the character encoding back to "Encode in ANSI" before packaging it back as a script data file.

* - A * is a label. Almost like a flag or a landmark it lets the game know where to go when a certain commands tells it to be.

mov - mov is a command that loads a number or string into a variable.

string - a string is a set of characters (letters, numbers, symbols,etc.) usually an entire string is in between quotations. "This is a string. " this is not a string. "All of this no matter how long or if it has 30 numbers of different #s is a string from quotation to quotation. "

variable - If you have taken Algebra you should know what a variable is. basically a variable (can be a letter or a word) holds a number or a string depending on the type of variable it is.

goto *xxxx - does as it says. It makes the program go to a certain section of the code marked by the label (*)

gosub *xxxx - subroutine works in a similar way to goto but it is like a detour. If will go to where the label marks but it has to have a return at one point of time or another when it hits the return it will go to the last gosub that it took and continue from there ('''it must not have any subroutines left to run when it is don't working otherwise you can be prone to a crash due to a stacking amount of in-returned subroutines.

Most of this will be self explanatory so I'll move onward. You start the game through new-game and it takes you to game_start

and you see the following: *sean0000a mov %manuoff,1 bg black,1 wait 500 lsp 700,":s/24,24,1;#FFFFFFDifficulty? (Changeable On@Loss) ",172,143 csel "Normal",*sean0000b,"Hard",*sean0000b csel"",*sean0000b you goto label *sean000a

and you are moving a number variable (if you see a % then a word it is a number variable. If you see a $ then a word it is a character variable) and we are storing a 1 into that variable.

we are getting our background to black and we are doing it instantly

we then wait 500 milliseconds (half a second)

lsp is loading a sprite (a text sprite at that) I'll ignore the first section of it and jump to the #FFFFFF

those 7 characters is a hexadecimal code color for white meaning the text after it will be white) and they are placing it at the X and Y coordinates of 172, 143 from the upper left corner.

then you are given an option between choosing hard or normal and they both take you to sean000b

so we'll jump to that next *sean0000b if %sentaku=1 mov %nanido,1 if %sentaku=2 mov %nanido,2 cspl 700,701:print 10,500 wait 500 lsp 700,":s/24,24,1;#FFFFFFVore@ScenesH (Changeable in@Special Config) ",172,143 csel "Watch.",*sean0001,"Skip",*sean0001 if you went with the first option (normal) it is going to set a variable called nanido (which basically means difficulty level) to 1

otherwise it will be #2

then it will clear up the sprites and do basically the same thing it did earlier but ask a different thing and go to the next sean simple choices and serves as a simple tutorial if you ask me

Lets jump a few lines now and so we get some more examples

bg "bg\bg001.bmp",99,5000,"system\lngtwave.dll/vwi" wait 1000 >Where am I...? \ >A soft light fills the area, giving the atmosphere a solemn feel. \ >...Is this a dream? \ name "??? " >Luka...@ >Oh brave Luka...\ name "" >I hear a beautiful voice begin to call out to me. @ bgm"bgm\irias.ogg" lsp 700,":a;chara\iriasu_st01.bmp",0,0:print 10,3000 >The goddess Ilias suddenly appears before me! \

now instead of a simple background (black) we are using a string to specify the background.

The game automatically knows to search all the NSA files as you see and thus doesn't need to be told which BG folder to check (whether it be arc or arc1) and then checking all the BG folders does it check for "bg001.bmp" it then uses a special effect (special effects are marked as 99), the effect lasts for 5000 milliseconds (5 seconds) and the special effect is the lngtwave.dll/vwi inside the system folder.

wait causes a pause for 1 second

> - > basically is a line of text.

These lines of text are either cut off by a " \ " or an " @ ". So whats the difference? If you are playing the game on the side while looking at the code (or you aren't looking carefully enough) they do similar but different things.

\ cuts off the line of text and thus forces you to click (or the space-bar or however else you progress through text) before continuing the rest of the text and it also clears all the text.

@ on the other hand also cuts off the line of text and forces you to click to continue BUT it does not clear the text.

There are times you might wish to continue the text of one line to show up while you are displaying another and thus the @ is available however beware if your lines of text are longer the text box the game will crash so be sure to clear out your text often with \

name - name is actually a command that loads (or removes) a sprite that goes in the name-box for dialogue

if you have "" with no space in between you don't have a name nor a sprite which is very different from " " where you do have a sprite but obviously no name. while they may not seem very important with dialogue be aware of this when using it with skillname which works in the same form of way since leaving the a space between the quotation marks will leaves a black bar that normally displays a skill name but all it is displaying is a space.

Single word names do not require a space and thus putting for example

name "Ilias"

while it MAY not give you an error (a graphic character error not a fatal crash) out of good practice I suggest leaving a space after names and skillnames whether they are only a word long or several.

further down the line you see bgm"bgm\irias.ogg" it is going to loop endlessly (thus act as a background music) the sound file called irias.ogg that is inside the bgm folder. This sound file will not stop until you quit the game. use bgmstop or have it play a new sound file as the bgm

Adding your own resources
So you got a good grasp of the program and how to run files in the game. Now you want your own resources (images, sound effects/music, videos, etc.) to your mod. Great! for the sake of organization I suggest you create a folder call it whatever you want (so others have an idea time knowing what they installed call it something related to your mod ) and drop that folder to where all the other game folders (same place where the script is, where the executable is, where system,bgm,save,etc.etc. is)

all you need to do now is change where the directory points to

so if you are loading an image from  your folder

lsp 700 ":a;\your_game_folder\your_image.bmp"

sound?

dwave 1,"your_game_folder\your_sound_file.ogg"

bgm"your_game_folder\your_backgroundmusic.ogg"

of course you can also do this folder within folder (note I never done this but covar has and I haven't looked at his script but I'm safely assuming it should be like this...)

lsp 700 ":a;\your_main_folder\your_character_folder\your_image.bmp"

Adding your own images for fights however is trickier and I will go through my example in the Advanced section

Battles
'''This section will start covering as soon as you hit the label that says goto *...._start with .... being the name of the enemy that starts that fight'''

Battles and the functions/labels,etc. that go behind them take about 82.5% (well that and other small stuff like the encyclopedia but yeah about 70-75% of it would be more accurate...) of the script text file if you are looking at Chapter 2's script (since it encompasses both Chapter 1 and 2's dialogue and battles)

Due to that fact I highly suggest you look all the paths it takes all the subroutines it takes before continuing where it was earlier and everything and try to grasp as much as you can. But since I do not believe the average reader is going to bother the first time I suggest you simply come here and refer to my walk-through (or actually study the code yourself ) when you run into problems.If anything go ahead and skim-read it when you encounter a problem either look at the code and the paths it takes and try to see what is causing it to not do what you were intending or look at the main section here...

Due to the fact you will jump a lot I suggest keeping a second copy of the script to jump around with or in Notepad++ right click the tab and click "Clone to other view" now you have the same file (if you edit 1 side it will affect the other) but you can see 2 sections of the file.

Battle Start
'''For the sake of covering as much material in 1 run I will use the Granberia 4 fight since it covers almost (but definitely not) everything you can do in fights. A simple fight example would be the earthworm girl (since the first fights before Angel Halo follow a very strict pre-written path for the sake of plot and almost tutorial-esque playthrough the first fight you are free to do as you please would be the earthworm girl). An example of tag team fights would be mummy girl. An example of multiple enemies would be Zombie Girls. '''

Immediately from the start you are given a bunch of variables that correspond to granberia her name will be marked as Granberia in both cases (the reason you have 2 name variables is for the name changes in the middle of a fight like an enemy disguised or against multiple enemies) her 4 poses are marked by each tatie (Granberia hardly ever dropping her guard or pose stays the same with _st41 but I will give a quick explanation of the 4 taties near the end).

Take careful note of $lavel (label) this is what you will use to move around alot and it is important that your lavel (label) name matches both the one on _start and all the important labels in the fight.

Haikei is the background. Your two monster variables are the X and Y for when loading the sprite (in correspondence to LSP not LSP2 so from the upper left not from the center).

The difficulty aka nanido (Normal = 1, Hard = 2, Hell = 3) will correspond (not always sometimes these will be flat no matter the difficulty) as to how much HP the enemy.

henkahp1 (and henkahp2) is a very useful HP variable for when you want an event to happen after the enemy's HP has dropped to a certain point. You do not need to set this variable up if you do not plan on using it.

damage_keigen is how much damage YOU do to the enemy (in this case you do 70% damage to granberia).

Kaihi is your chance to hit the enemy (in this case you got an 80% chance to hit granberia with your normal attack [skills have a 100% chance unless you specify but I will cover that later] ). Note that whenever you have Sylph lv 3 (and I believe Lv 2?) Kaihi is ignored since your attacks with Sylph always land unless scripted otherwise (ex. Alma Elma fight).

Earth_keigen is how much damage resistance you will have from enemy attacks (in this case damage is cut in half [50%] that you receive from Granberia UNLESS this is hell difficulty in that case you take 3/4ths damage (you are only protected by a quarter (25%) ).

We are going to play the 4th song on the list (you will find out which one is #4 soon).

Next we will take our first detour of the many detours (subroutines) we will take. so let's see what maxmp does.

Note anything that says gosub instead of goto means that as soon as it hits a "return" it will go back to past the last gosub it hit and continue from there so if you got 4 gosubs in a row and it hit 1 return it will go back to the 3rd gosub not all the way to the beginning.

'''Again I suggest you have a 2nd copy of the script or clone view since you will be jumping through the code a lot. '''

Maxmp will check that your skill is greater than 0 (since at the start of the game your skill is 0 and you have 0 MP) if your skill is greater than 0 it will then check what LV you are (remember just like math with number-lines it does not include the number listed unless it says >= or <= ) then it tells sets up what your max MP count will be then it will return. Immediately it will then set our current MP (%mp)  to be that of whatever your maximum MP is.

Syutugen2
I like to think of Syutugen as the battle preparations, and you will learn why after finishing this section.

This time we go to another subroutine called syutugen2 (do not worry too much on the definition of the words its basically how the battle will start in the case of the 2nd syutugen you won't get the whole "A xxxx has appeared! with the whole battle start sound effect).

Syutugen2 will turn off your save option (so you can't save in the middle of a fight) and then take a subroutine (yes while it is still in its own subroutine) called musicplay so now lets jump to that one...

Musicplay then checks what music we are going to play. Remember we were going to play the 4th song so our background music for the battle against granberia 4 will be sitenno.ogg for this fight. It will then return so go back to syutugen2 (not the battle_start).

It will then check if this is from the main game or if this is a side story (if this is from the game itself the variable by default will equal to 0 if you are in a side story by default it will equal 1). For now we are assuming you are only doing fights with resources from the nsa files [not to mention I'm using granberia4 as the example] so all mon_labo_on variables will equal 0 for this example.  Since we equal 0 our hero's name is Luka and we are player 0 then we will skip 3 lines (to count it correctly you should land on the empty space in between the 2 written lines).

We will now go into another subroutine called setwindow_02 (Beware when using Find in notepad [Ctrl+F] make sure you are looking at setwindow_02 and not setwindow_02p ).

Here it will check what player you are (player 0 is Luka, 1 is Alice, 99 is the black anon common in side stories) AND what window type you have chosen (covered in the special config[?] settings) it will then set the correct window for you and return back to syutugen so continue onward!

Now we will hide sprites 592 thru 595 then we will load into sprite #700 the sprite marked in tatie1 (what we had at the start before jumping in here) and setup its coordinates (see why we had those variables now?) afterwards it will setup the background.

After setting the background it will then setup the max HP bars for both of you, gager (gage r, R for Ruka / Luka) and gagee (gage e, E for Enemy) and its gonna be the gage 100 (100% hp).

Then since we are player 0 we will load the sprite with Luka's face as the avatar.

Then it will move your LV into a variable called %mylv_sin.

Why make a copy of your Lv? For fights like the succubi that drain levels (refer to those fights as to how this variable is used exactly while also looking at the *damage label ).

Since we are player 0 we will go into another subroutine that will grab our max HP (I'm not gonna go over this one but it works EXACTLY like the maxMP subroutine [checks your level then tells you what your max is).

After returning from that variable it will then move your maximum HP into your current HP so they both match at max.

Then it will take another 2 subroutines simply called hp and sp I will only cover subroutine HP. *hp itoa2 $mylifeh,%mylife itoa2 $max_mylifeh,%max_mylife mov $hp_hyouzi,$mylifeh+"^"+$max_mylifeh len %name_count,$hp_hyouzi lsp 559,":s/12,12,0;#FFFFFF"+$hp_hyouzi,264-%name_count*3,557 return itoa is a command that changes numbers into characters for strings. In other words the #2 can now be read as a text character 2 instead of a numeric value 2 (I know might be a little trippy here if you don't program).

So it grabs what you have as your current hp (%mylife) and it makes it into a text number as well as with your max hp.

Then it puts both of those strings together into a string variable called hyouzi, checks the character length and then displays it over your HP bar before returning.

If it wasn't for this simple subroutine you would not have an exact clue as to how much damage you were taking and thus you would have to guide yourself blindly by using only the HP bar.

It then returns and goes to the subroutine for SP (does something similar but figures out how many SP sprites [the yellow dots] it will load).

Returns and then it makes sure that the enemy's current HP is that of their max HP.

Then we go to subroutine syokika.

I highly suggest you check this first so you know where exactly you need to put this subroutine (no point in adding a variable then calling syokika and thus erasing that variable you just changed).

Syokika is a very important subroutine here it cleans out anything and everything from a previous fight and sets it at zero.

After returning from syokika you finally exit syutugen2 (quite a lot wasn't it?).

And return to battle start.

The next 3 variables end_n, exp minus and zmonster_x, I will leave those to you to figure them out since they do not hold too much important with my mods but you may find them more important (in my case I leave end_n at 2 but you may need it at a different number ).

tukix (and tukiy) will determine the X and  Y of some skill's animations.

Finally after all of that you have your dialogue but right before the end of the dialogue we see a variable being loaded called sinkou (shinkou means progression in Japanese). Sinkou (as well as the many hanyo variables) can be used to mark certain events in the middle of a fight.

So we set sinkou to the 1 (you can say the start of the fight is the first event but its not necessary) then we go to simply what is says. The common main is shared by all fights so let us jump there next.

Common Main (1st trip)
The first group of strings checks if you bound (%kousoku>0) and if not - checks artificial spirits status. If any of artificial spirits is active (%enemy_wind/earth/aqua/fire>0) then the linked variable is decreased by 1. And if the result is 0 - *enemy_element_sel1/2/3/4 is called. These subroutines will remove spirit icons for an enemy.

We will set %battle to 1. This is used with text automode ("Auto" button in battle window) and with Spin-off stories damage and kaihuku commands.

We will then increase the "current round" variable (%turn) by 1 (by default its 0 so we have now jumped to the 1st turn).

All the owaza_counts are like the "cool downs" for your enemy's big moves as you can see in the code you can tell right away why Hell difficulty is well...hell lol your enemy's big moves are always ready. Every.Single.Turn.

Tuika_owaza_counts are same, but are used for Spin-off battles.

%bougyo is your guard so its being set back to 0 (meaning you are no longer guarding in case you were, your previous turn).

%skill_sub will cause your skill to take a subroutine in where you miss or do no damage (depending if you made it equal to 1 or 2). So this string will return this variable to the default value (0).

%skill_num is used for Monsterpedia "Hit by all Requestable Tech in Chapter..." achievements.

%nodamage line checks that your's current HPs are maximum HPs. This is used for the "Win without Taking Damage" achievement.

It then checks to see if your life is less than 1/5th of your maximum life (as well if you are not bound [and gone through its kiki. Kiki is the tease the enemy will tell Luka the first time Luka's HP drops to such a point] ). If the conditions are true then it will go to the subroutine of *face2 (I'm not gonna take you through it but basically it will change the sprite to whatever tatie2 is).

If you are bound it will skip the next 5 lines meaning it will not cause your earth or wind durations (%wind_turn, %earth_turn) to drop down. If you are not bound, their duration turns will tick down as usual.

As you can see by how the game normally operates bound or not, water can be lost while bound while earth and wind (as well as fire on the upcoming check) will not lose turn durations while bound. Whether this is intentional or a bug is something I personally do not know.... but just a curious thing to note (and you are free to change on your mod or not...)

For water duration (%aqua_turn) the game will use the same check as for wind/earth/fire durations. The only exception is Undine level 2 (%aqua=2). In this case the game checks for Serene Demon Sword usage (%aqua_end=1) and break summon if this skill was used. If not - the game will decrease your's MPs by 1. And the summon will break after MPs are gone.

Then the game checks the fire duration if you aren't bound. Anyways before we continue lets imagine you do got a spirit (lets say Sylph) and your turn duration does run out this time so we will take the subroutine element_sel.

Here it will check which spirit is active (above 0) and their duration is out (under 0 [-1 really] ) it will then turn off that spirit (set their element to 0) and then move a string character saying that element is out.

It will go into another subroutine called *elm_print (element or emblem is up to you as to what it means but the 4 icons for your spirits) where it will check if the spirit is greater than 0 it will make sure their emblem is present if it is at 0 it will cause it to disappear, print and then return to element_sel.

It will then take a small function command called eng. You need this function because if you try to print string variable with english symbols in the NScripter - NScripter will crash if the string length is odd. So - this subroutine checks the string length and adds a space in the end of the string if needed.

It will then print the prepared string clear it out and then send you back to where you were in the common main...

It will then check your status (%status). If you have none (%status=0) it will skip all that section if you do got one it will check which one and find out how it will continue. I'll leave that for you to explore....

%kadora and %kadora_damage revolve solely on your one and only skill that requires a charge (Quadruple Giga).

Making Quadruple Giga work outside of pre-scripted scenes (like granberia 4 or tamamo2) is quite tricky so I suggest you look at these pre-scripted fights first and make changes where you feel are necessary (in my case I added their variables to the syokika label as well as to a few other areas).

The last thing common_main will do will check if you are surrendered or not (%kousan). This is used for Surrender and Request commands, extended rape scenes and vore scenes.

If you are it will jump straight to the enemy's attack (*$lavel_a) remember for this example $lavel = granberia4 so we are jumping to *granberia4_a if we were surrendered.

Since we are not surrendered we will instead go to their main so jump back to *granberia4_main

Your move
Straight after getting here in what you would expect to be the enemy's action we are actually going to go to another main called command main (cmd_main) so again we shall jump~

Some sprites are removed, saving is kept off if for whatever reason it was on and we clear any button values we had. We change the window type again this time by taking the subroutine *setwindow_04 (I'll spare you the trip you can do that yourself). Then it checks if we stopped (by force) any commands from being useable. Why would you want to stop commands? Well they might not be written (example - Alice doesn't have a normal attack or a struggle in any label function and thus were forced disabled when using her in the Chimera Plant in Chapter 1). Or you might want to forcefully lead a player down a certain path (My mod Chapter 2 when first learning Passionate Wrath). In Granberia4 we are not forcing any command to not be useable so if the conditions are correct we can use them simple as that. As you can see options that are available are marked by 2 hexadecimal colors #FFFFFF#FF4444 (White then red) followed by the name of the action. Why two colors? Think for a second.... ...Nothing? When you first see the option it is white, when you hover your mouse of the option it turns red. If the action is marked as #bbbbbb it is dark grey and thus unable to be used. Of course those are just color aids what actually determines if they are clickable (and thus useable) is if they are actually buttons (and thus clickable) or not. spbtn as I'm hoping you can guess for yourself from all the clues I'm giving out...means sprite button. So it turns our text sprite into a button and it works in a simple way. I'll use the attack line for this example. The sprite number is 601 correct? Spbtn on that line is written as Spbtn 601,11 (Attack) meaning sprite #601 has a value of 11, while (Skill) Spbtn 607,17 means sprite #607 has a value of 17.

Now that we have all our buttons given numbers we need something to "listen" and record the button we pressed (the text sprite we clicked on) so after saying what is available and what isn't we go to *cmd2_main and wait... we continue waiting until we get a button press. When we receive a click it gets stored into %cmd1 Once it does get a button click it runs that number (which is now in %cmd1) and checks it with the "what ifs" lets imagine we clicked two buttons one after another (attack and skill but not simultaneously that is impossible...). Since we passed all the what ifs we can return so we go back to granberia4_main and check (first attack so #11 then skill #17).

Since we don't got Undine on at the moment we end up going to *granbera4_miss so jump there (its right below it) Luka attempts to attack but it misses then we go off to her attack (granberia4_a) but lets cut it off there. The enemy attacks will be in a section below. Lets go to skill now both the regular path *common_skill and Granberia4_skill take you to the same subroutine so we shall do that this time instead of command main we go to skill command (cmd_skill) so lets go there!

Skill Moves
The skill list is almost the same as the command main but it checks for different things.

It looks to see what your skill level is (if you are too low the skill either doesn't exist or only shows the weaker version if it is higher the old skill is over-written by the new skill not to mention the new skill has a different number value than the old.) and obviously it also checks how much MP you have to see if you can even pull off the skill.

It then goes from cmd_skill to cmd_skill3 no matter what button you pressed. There it checks what button you pressed.

If you pressed either directional arrow in either end of the bottom corners it then jumps to cmd_skill2 before coming back to cmd_skill3

After checking you have an acceptable number it returns to the label which in most cases will be to *common_skill.

Enemy attack and progression in battle
This time however it is going to take us to *Granberia4_skill so we will be doing different things for this battle but anyways.

When it gets a number that matches it goes to that label and so on and so forth. For the sake of advancing through this fast lets imagine your choice was Undine (#33) since our hanyo3 by default is 0 (unless we changed it) we will then go to *granberia4_skill7

You can read that by yourself I don't have to explain it. In the mist of all the code you see that %hanyo3 is changed to 1. Thankfully the game is merciful (or simply the fact that Granberia attacked at the same time you used your skill [perspective I guess...] you don't go to granberia4_a this time).

This time it took you back to common_main so I'll save you the walk-through and do the same path we just did up to calling undine this time however hanyo3 does equal 1 so it will instead take you to your regular skill10b at the end of this we take the regular attack path so onto granberia4_a. Lets assume we don't meet the conditions for the first 5 what ifs so we go to your normal attack pattern then.

rnd2 %ransu,1,9

this line basically means that %ransu will receive a number between 1 and 9 afterwards it will take a subroutine of its attack before returning to the main. Thus completing our circle, of-course the battle must have a victor and a loser so lets first look at the path Luka takes upon losing so lets go to any of Granberia's attacks right after taking damage you will see a line in for all offensive attacks that says

if %mylife=0 return *granberia4_h1

which simply means; if Luka is out of HP its off to the H scenes ignoring (or getting distracted however you wish lol) most of the H-content you will spot 2 variables you want to note for loses the two $bad variables. ($bad1, and $bad2) at the end of the H-content there is a label that reads goto *badend this will take you to the game over scene what is said about you will depend on the two bad variables. But you can go over those yourself.

Player victory and more on skills
Now for victory Granberia4 is a bad example since its a scripted victory by Quadruple Giga instead of actually bringing their HP down. for any victory you are to look for $lavel with _v (in this case granberia4_v) and this leads you to the event of the victory before continuing with the story.

So instead for the victory we will go a few battles back and look at Yao's fight (lavel is hatibi) but we don't have to go to her for the example Lets imagine she is just 1 hit away from going down so lets go to a random attack say Demon Serene Sword (*skill13) since its a simple one

Since I have neglected Skill explanation I'll use this one. So I'll break it down

%before_action is a unique number for every action (attack, critical attack, guard, wait, each individual skill,etc. ) has. How you use it is up to you but if you add new skills you should make your new skill not have the same number as any previous skill or action.

You then randomize between 3 numbers and that will be the dialogue.

%aqua_end variable will be moved to 1 (it affects Serene mind lv 1 [aqua 2] ) and thus is not important if you are not dealing with a level 3 water (Serene Mind Lv 2) (but you can still study the mechanism for other uses however).

It then takes away 2 MP from your current total and displays the new total. Then prepares a few things for the skill name, fires off the sound effect and then checks if player is either 99 or you don't got Undine on at the moment, (if either is true it skips that section but lets assume you are player 0 and you got aqua lv 3).

It then loads both of the water sprites (water Luka and Undine) into LSP2 ( This one works differently from LSP where X and Y measure from the center of the image instead of the upper left corner. )and takes a subroutine called skill_cutin to do the movement animations for them [you can explore that yourself if interested I also ranted a bit in a blog about them. ] then you have some effects blah blah blah and near the bottom you have your damage modifiers so I'll jump to that....

mov %abairitu,300+%mylv*3 if %aqua>0 mov %abairitu,%abairitu*2 if %fire>1 mov %abairitu,%abairitu*3/2 gosub *enemylife skillname "" if %skill_sub>1 return goto *common_attack_end

The base damage will be measure by 300 plus 3 times your current level. So lets say Luka is lv 70 when he is fighting Yao (I don't remember the exact level) so his total damage multiplier is is 510.

Lets also assume Luka has salamander so our multiplier is then multiplied by 1.5 for a total multiplier of 765.

This number is then taken to the subroutine that will subtract HP (along with the simple vanish / re-appear animation for the enemy taking damage).

The multiplier (765) is then multiplied by 70 (his level we are assuming right now ) times the damage resistance of yao (in this case 100 ) and then we divide by 2000 That gives us 2678 [rounded up?] as the flat damage. (Note my math might be wrong but I THINK it goes by order of operations... )

The flat damage isn't what actually is dealt however. Instead we get a range between the damage * (9/10) and the damage *(11/10) meaning the actual damage dealt will be a random number between 2410 and 2946 )

Whatever we get out of the randomizer then is what is subtracted from Yao's HP we are going to stick with our earlier assumption that Yao was 1 hit away from reaching 0 HP so after returning from the enemylife subroutine (and making sure our skill_sub is at 0) we go to the *common_attack_end.

If Skill_sub was greater than 0 the skill would do no damage (or not be applied depends on what number you place) and thus this is how you make a skill actually "miss" by increasing skill_sub to be greater than 0 for that turn.

The first line is true for Yao so we then jump to her victory scene (Hatibi_v) if she were still alive though we would check first if she had a counter active (and if so we would take that path) otherwise we would continue by going to her attack (Hatibi_a)

and thus that should cover all the paths with battles.

Running your script
So you made changes to the script, great now you have to see if it doesn't crash. First of all save your text file (you don't have to exit Notepad++ or wherever the hell you are working just save) once that is done all you have to do is take your text file and repackage it back into as a script file. So lets open up the command prompt again and change directory to where you changed it earlier.

This time you want to type in (without quotes and brackets replaced with the name of your file.) the command "nscmake [name of the text file you edited]"

In my case I named my edited copy of the script (for Sealed) well...Mine.txt lol



This will create a file in the same area called nscript.dat which hey that is the file you needed to mess with anyways (and thus why I suggest you keep the original script saved elsewhere).

Now all you have to do is grab that copy of your script and throw it into your game folder (and obviously any folders you specified if you added your own resources) and run the game.

Personally as a quick test (since I am constantly patching and fixing my scripts) I do a quick run of what I am looking to check.
 * 1) Did I crash on starting up the game? No? Good.
 * 2) What exactly did I just mess around with? (Dialogue, a battle, etc.) Try to get to that point.
 * 3) If you changed something major (like a variable or made your own variable or something [covered in the Advanced Section] ) does it affect anything BEFORE and AFTER it (say you created something for battles. Does it affect your other fights before or after the one you are testing?)

Troubleshooting your re-patch
So you did get a crash? Sure maybe a quarter of the error message is in Japanese or jibberish but that does not mean you can't figure out what it means. If you have an idea where you made changes then you have a rough idea where it may have caused a crash. I will go over a few common crashes I have encountered.

Please note I create these errors on my patch so do not expect the line numbers (or lines of code)  to match since I erased a good amount of the original game...

Variable Crash
If you see a crash like the one in the screenshot (most likely upon starting up the game)

Well the top line is jibberish so no help. So lets read what we can read.

Line 51086


 * define

numalias helper,1791

> numalias empty

and then it just cuts off.

It isn't very noticeable in the wikia but I just made the bracket bold on one the two numalias lines. The game will tend to point out the line in question that is giving it errors (sometimes this is not accurate but you can at least know that your error is affecting that line and thus it may be closeby)

Note - You can use Ctrl+G type in the line number then go.

so lets look at those 3 lines of code  (however it is good practice to look at more than just the lines shown on the error code look several lines below and above the line in question of the error). *define numalias helper, 1791 numalias empty 1790 If you have a sharp eye (and well depending on how sharp) you may have noticed one of several things different between our line of code and the error code. Hopefully you noticed one or both of the things below If you noticed #2. Congratulation there is your problem add your comma, save it and run it again!
 * 1) The error message cuts off before empty not displaying the word "empty" and doesn't display 1790
 * 2) empty does not have a comma.

If you didn't you have to see why the 2nd line of numalias did not run but your first did. In the case of this error it was due to the lacking of a comma but you should check for everything, punctuation (commas, @, \) mispellings,etc.

No music / sound
Sometimes you are adding sound effects or music whether in a battle, story, or in the case of our troubleshooting here the title screen.

You run the game and don't get any sound when you were expecting a sound effect or a song to start playing. You check your config settings and you do have the volumes at an appropriate level. So lets check the sound file at the title screen (since we know we aren't hearing any sound at the title) *title saveoff bg "Sealed\2\title.bmp",10,1000 bgm"Sealed\ruka_8bit.ogg" wait 1000 Well there we go the BGM isn't in the Sealed folder its in the 1 folder so lets I change that to bgm"Sealed\1\ruka_8bit.ogg" Run it again and hey the song is playing!

Side Note - Why the game simply does not play the sound and not crash like when images (background or sprites) are missing / not found. Is something I have no idea on nor have I bothered to look for but both are fixed in the same manner (check that the file exist and that the directory points to the correct location).

Dialogue Crash
You are playing through the story and suddenly you get an error. These crashes are trickier if you honestly have no idea why it crashed. The error message is not guaranteed to help as well.

Example 1

In this example the error message is telling us to check line 52923. You go there and find nothing of importance or the sort that would cause it to look like you may have changed directly or indirectly.

Now I will give you a different example of the same kind.

Example  2

This is the same kind of error except it crashed at a different spot (I fixed the previous one myself already). If you never encountered this bug before you are most likely completely lost as to what is happening and how multiple lines could be the source of the problem (all those lines of codes got a bracket with the last one having two).

What you may have noticed however is that while you had intended for the text to be longer it crashed after a certain point. Hopefully you also noticed that it crashed when the text box was full. If you noticed that, you now know why it crashed.

You filled up your textbox and thus the game is unable to unload the rest of the string(s) into the filled textbox (unintended innuendo...).

While this is an easy bug to fix it is hard to do so the first time you encounter it and have no idea why it occurred. Simply end your lines with an \ instead of an @ when you think the box is close to (or will be) full before displaying the next line.

In the example (#2) above I would recommend myself to use an \ instead of an @ on the line of text that ends with "that is not from the game." since the next line (Disclaimer: ......) is too long to fit into the text box with stuff already being displayed.

Creating Number Variables
If you have prior programming knowledge or at the very least you got the knack for what you are doing and are brave to change the code around as you please you can obviously try to create your own features or do stuff that is not normally presented to you. Of course trying to add something that does not exist or isn't available requires a good amount of knowledge of the game's code, see what is already in place for what you want and what you need to make changes to so the game works your way.

Do bare in mind that OnScripter is written as an Assembly-type language and thus being a low-level programming language. It is quite indeed the barebones program so messing with the code and adding stuff requires the proper mind-set to make sure nothing goes wrong with your code. If you are coding your re-patch with a high-level language in mind well things just aren't gonna go so well by assuming things will run just fine.

I will cover 1 item of great importance however, and that is the creation of your variables, number variables to be specific since there is more than enough character/string variables that are free to manipulate at will but you may feel the number variables might be lacking in quantity if you wish to add more items to your mod especially if you are upgrading and improving the game's battle system.

Update Note - Character/string variables are made exactly the same way.

Get your Find window up and type in numalias and search in a downward direction. You should hit the define section. Here all the variables are well simply that; defined. All the variables are given a number (basically onscripter's version of a pointer) and while you are free to create your variable here I would highly suggest you kept all your own custom variables in one section so scroll down for now and look for numalias mylife,       801    ;Ž©•ª‚g‚o The variables from 801 downward are all (by all I mean until the next obvious section marked by the commented sign)relate to variables in battle (either used in the normal game itself or in side stories themselves). I suggest creating variables here as needed (or if you plan to write an untold amount of variables that don't exist yet I suggest going to the last section. As for what numers you can use? My suggesttion is to look at all the variables that the game creates and gives a number to. Afterwards use a number that is not already taken (in my case I am using the numbers between between 700 and 800 if necessary)

Example from my mod -- numalias power_convert,   757    ;    holds Yao's attack/power conversion count numalias Tama_earth,   758    ;    holds Tamamo's earth count numalias Nibi_wind,       759    ;    holds Nibi's wind count numalias Nana_aqua,       760    ;    holds Nana's aqua count numalias Yao_fire,       761    ;    holds Yao's fire numalias max_Lulife,   762    ;    holds Tamamo's Max HP     numalias Lulife,        763    ;    holds Luka's current HP     numalias numalias bind,           765    ;    bind count (same as %stun) numalias Tamamax,       766    ;    holds Tamamo's Max HP     numalias Tamamolife,    767    ;    holds Tamamo's current HP     numalias Yaomax,        768    ;    holds Yao's Max HP     numalias Yaolife,        769    ;    holds Yao's current HP     numalias Nibimax,        770    ;    holds Nibi's Max HP     numalias Nibilife,        771    ;    holds Nibi's current HP     numalias Nanamax,        772    ;    holds Nanabi's Max HP     numalias Nanalife,        773    ;    holds Nanabi's current HP     numalias fire_keigen,    774 ;    for the cases when fire has a resistance isntead of earth numalias fi,           775 ;    holds last level of fire (fire lv 0,3 or 4     numalias wi,            776    ;    holds last level of wind     numalias ea,            777 ;    holds last level of earth     numalias aq,            778    ;    holds last level of aqua     numalias stun,            779    ;    stun enemy     numalias stun_r,        780 ; stun resistance    (subtracts from initial stun count)     numalias stun_re,        781 ; stun resist        (becomes stunned or not )     numalias hold_f,        782 ; stores SCS_fi     numalias hold_w,        783    ; stores SCS_wi     numalias hold_e,        784 ; stores SCS_ea     numalias hold_a,        785 ; stores SCS_aq     numalias hold_ft,        786 ; stores fire's turn     numalias hold_wt,        787 ; stores wind's turn count     numalias hold_et,        788 ; stores earth's turn count     numalias hold_at,        789 ; stores water's turn count numalias HP_temp,       790 ; stores last HP     numalias SP_temp,        791 ; stores last SP     numalias SCS_wi,        792    ;Sylph SC-ed earlier (SC-ed) numalias SCS_ea,       793    ;Gnome SC-ed earlier numalias SCS_aq,       794    ;Undine SC-ed earlier numalias SCS_fi,       795    ;Mandy SC-ed earlier numalias KO_wi,           796    ;Sylph KOed numalias KO_ea,           797    ;Gnome KOed numalias KO_aq,           798    ;Undine KOed numalias KO_fi,           799    ;Mandy KOed numalias shinkou,       800 ;second "sinkou" variable numalias mylife,       801    ;Ž©•ª‚g‚o I removed one from the list since it is my hidden feature from my mod (well as hidden as having to actually look for it...)

As I or others create new items for the game you are free to implement these ideas (or maybe be inspired at making your own different route to the same or similar idea) into your re-patch.

Using custom images for battles
If you have spent some time looking exactly as to how tatie variables are used you including  many other functions including syutugen subroutines and face subroutines you will periodically encounter a variable called %monster_labo_on which as you could easily verbalize is a variable that checks if the monster lab (side stories) is on (1) or if its off (0). I personally have gone ahead and added an extra number option to this variable (2) for when we are gonna run files from my custom graphics (in the example of my re-patch, Sealed).

'''Disclaimer: Due to the massive additions I have made I can't guarantee I copy and pasted all the changes I made but the general idea is there. Add a second (or third depending on how you want to look at it) option for the monster_labo_on variable everywhere that it can be found that applies to what you are changing. How and where you use these variable changes depends solely on YOU since this is YOUR re-patch and YOUR mod. '''

Since I personally don't use syutugen I will jump to *syutugen2. This is *syutugen2 in its original form. *syutugen2 saveoff if %music<>%nowmusic gosub *musicplay if %mon_labo_on=0 mov $ori_name,"Luka":mov %player,0:skip 3 if %mon_labo_on=1 && $ori_name="" mov $ori_name,"Luka":mov %player,0:skip 2 if %mon_labo_on=1 && $ori_name<>"" mov %player,99 gosub *setwindow_02 cspl 592,595 if %mon_labo_on=1 && %chara_ori=1 lsp 700,":a;"+$mon_labo_mon_folder+"\"+$tatie1,%monster_x,%monster_y:skip 2 lsp 700,":a;chara\"+$tatie1+".bmp",%monster_x,%monster_y if %mon_labo_on=1 && %bg_ori=1 bg $mon_labo_mon_folder+"\"+$haikei,10,500:skip 2 bg "BG\"+$haikei+".bmp",10,500 lsp 560,":a;system\gager100.bmp",114,556 lsp 561,":a;system\gagee100.bmp",421,556 if %player=0 lsp 598,":a;system\face_00.bmp",34,534 if %player=1 lsp 598,":a;system\face_a00.bmp",37,540 if %player=99 lsp 598,":a;system\face_x00.bmp",37,540 mov %mylv_sin,%mylv if %player=0 gosub *maxhp if %player=1 mov %max_mylife,32000 if %player=99 gosub *maxhp mov %mylife,%max_mylife gosub *hp gosub *mp if %mon_labo_on=1 getini $sub7,$mon_labo_mon_ini,"ruka","hp_minus":atoi %sub7,$sub7:sub %mylife,%sub7 mov %enemylife,%max_enemylife gosub *syokika return as you can see it checks to see if this is running in the normal game (%mon_labo_on=0) or if it is running a battle inside a side story (%mon_labo_on=1)

the first thing it checks with the %mon_labo_on is if the person in the battle is Luka (thus player 0) if it is someone else (thus you would rename the $ori_name) and make it %player,99

Further down it then checks again if this is a side story (and if so if the monster is original (unique in other words), thus %chara_ori at least how I interpret that variable I might be wrong again i got no experience with side stories...) if its indeed original it will go into your mod's folder and grab the image from there

It wil then do a similar thing with the background.

It will then check for something I got no real clue on far as side stories go....then go to syokika and done. Now lets look at my modified *syutugen2 (ignore the %player=2 since that is a relic of before I copy and pasted [then modified] my own syutugen label -- *syutugen_party ) *syutugen2 saveoff if %music<>%nowmusic gosub *musicplay if %mon_labo_on=0 || %mon_labo_on=2 mov $ori_name,"Luka":mov %player,0:skip 3 if %mon_labo_on=1 && $ori_name="" mov $ori_name,"Luka":mov %player,0:skip 2 if %mon_labo_on=1 && $ori_name<>"" mov %player,99 gosub *setwindow_02 cspl 592,595 if %mon_labo_on=2 lsp 700,":a;Sealed\tatie\"+$tatie1+".bmp",%monster_x,%monster_y:skip 3 if %mon_labo_on=1 && %chara_ori=1 lsp 700,":a;"+$mon_labo_mon_folder+"\"+$tatie1+".bmp",%monster_x,%monster_y:skip 2 lsp 700,":a;chara\"+$tatie1+".bmp",%monster_x,%monster_y if %mon_labo_on=1 && %bg_ori=1 bg $mon_labo_mon_folder+"\"+$haikei,10,500:skip 2 bg "BG\"+$haikei+".bmp",10,500 lsp 560,":a;system\gager100.bmp",114,556 lsp 561,":a;system\gagee100.bmp",421,556 if %player=0 lsp 598,":a;system\face_00.bmp",34,534 if %player=1 lsp 598,":a;system\face_a00.bmp",37,540 if %player=2 lsp 598,":a;Sealed\2\face_ta00.bmp",37,540 if %player=99 lsp 598,":a;system\face_x00.bmp",37,540 mov %mylv_sin,%mylv if %player=0 gosub *maxhp if %player=1 mov %max_mylife,32000 if %player=99 gosub *maxhp mov %mylife,%max_mylife gosub *hp gosub *mp if %mon_labo_on=1 getini $sub7,$mon_labo_mon_ini,"ruka","hp_minus":atoi %sub7,$sub7:sub %mylife,%sub7 mov %enemylife,%max_enemylife gosub *syokika return While the game is going down the "regular" playthrough and not a side story it will switch %mon_labo_on between being 0 and 2 (in other words between monsters originally inside the NSA files and in my Sealed folder)

thus for my purpose and for the fact that (ignoring the party system for now) Luka is the only player here so it doesn't matter if it is 0 or 2 Luka is our player so long as it is not 1 will it take that path. Then let is skim down to this line if %mon_labo_on=2 lsp 700,":a;Sealed\tatie\"+$tatie1+".bmp",%monster_x,%monster_y:skip 3 If this is a normal monster from the NSA files it will ignore this line but if its one of my additions it will take this path.

In otherwords it will check the folder tatie (it will go into Sealed and then tatie) and look for whatever $tatie1 is.

So far I have not yet added custom backgrounds so you don't see an IF statement for haikei but you can see I would do something similar for backgrounds if I had any...

Since have created a new number value for %mon_labo_on we have to catch anything and everything that may cause a crash so lets use Find (Ctrl+F) and type in %mon_labo_on=. Since whenever we have a custom fight we will be running with %mon_lab_on=2 being true and =0 AND =1 being false. Thus we have to make sure anything that would of been true on =0 OR =1 to be true on =2 as a safety net. after a few clicks we get to *cmd2_main

Here is my modified *cmd2_main *cmd_main2 btnwait2 %cmd1 if %mon_labo_on=1 && %cmd1=4 textoff: screen_clear: return *monster_labo if %zukanon>0 && %cmd1=4 textoff:return *zukan_commonkaisou0 if %cmd1=3 mov %saveorload,0:gosub *saveload:goto *cmd_main if %cmd1=4 mov %saveorload,1:gosub *saveload:goto *cmd_main if %cmd1=7 gosub *window_delete2:goto *cmd_main if %cmd1=0 goto *cmd_main2 if %cmd1=-1 && %mon_labo_on=2 gosub *menu:goto *cmd_main if %cmd1=-1 && %mon_labo_on=0 gosub *menu:goto *cmd_main   ;‰EƒNƒŠƒbƒN As you can see I made sure I would catch a -1 click (a right click) (note you will see further down  yourself there is a -10 and a -11. How do you get a -10 and -11? I got no idea so I didn't make additions to them but you are free to do so if you feel you can get those and thus end up crashing or getting stuck) 

Continue searching and we hit status_print *when you are under a binding. Here is my modified *status_print *status_print mov %bougyo,0 itoa $statusnum,%status cspl 596,597 if %status=10 lsp 598,":a;Sealed\2\face_slow.bmp",34,534:csp 690:mov %hanyo5,0:skip 9 if %player=0 && %kousoku=0 lsp 598,":a;system\face_0"+$statusnum+".bmp",34,534:csp 690:mov %hanyo5,0 if %player=0 && %kousoku>0 && %mon_labo_on=2 lsp 598,":a;system\face_1"+$statusnum+".bmp",34,534:lsp 700,":a;Sealed\tatie\"+$tatie4+".bmp",%monster_x,%monster_y:skip 3 if %player=0 && %kousoku>0 && %mon_labo_on=1 && %chara_ori=1 lsp 598,":a;system\face_1"+$statusnum+".bmp",34,534:lsp 700,":a;"+$mon_labo_mon_folder+"\"+$tatie4+".bmp",%monster_x,%monster_y:skip 2 if %player=0 && %kousoku>0 lsp 598,":a;system\face_1"+$statusnum+".bmp",34,534:lsp 700,":a;chara\"+$tatie4+".bmp",%monster_x,%monster_y if %player=99 && %status>0 lsp 596,":a;system\face_x0"+$statusnum+".bmp",34,534:csp 690:mov %hanyo5,0 if %player=99 && %kousoku>0 && %mon_labo_on=2 lsp 597,":a;system\face_x10.bmp",34,534:lsp 700,":a;Sealed\tatie\"+$tatie4+".bmp",%monster_x,%monster_y:skip 3 if %player=99 && %kousoku>0 && %mon_labo_on=1 && %chara_ori=1 lsp 597,":a;system\face_x10.bmp",34,534:lsp 700,":a;"+$mon_labo_mon_folder+"\"+$tatie4+".bmp",%monster_x,%monster_y:skip 2 if %player=99 && %kousoku>0 lsp 597,":a;system\face_x10.bmp",34,534:lsp 700,":a;chara\"+$tatie4+".bmp",%monster_x,%monster_y print 10,500 return If you are bound up by a monster their face will change to their 4th face (tatie4)

so we have to change it here in case it is one of your custom enemies (thus %mon_labo_on=2)

Are you starting to see the pattern? Any time any image is meant to change (especially with the tatie variables) we are to look for where those changes are suppose to take place and take into account that our enemy sprite shows up on %mon_labo_on=2 instead of =1 or =0.

Continue making these sort of changes for Now that you are prepared to take account of #2 lets turn it on. Here is a the battle start for my Corrupt Undine fight. *undine2_start mov %mon_labo_on,2 mov $name,"Corrupt Undine " mov $name2,"Deeny " mov $lavel,"undine2" mov $tatie1,"undine2_st02" mov $tatie2,"undine2_st02" mov $tatie3,"undine2_st01" mov $tatie4,"undine2_st02" mov $haikei,"bg051" mov %monster_x,0 mov %monster_y,0 if %nanido=1 mov %max_enemylife,42000 if %nanido=2 mov %max_enemylife,45000 if %nanido=3 mov %max_enemylife,48000 if %nanido=1 mov %henkahp1,20000 if %nanido=2 mov %henkahp1,21000 if %nanido=3 mov %henkahp1,22000 mov %damage_keigen,140 mov %kaihi,95 mov %music,27 gosub *maxmp:mov %mp,%max_mp gosub *syutugen2 mov $half_s1,"What's the matter boy? " mov $half_s2,"Getting tired? " mov $kiki_s1,"Almost down? Just relax... " mov $kiki_s2,"Soon you will be a part of me... " mov %end_n,2 mov %zmonster_x,-220 mov %tukix,250 ... ... INSERT DIALOGUE AND ALL MY VARIABLE CHANGES BEFORE THE START OF THE FIGHT HERE... ... ... goto *common_main Right in the beginning of the mod we load up the variable change so right from the start we are prepared for any problems since if we had "mov %mon_labo_on,2 " somewhere say after *syutugen2. It would crash why? Inside Syutugen (in this example) it will try to find undine2_st02.bmp to load up but since it is not inside any of the NSA files (we have undine_st02 but not undine2_st02) and since it cannot find it, the game will crash.
 * face1
 * face2
 * face3
 * face4
 * onedari_syori (request function)
 * onedari_syori_k
 * common_mogaku2 (breaking out of a bind)
 * mogaku_earth2(same as above but with earth power)
 * badend

'''Please note: If your game is not gonna run exclusively on custom enemies (and thus use enemies found in the NSA files) it is good practice to set mon_labo_on back to 0 either back on the dialogue after the fight or in the victory label somewhere after clearing the sprites. '''

Features created by others
As people mod MGQ's script and create their own features I hope people will expand this section in the future.

Adding enemies from outside the NSA files into fights.
To be expanded later.

Gin's Party system.

I will add my party system coding after I have finished it completely.