Jul 21, 2011 at 9:36 PM
Senior Member
"Wahoo! Upgrade!"
Join Date: Jul 13, 2011
Location: Submerged in the colour orange
Posts: 63
LunarSoul said:
You could JMP SHORT from the code to a free spot a shorter distance away, then JMP SHORT again to another spot, and so on until you have enough room to either put your code in or put in a JMP to the free space at the end of the code.

That's a good idea, but I can't imagine there being enough free space that's close enough for the JMPs for all four directions for the bullet. :( I could probably manage it if I knew a thing or two about optimizing the code like Lace said, but I don't. I'll try the simplifying to ADD DWORD PTR DS:[EAX+18],5 thing and, if it doesn't work like I'd like it to, I'll look further in to how to optimize. o:

EDIT:
Here's an interesting thing:
MOV DWORD PTR DS:[EAX+18],500 and
ADD DWORD PTR DS:[EAX+18],500 seem to do the exact same thing. ADDing doesn't seem to add every frame like it's supposed to... Or maybe something is equalizing it somewhere else in the bullet's code?
 
Jul 21, 2011 at 10:54 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
Jumping to the padding directly above and below a function is normally a good spot for free space.
And optimization isn't difficult, even for a beginner. Just look for superfluous commands and consolidate them. Also look at carrots assembly tips (in his guide) or the thread of the same topic we have in these very forums.

You can't be good at something if you don't try.


Edit: On the topic of your edit, have you checked to see if it really is the same?
 
Jul 21, 2011 at 11:03 PM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 30
Orange said:
EDIT:
Here's an interesting thing:
MOV DWORD PTR DS:[EAX+18],500 and
ADD DWORD PTR DS:[EAX+18],500 seem to do the exact same thing. ADDing doesn't seem to add every frame like it's supposed to... Or maybe something is equalizing it somewhere else in the bullet's code?

It's probably only running it once then, so you'll need to figure a way to run it every frame.
 
Jul 25, 2011 at 2:32 AM
Junior Member
"It's dangerous to go alone!"
Join Date: Aug 27, 2009
Location: Oregon
Posts: 33
I have a question.
Is there a limit to the amount of code that can be put on a single map?
The game I was modding had an error where Sue's Workshop froze and quit every time I entered a certain map I was working on. (Running the game, enter door, Sue's Worksop laqs and quits, Windows 7) I had to delete the exe and restart work on using backup file I made. (I'm so happy I made a backup!). Is there a way to prevent game-breaking glitches like this? Is there a cause? I'm still able to work on my mod, but it is scary that I can loose progress so easily. For good measure, send me a list of DON"T (Don't do this, this, this,ect) so I can avoid making game-breaking mistakes in the future. Thanks Again!
 
Jul 25, 2011 at 2:38 AM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4485
Well, an overload of entities will cause your map to crash.
I don't think there's a limit to TSC, but I may be wrong.

I also have a question. Can you change the frames of a weapon while that game is open? (i.e. To make an upgraded version, complete with new images, without taking up an extra spot)
 
Jul 25, 2011 at 2:50 AM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 32
Backyardcabinxy said:
I have a question.
Is there a limit to the amount of code that can be put on a single map?
The game I was modding had an error where Sue's Workshop froze and quit every time I entered a certain map I was working on. (Running the game, enter door, Sue's Worksop laqs and quits, Windows 7) I had to delete the exe and restart work on using backup file I made. (I'm so happy I made a backup!). Is there a way to prevent game-breaking glitches like this? Is there a cause? I'm still able to work on my mod, but it is scary that I can loose progress so easily. For good measure, send me a list of DON"T (Don't do this, this, this,ect) so I can avoid making game-breaking mistakes in the future. Thanks Again!

There is a limit - a maximum of 20480 text characters for each script in each map (including line breaks, which count as 2 characters I believe).
Information Source: http://www.cavestory.org/forums/threads/934/
It is possible to change this, but you'd need to hack the executable.

I'm not sure why that happened with Sue's Workshop. I've never gotten such an error. Of course, I'm not using Sue's Workshop anymore so I can't give you specifics.

There aren't too many ways to fix problems with the editors unless you want to get real complicated. However, backing up is always a really good idea. Just make multiple copies of your mod folder and then delete the old copies later on.

Don't do this:
--If you ever use Cave Editor, do NOT set your Cave Story files to read-only. Make sure that you have unchecked read-only properties for the entire mod folder. (Use Right Click > Properties on the folder. Look under attributes and uncheck Read-Only)
--Do not use Cave Editor and Sue's Workshop on the same mod. They are not compatible. Even though some people say that SW -> CE is okay but not the other way around, this is not entirely true because game settings will not be read correctly by CE after editing with SW.
--Do not forget to make back ups!

===============
LunarSoul said:
I also have a question. Can you change the frames of a weapon while that game is open? (i.e. To make an upgraded version, complete with new images, without taking up an extra spot)

Yes.

Code:
[COLOR="Blue"][B]if [/B][/COLOR](weapon_is_upgraded_version)
[COLOR="Blue"][B]then[/B][/COLOR]
load framerect 1
load framerect 2
load framerect 3
etc...
jmp address A
[COLOR="blue"][B]otherwise[/B][/COLOR]
load different framerect 1
load different framerect 2
load different framerect 3
etc...
address A

Translate that to assembly.
 
Jul 25, 2011 at 6:13 PM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4485
I have one up on 4shared, I'll try and get the link.

EDIT: Got it.

EDIT2:
Lace said:
Code:
4102E5 ; y of start arrow 
4102F1 ; y of continue arrow
I can change these values, but I can't find the x values. Does anyone know how?
 
Jul 26, 2011 at 4:06 AM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 32
LunarSoul said:
EDIT2:
I can change these values, but I can't find the x values. Does anyone know how?

Look a bit lower in the code. The x values are PUSHed directly.

Code:
CPU Disasm
Address   Hex dump          Command                                  Comments
0041030F  |.  8B8D 0CFFFFFF MOV ECX,DWORD PTR SS:[EBP-0F4]           ; |
00410315  |.  51            PUSH ECX                                 ; |Arg3
00410316  |.  6A 74         [COLOR="Blue"][B]PUSH 74[/B][/COLOR]                                  ; |Arg2 = 74
00410318  |.  68 1CF94800   PUSH OFFSET 0048F91C                     ; |Arg1 = Game_Exec_for_Testing.48F91C
0041031D  |.  E8 9EC0FFFF   CALL 0040C3C0                            ; \Game_Exec_for_Testing.0040C3C0
00410322  |.  83C4 14       ADD ESP,14
00410325  |.  EB 21         JMP SHORT 00410348
00410327  |>  8B55 C4       MOV EDX,DWORD PTR SS:[EBP-3C]
0041032A  |.  52            PUSH EDX                                 ; /Arg5
0041032B  |.  8D85 FCFEFFFF LEA EAX,[EBP-104]                        ; |
00410331  |.  50            PUSH EAX                                 ; |Arg4
00410332  |.  8B8D 0CFFFFFF MOV ECX,DWORD PTR SS:[EBP-0F4]           ; |
00410338  |.  51            PUSH ECX                                 ; |Arg3
00410339  |.  6A 74         [COLOR="blue"][B]PUSH 74[/B][/COLOR]                                  ; |Arg2 = 74
0041033B  |.  68 1CF94800   PUSH OFFSET 0048F91C                     ; |Arg1 = Game_Exec_for_Testing.48F91C
00410340  |.  E8 7BC0FFFF   CALL 0040C3C0                            ; \Game_Exec_for_Testing.0040C3C0
00410345  |.  83C4 14       ADD ESP,14

Change those two PUSHes. I didn't test this but it should work.
 
Jul 26, 2011 at 4:12 AM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4485
Ah, thanks. I assumed that it was kind of the same as the MOV DWORD [EBP-0F4] stuff like the y values.
This'll help a bunch, thanks again!
 
Jul 27, 2011 at 4:45 PM
Senior Member
"Wahoo! Upgrade!"
Join Date: Jul 19, 2011
Location: Somewhere flying in the sky
Posts: 53
Question: Check Hell 2 Player thread.
I put two Cthulhu in the same position. One have flags 2800,and says "Password please". Another have flags 6000, and says "Passoword acepted", and then make a lift block below him that disapears with the Cthulhu. How I do to set a flag and then "delete" the Cthulhu that says "password please" and show in the same place the Cthulhu that says"passowords acepted", deleting the lift block with the flags 4000? You get the password by talking to Hermit Gunsmith.
 
Jul 27, 2011 at 4:50 PM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4485
Firehead said:
Question: Check Hell 2 Player thread.
I put two Cthulhu in the same position. One have flags 2800,and says "Password please". Another have flags 6000, and says "Passoword acepted", and then make a lift block below him that disapears with the Cthulhu. How I do to set a flag and then "delete" the Cthulhu that says "password please" and show in the same place the Cthulhu that says"passowords acepted", deleting the lift block with the flags 4000? You get the password by talking to Hermit Gunsmith.

You only need one with flag 2000. After talking to gunsmith, set a flag.
Use this code for the cthulhu:
#0100
<KEY<FLJXXXX:0101<MSGYou need a password.<NOD<CLR<END
#0101
<KEY<MSGPassword accepted.<NOD<CLR<END

Just remember to put in the code to activate the block in #0101. You can change the event numbers. Also, the XXXX is the flag you set earlier.
 
Last edited by a moderator:
Jul 27, 2011 at 5:00 PM
LSD
"..."
Join Date: Jun 2, 2011
Location:
Posts: 397
Age: 23
LunarSoul said:
You only need one with flag 2000. After talking to gunsmith, set a flag.
Use this code for the cthulhu:
#0100
<KEY<FLJXXXX:0101<MSGYou need a password.<NOD<CLR<END
#0101
<KEY<MSGPassword accepted.<NOD<CLR<END

Just remember to put in the code to activate the block in #0101. You can change the event numbers. Also, the XXXX is the flag you set earlier.

*Facepalm*
I forgot how easy that was.
Sorry Fire.
 
Jul 27, 2011 at 6:18 PM
Senior Member
"Wahoo! Upgrade!"
Join Date: Jul 19, 2011
Location: Somewhere flying in the sky
Posts: 53
I have trouble. It only worked once. And the lift block don't disappear. I set flags 0x2000 and 0x4000(0x6000). After talking to Cthulhu the he sets the flag 6000. Why don't work?
 
Jul 27, 2011 at 6:20 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
remember that "Appear when flag is set" is more like "Load when flag is set" in that it only really is considered when the map is loaded. This is a common misconception..

Use <DNP
 
Jul 27, 2011 at 6:20 PM
LSD
"..."
Join Date: Jun 2, 2011
Location:
Posts: 397
Age: 23
Can you give us the script for the map?
 
Jul 27, 2011 at 6:23 PM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4485
You don't need 0x4000. All you need is 0x2000 for the hermit and cthulhu.

Code:
#0100 (hermit's code)
<KEY<MSGMessage<NOD<CLO<FL+7999<END
#0101 (cthulhu's code)
<KEY<FLJ7999:0102<MSGBring me the password.<NOD<CLO<END
#0102
<KEY<MSGPassword accepted.<NOD<CLO<DNPXXXX<END
Where XXXX is the lift block's event #.
 
Jul 27, 2011 at 6:25 PM
LSD
"..."
Join Date: Jun 2, 2011
Location:
Posts: 397
Age: 23
LunarSoul said:
You don't need 0x4000. All you need is 0x2000 for the hermit and cthulhu.

Code:
#0100 (hermit's code)
<KEY<MSGMessage<NOD<CLO<FL+7999<END
#0101 (cthulhu's code)
<KEY<FLJ7999:0102<MSGBring me the password.<NOD<CLO<END
#0102
<KEY<MSGPassword accepted.<NOD<CLO<DNPXXXX<END
Where XXXX is the lift block's event #.

The Hermit and Cthulhu are on different maps.
 
Jul 27, 2011 at 6:27 PM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4485
Still works, just split the code up for the two maps.
 
Jul 27, 2011 at 8:30 PM
Senior Member
"Huzzah!"
Join Date: Jun 28, 2010
Location: Scotland
Posts: 205
Age: 32
This is probably a really dumb thing to have a problem with, but theres one persistent bug i cant iron out.

It's a chest. Functionally it does everything it's supposed to, giving you an item and realising it's empty, except it likes to close itself when the area is accessed again. It still states it has nothing inside, but the chest has to look like its opened. I'll list how i've set these things up

Entities:


"Treasure chest closed"
Event: 0153
PC presses down to activate
Dissapears once flag ID is set

"Treasure chest open" (positioned 1 tile above)
Event:0153
PC presses down to activate
Appears once flag ID is set
"Option 2"

Script:

#0153
<KEY<FLJ0153:0001<MSG
Opened the chest...<NOD<CLR<CNP0153:0021:0000<SOU0022<FL+0153
<CMU0010<ML+0002Your health has been upgraded!<WAI0160<CMU0009<NOD<CLO
<END

Ok so i interact with the closed chest. The flag being set makes it invisible and makes the open one visible in its place and gives me health. I reenter the area, i uncover the secret area using <CMP which covers both chests, and it's closed. Flag 0153 isnt messed with throughout the rest of the level script.

It all works, just the chest appears closed. I hadnt asked abotu it because it seems like such a simple thing, but it stopped me in my tracks before and has persisted ever since.
 
Top