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 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.
Contents
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.
- Is my story something I can finish under 10 thousand lines and if not is it something I can finish in a second installment?
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.
- 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?
If you answered yes to any of these 3 questions you may indeed want to look at this page so continue reading.
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.)
- The tools to unpackage the NSA files (optional but it lets you see the character, background, and voice files used by the game)
- 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++)
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 whever 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.
Command Prompt when opened up.
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....
obviously change the user name and the actual directory to wherever you actually have the files....
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 congratuation 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 (or don't care) opened the NSA files.
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 crazz 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 executeable.
Click the checkmark 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.
Crage extracting the first nsa.
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 not 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...)
What you will probably see the first time.
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.
Changing the character set back to Japanese
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.
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 milisecconds (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@ScenesH (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 specificy with BG folder (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 teh 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 spacebar 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 avaiable 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 execuable 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 will make the Battle Section a 2-piece section however do not ask as to why something is happening if you decided to skim read the main section and jump to the tl;dr battle section. 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 alot 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.
A VERY throughout walkthrough of the battle system for MGQ
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 definately not) everything you can do in fights. A simple fight example would be the first fight (slime 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 correspondance 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] )
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 alot.
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 numberlines 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.
Then it will go into another subroutine called syutugen2 (do not worry too much on the definiation 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 it will then return so go back to syutugen (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 teh 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 tru 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 wil then setup the max HP bars for both 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 succubusses that drain levels (refer to those fights as to how this variable is used exactly)
again 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 otherwords the #2 can now be read as "2"
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 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 alot 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 shared by all fights so let us jump there next
Common Main (1st trip)
We will set battle to 1 (I can't recall purpose to be honest...but whatever its in the main so don't mess with it. Only mess with things in these important sections if you know what you are doing or affecting)
We will then increase the turn by 0 (by default its 0 so we have now jumped to the 1st turn)
all the owaza counts are like the "cooldowns" to 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.
Afterwards it will look at tuika owaza (another thing I got no honest clue...)