Modding Mini Tutorials

Feb 25, 2012 at 7:53 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
Please use this thread to post your micro-tutorials. The OP will be used to index all tutorials sorted by category

A microtutorial is a short, concise explaination of how to acheive some common task in the world of Cave Story modding. They should be no more than one post, images should be used where clarification is needed. Think of a FAQ, and a microtutorial would answer a question.

will add more later
 
Feb 25, 2012 at 8:37 PM
Senior Member
"This is the greatest handgun ever made! You have to ask yourself, do I feel lucky?"
Join Date: Feb 4, 2012
Location: Somewhere
Posts: 117
Age: 25
I'd love to know how to keep the game the same but edit the text
 
Feb 25, 2012 at 8:41 PM
The Eternal Darkness
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Feb 12, 2012
Location: The Enemy of the Truth
Posts: 314
Age: 108
Simply modify the files with a ".tsc" extension (if they haven't been opened with another file, or the "Hide extensions for known file types" box in Folder Options isn't checked, it's visible) using a script editor such as the one built in CaveEditor or the one in Sue's Workshop. Four .tsc files are in the "data" folder of Cave Story, and the ones for the maps are in the "Stage" folder. A list of commands should come with both CaveEditor and Sue's Workshop, but the latter I'm not certain about, and the former is in the script editor itself.
 
Feb 25, 2012 at 8:42 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
This is kind of a place for people who actually know what they're doing to contribute useful things, not ask questions. There are more than enough topics to cover that we don't really need suggestions, if you need help go here and if you still can't figure anything out by yourself then give up use the quick answers thread
 
Feb 25, 2012 at 10:25 PM
Based Member
"Life begins and ends with Nu."
Join Date: Dec 31, 2011
Location: United States
Posts: 2307
Age: 27
Door tutorial. Feel free to use it in whole or in part in the tutorial built into Booster's Lab.
Doors are among the most fundamental of Cave Story modding operations. Creating your own door will be one of the first steps in learning to modify Cave Story. With that said, let's begin. Start by building your own map, and placing a door in your desired position.
p148883-0-doortutorial5.jpg

After that, go to the entity's flag properties. Be sure to tick flag number 2000 (PC presses down to run script). Next, give it an event number no lower than one hundred. Then, in your script, add an event corresponding to the number you assigned to your door; in this example, we'll set this door's event number to one hundred. The first thing to do is use either the <PRI or <KEY command, which will keep our hero from moving. Next, we want to use the <CNP0100:0000:0000 command. The first parameter corresponds to your door's event number, so make sure they match. This part animates the door to look like it's opening. You could use the <DNP command, but it's generally better you use <CNP for doors. Next, put <SOU0011, which will make the opening door sound play. Then, make the room fade out in your desired direction. In this example, we'll make it fade out from the center. So we'll add <FAO0004. Finally, we need to add the command that makes you go to the next room. In this example, we'll use <TRA0012:0094:0037:0011. The twelve means it will send you to room number twelve, the ninety-four is the event that is ran upon arrival in the next room. And the thirty-seven and eleven are the respective X and Y values for where you are teleported in the next room.
So, in the end, your script for the door should look like this:
Code:
#0100
<PRI<CNP0100:0000:0000
<SOU0011<FAO0004
<TRA0012:0094:0037:0011

An extended bit added in by Noxid:

It's important to never forget to have an event on the map you need to go to. Pixel had a set of generic receiving events that he more or less copy-pasted across all his scripts, those being #0090-#0094. You can follow the same technique, or use seperate events for each door / situation - it is up to you. This receiving event would relate to our code above:
Code:
#0094 <FAIxxxx<CMUxxxx<END
It doesn't matter what the x's are, but the receiving event must have an <END or equivalent (<EVE, <TRA, etc.)
 
Last edited:
Feb 26, 2012 at 1:06 PM
Offensive User
"Big Joe Tire and Battery Restaurant! Opening Soon! Eat at Big Joes!"
Join Date: Sep 7, 2011
Location: IT'S TIME FOR A SHAQDOWN
Posts: 539
It's fine but he only thing that's missing is the event that runs on map 12.

Code:
#0094
<FAIxxxx<CMUxxxx<END

It doesn't really matter what there is but there has to be an <END to it.
 
Feb 26, 2012 at 4:40 PM
Based Member
"Life begins and ends with Nu."
Join Date: Dec 31, 2011
Location: United States
Posts: 2307
Age: 27
Ah, yes. Maybe I'll add something to it about the event on the next room... That would be wise.

EDIT: Yeah, I realized this a while ago, but I took till now to make this edit. I see that Noxid implemented it. Thanks.
 
Feb 29, 2012 at 4:15 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
This tutorial is for flags
maybe I'll format it into a post later
 

Attachments

  • flags.htm
    7.8 KB · Views: 67
Feb 29, 2012 at 7:37 PM
The Eternal Darkness
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Feb 12, 2012
Location: The Enemy of the Truth
Posts: 314
Age: 108
Thanks. Now I can finally use flags for something in my mod without worrying too much about forgetting about the flags.
 
Feb 29, 2012 at 9:37 PM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3054
This is something that has been known about and on the forums for a while, but somehow people are ALWAYS SURPRISED when they are informed of it. This is probably because the information in question is three pages deep on a thread which people mostly go for for the first link, so here is a consolidated and conveniently located version of it.

HOW TO GIVE EXTREMELY LARGE AND/OR NEGATIVE NUMBERS AS ARGUMENTS TO TSC COMMANDS:
Just use symbols that aren't letters. Like <AM+0002:00/0. CE will tell you you suck at TSC. You don't. Or you might, but it's not because of this.
Here's a table saying which ascii values correspond to which numbers (from -16 to 16. they go way higher, but meh):
Code:
(space)	-16	|	1	1
!	-15	|	2	2
"	-14	|	3	3
#	-13	|	4	4
$	-12	|	5	5
%	-11	|	6	6
&	-10	|	7	7
'	-9	|	8	8
(	-8	|	9	9
)	-7	|	:	10
*	-6	|	;	11
+	-5	|	<	12
,	-4	|	=	13
-	-3	|	>	14
.	-2	|	?	15
/	-1	|	@	16

The mechanism by which the real number is calculated is the same as always. Numbers that are in the ones place get multiplied by 1. Those in the tens place get multiplied by 10, etcetera.
A result of all ascii characters working as input is that there are multiple equivalent ways of stating each number. 0012 is 000<. 0000 is 00\: is 001&. Because of this, superfluous ascii can yield complete obfuscation. While you might think 000@ is prettier than 0016, I recommend that you just use standard decimal unless you have sufficient reason (you need a number larger than 9999 or smaller than 0 as an argument).

There are only two real uses for this I can think of. The first is decreasing max health or ammo without assembly hacking. Note, however, that the game was not engineered to do that, so there can be some buggy behavior (setting your health to zero is sorta wonky). The other use is changing bits of memory by using extremely oob flags (you modify data up to 10382 bytes ahead of the first flag and up to 2222 bytes before it. I don't recall what data this is off the top of my head, but it might be useful).

Here's an ascii table. Subtract 48 from the dec value of any ascii character to get what the game interprets it as.
Yeah
 
Mar 5, 2012 at 6:45 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
Another microtutorial for my own later use, this one describes the intricacies of the ANP command. I'm at work right now so I'm going to upload it again with just files, I swear I'll clean these up sooner or later (probably when I get around to implementing the tutorials in my editor).

put the images in a ./img folder for added niceness. If I've made any mistakes let me know, these are all off memory.

e: maybe I'll add in a sample usage code when I make it nicer.
 

Attachments

  • anp.htm
    4.1 KB · Views: 28
  • states.png
    states.png
    11.4 KB · Views: 40
  • warning.png
    warning.png
    363 bytes · Views: 31
Mar 7, 2012 at 3:28 AM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
I like to call this textbox ecstasy. Not really, that's a ridiculous name but whatever.

Exploring the wonders of Textbox.pbm
---------------------------------------------------------
Textbox.pbm is a fun file in the data folder of Cave Story that allows you to change many things relating to the UI of Cave Story such as healthbar and experience bar colour and design, pause menu text colour and design, message box colour and design, etcetera. It's pretty much restricted to cosmetics of the UI.

Before you work on anything in the data folder of Cave Story, make sure that (if you're using Cave Editor) you check the box in the game settings menu that says "remove ©Pixel requirement". Otherwise your edits will fail and your .exe will not load. If you are not using Cave Editor then stop using Sue's and convert to Cave Editor this instant you rebel penguin.
p148890-0-rqufl.png

Just check the box.

First off, you'll need to convert the Textbox.pbm file into a bmp/png file, which is easily done by clicking the file name (as if you were changing the name of the file) and just changing the extension to bmp or png. Note that when you're done you'll probably have to re-convert it to .pbm unless you're really cool and have your mod configured to use .bmp files.
Now let's take a look:
p148890-1-bdw4d.png

All you have to do is change the colour or style of any of the different "parts" of the file, then save it and re-convert it to .pbm. Your changes will be carried over once you load the .exe (if you have the game open you must close the game then reopen it again, not just reset it).

Each "part" of the file is separated by an invisible rectangular border that dictates which "part" you're playing with. This separates, say, the AIR sign from the "version" text. The borders do not always fit the shape of each "part". For example, the message box's borders are at the edges of the textbox itself but in a rectangular pattern - they do not go in a zigzag pattern like the message box itself does. It isn't too hard to figure out where each "part's" borders are, but sometimes it's not as obvious and you have to play around with it to see what happens.

Quite a few parts of the file aren't exactly obvious, and so I will tell you what these parts do.
At the top, there is a big blue box. That box is used for messages ingame, and is what text from the <MSG command appears in. You can change the shape or colour of it (or any other part of the file) if you want. An interesting idea may to completely remove it and replace it with black to have an invisible message box for your game, like with <MS2.
Next are the three bars under the message box. The first two show the current and maximum health of a boss, and the third formats the player's health bar.
The symbols directly under these bars show various things: the word "boss" beside the boss health bar, the heart beside the player's health bar, the + and - shown along with a number showing how much damage you've taken or experience you've gained, the circle that appears in a message box instead of the = sign, and the slash that separates the current ammo of the selected weapon from the maximum.
The numbers under these symbols are used for damage taken/experience gained, and for the version number on the Cave Story start menu.
The four bars under the numbers show your experience bar at different stages of "fullness."
The little shield beside the word "AIR" flashes on and off whenever you're underwater.
The rounded squares under the experience bar are shown in the Item Menu and show which item/weapon you have currently highlighted.
The four dots under the word "Version" are put in between each digit for the version number; for example, the version number could show 1.0.0.2.
The hands beside the dots point to either Yes or No in the Yes / No message box, depending on which option you have selected.
The clocks under these hands and the ' and " beside the clocks show the Nikumaru counter during the run through Hell in Cave Story.
See those tiny dots in the corner right underneath the message box? Those are used as the colours for the map system. if you change those to different shades of, say, red, the map system screen would become red instead of green.
One more stupid thing, on the top of the map system. The zero that is grouped with the numbers under the experience bar has a dangerous secret. Within it is the white dot that is used with the map system. I wouldn't recommend changing the zero's colour or removing it unless you want to change the colour of the map system or do something weird with it. It's white anyway, you wouldn't need to change it in most cases for a palette swap for the map system.

There are tons of things you can do with the Textbox.pbm file, so play around and make your mod unique! Just remember not to make things too weird, or players might get frustrated.
---------------------------------------------------------

Uhh I believe I used the term UI correctly but if not oh well noxid you know what I mean and can change it if you want and I need more commas in this sentence.
 
Mar 7, 2012 at 3:36 AM
Been here way too long...
Discord Group Admin
Org Discord Moderator
"Life begins and ends with Nu."
Join Date: Oct 18, 2011
Location:
Posts: 2335
I was scared that was an actual tutorial on message boxes at first, and all my hard work would be for naught. But you've forgotten about the extremely uncool kids that haven't removed the C Pixel requirement.
 
Mar 7, 2012 at 3:46 AM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
Thanks a lot, I updated it. I completely forgot about that.
 
Mar 10, 2012 at 3:09 AM
Been here way too long...
Discord Group Admin
Org Discord Moderator
"Life begins and ends with Nu."
Join Date: Oct 18, 2011
Location:
Posts: 2335
Message Boxes. Post form:​
Message Boxes
By Dunc2403
Getting Started
Note: CS will always mean Cave Story in this guide.
You may think that message boxes would be the easiest things ever in TSC, but you're wrong. And I mean really wrong. Well, I may be exaggerating a bit here, but it can be difficult if you don't know what you're doing. It could also make your mod explode in the badly wrapped text of your message boxes, half of it unreadable because of faces. But we can prevent that!
To get started, simply copy and paste the following TSC into event #200 on the Start Point map with your preferred CS editor and run CS, then choose New. The message boxes should do as they say.
Code:
<KEY<MSGThis is a message box.<NOD<CLR<MS3This is a message box on top of thescreen.<NOD<CLR<MS2This is an invisible message box
on top of the screen.<NOD<END
You may be wondering why there isn't a space between the "the" and the "screen" on the second message box. That is because CS' text wrapping system doesn't get rid of whitespace, like you may be accustomed to because of MS Word or the like. If you counted, you would be able to tell that CS' message box can only fit 35 characters on one line. (An exception to this is when you have a fecpic in the message box, but we'll get to that later.) Beyond that, it will go to the next line, which is usually good, but it can mess with some sentences, so always remember that. A big mistake you might make is making a carriage return after exactly 35 characters. That may be what you want to do, and it may seem like it should be that way, but it isn't. It will end up looking like this.
diph.php

Do you see the problem? There's two line breaks, not one! This is because CS wraps whitespace, including carriage returns. Now, you can actually start learing how this stuff works! I'm only going to describe the dedicated message box commands, so not all the commands in the sample code are going to be explained. But that's fine, you can find that stuff in any genereal TSC tutorial. I'll break the commands down to make it easier to understand.
<KEY
Okay, I lied. But this command should always be used before a message box! (Or <PRI.) That is, unless you're experienced and know exactly what you're doing if you don't have one of these commands. This is a simple command. (In fact, all but the <FAC command are, and that only has one paramater.) No weird syntax, and the only feature you're likely to care about if you're reading this guide is that it stops you from moving, and only you. That's what makes it diferent from...
<PRI
This command is pretty much the same as <KEY, except that it stops everything.
<MSG
This is yet another no-paramaters command. Simply opens a message box at the bottom of the screen. You'll be using this for most message boxes. The other two are...
<MS2 and <MS3
These two have the same paramaters as <MSG. (hint: nothing.) The only difference is these two appear on top of the screen, and that <MS2 appears to be just text, with no message box. Although it may appear to have none, it is simply invisible. Don't beilieve me? Put this bit of script in, and I can prove it.
Code:
<MS2<FAC0001This is a test.<NODaaaaaaaaaaaaaaaaa<NODaaaaaa<NOD<END
Now if you were good and tested that, you would see that one of the <NODs went out of the message box, but you couldn't see the text! That alone proves there is a message box when you use <MS2, even if you don't see it. And I'm sorry if you did believe me, but things like this are pretty much mandatory in a guide like this.
<NOD
This command is your best friend. It is. Don't even try to argue, without this command your mod's dialog will suck because people won't be able to stop and read it. And that's what this command does! It makes the text stop until the player presses either their shoot or their jump button.
<CLR
This command is really useful in dialog, especially when you have faces. It clears the message box of all text.
<CLO
This command wasn't in the sample script, I know, but all it does is close the message box. It's useful in cutscenes.
<END
This one's pretty self-explanatory. Marks the end of an event. (You can write notes in TSC by putting them after an <END.)
The only command left that a beginner modder needs to know is the <FAC command. This brings us to our final section, which is...
Faces
What I think is the most annoying think about message boxes in CS is faces. Sure, it's cool to see a mega-res version of the person you're talking to's face, but boy are they a pain. The following bit of code is a simple message box that scrolls through all the faces in regular CS. Do the same with this as you did (or should have done) with the different message boxes code.
Code:
<KEY<MSG<FAC0000<NOD<FAC0001<NOD<FAC0002<NOD<FAC0003<NOD<FAC0004<NOD<FAC0005<NOD<FAC0006<NOD<FAC0007<NOD<FAC0008<NOD<FAC0009<NOD<FAC0010<NOD<FAC0011<NOD<FAC0012<NOD<FAC0013<NOD<FAC0014<NOD<FAC0015<NOD<FAC0016<NOD<FAC0017<NOD<FAC0018<NOD<FAC0019<NOD<FAC0020<NOD<FAC0021<NOD<FAC0022<NOD<FAC0023<NOD<FAC0024<NOD<FAC0025<NOD<FAC0026<NOD<FAC0027<NOD<FAC0028<NOD<FAC0029<NOD<END
That's every face in the game. That looks fine, right? So what's bad about them? The fact that they have the same rules for text wrapping as when there is no face. That is to say, it still wraps at 35 characters, not the 27 that fit in the message box when there's a face.
Wow, <FAC is the first message box command that takes paramaters! (Unless you count the text for <MSG, <MS2 and <MS3, but that's not actually TSC paramaters. TSC paramaters are four characters or CS will kill you.) The syntax for <FAC is <FACXXXX. The paramater is the index for the face you want. The first face is at index 0, but it is nothing, and is used if you have a dialog between characters, one with a faceset, and one without. The next ones are indexes 1, 2, 3, 4, etc. And that's it! The only problem is the wrapping. You have to remember that you DO have to put a line break at 27 characters, unlike when you don't have a face and it does it for you.
Conclusion
If you want to see an excellent example of a mod with bad text wrapping, see this mod.
Thanks for taking the time to read this!
HTML form: [attachment=183:Message Boxes.html]


EDIT: I'm making one that's more advanced, too.
 

Attachments

  • Message Boxes.html
    7.9 KB · Views: 11
Mar 10, 2012 at 10:25 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
Importing these guides into the editor presently, keep em' coming guys
Lunarsold, could you provide a paragraph or two detailing what each part of the image in textbox.pbm might be, some of it is not especially obvious like the green dots in the corner, and also the fact that the white dot for the map system is part of the zero.
 
Mar 11, 2012 at 1:14 AM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
I knew who you meant, nox. I just forgot to post here. I'll put in anything I can about the contents when I have time.

Also I didn't know that about either of the things you said. What are the green dots for?
 
Mar 11, 2012 at 1:24 AM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
The map system, of course. Changing those changes the colour of the map; remove them and it won't work at all.
 
Mar 11, 2012 at 1:58 AM
Offensive User
"Big Joe Tire and Battery Restaurant! Opening Soon! Eat at Big Joes!"
Join Date: Sep 7, 2011
Location: IT'S TIME FOR A SHAQDOWN
Posts: 539
So I made a tutorial on how to replace the music files.
Can be found here: http://dl.dropbox.co...add%20songs.htm
I'm also attaching a zip if I decide to delete the file above me anytime soon.

I'm also going to post it in a more poasty form too.
How to Add Your Songs into Cave Story
Now, before we get started with this, let’s take note of Sue’s Workshop. Sue’s allows people to add their songs made in OrgMaker, but for the most part, it’s broken. It will corrupt your executable, and you will be unable to play your mod. I highly advise that you do not use Sue’s Workshop for replacing songs.

Speaking of which, if you are using Sue’s, then changing the game’s music should be the last thing that you do, because Sue’s Workshop will not recognize your .exe, and you will not be able to edit your mod.

Also, if you plan to use OrgMaker v2 for your music, make sure that you don’t use any of the new special drums. Make sure that you only use these drum tracks: bass01, snare01, hiClose, hiOpen, Tom01, and Per01. Make sure that you don’t use any other drum, or else it will cause your game to crash.



Now with all of that out of the way… We have to get a program to edit the Cave Story’s resources in the .exe file, which is where we can find the credit illustrations, various bitmaps, and, most importantly, the .org files that we want to replace! Yay! Now, as for the program, I use something that’s simply called Resource Hacker (which can be found here: http://www.angusj.com/resourcehacker/). For the sake of this tutorial, I will be using referring to this, so instructions on how to would vary from resource hacker to resource hacker.


So let’s get this started…

1. Install your resource hacker of choice if you have not done so yet.
2. Right-Click on Doukutstu.exe and click “Open Using Resource Hacker.” It should be the second option from the top under “Open.”
3. Resource Hacker will open. Expand “ORG” by clicking on the little “+.” This will reveal all of the songs in the game.

p148897-0-zqjt4.png
4. Expand one song by clicking on the little “+.” Click on 1041 and you will see some hex on the side. For this case, we will be changing the music that plays in the cemetery.
p148897-1-nvrcr.png
5. Right-Click on 1041. Click on the fourth option “Replace Resource.” I will be using Jackalope’s 8bit Green Hill Zone as an example (which can be found here), so kudos to her.
6. A new window should appear. Click on “Open File With New Resource…” in the new window and select your file.

p148897-2-nihnd.png
7. Now we are presented with three textboxes. Since we have an .org file, we want to fill ORG in the Resource Type. The Resource Name would be the names like ACCESS, CEMETARY, FANFALE1, etc. Keep Resource Language blank and click on “Replace.”
p148897-3-7niut.png
8. Click on File->Save and you are good to go!


Also, a quick note for Resource Hacker, it creates a modified .exe and saves the original. If you are editing Doukutsu.exe with Resource Hacker, there will be a Doukutsu.exe (the modified one), and Doukutsu_original.exe (the original).
 
Mar 15, 2012 at 4:06 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
If anybody has worked with credit.tsc before, that'd be a tutorial we probably need.
I would write it myself but I've never needed to modify it before :momo:
 
Top