Dec 12, 2011 at 2:52 AM
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
<BOA (for map bosses) and <BSL (to make the healthbar)
Also, if you have simple script questions, please try to see what pixel did before asking.
 
Dec 12, 2011 at 3:42 AM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
Alllllllll right.
I made some decent PROGRESS today. I made an almost working scenario in which one's health can be fully restored upon 0 or negative health, under certain conditions.
My problem: if these conditions are not met, then upon 0 or negative health the pc screws up and shows zero health, and invincibility is murdered. I think I can pinpoint the location of the problem, but I have no idea what's wrong, everything seems normal to me.

I'm not on a compy, but this is basically what the code is:
(Note the addresses will not be exact, but that's because I'm on a blackberry and can't look em up. Just imagine they're in the right place. Also note that at the beginning of the code, EAX points to DWORD [49EBCC](current health).)
Code:
41B832         CMP EAX,0
41B833         JG 41B846
41B834         JMP 48B905
41B846         ----------------            ;This is the end of the take damage function, I forget what the commands are.
...
48B905         PUSH 2B
48B906         CALL 421990          ;Calls event 43, where "conditions" are checked, if so <LI+1000
48B907         ADD ESP,4
48B908         MOV EAX,DWORD [49EBCC]
48B909         CMP EAX,0
48B910         JG 41B846              ;If conditions are met, then end take damage function
...                                            ;The rest is basically just the death part of the take damage function, and then...
48B920         JMP 41B846            ;End take damage function

Anyone spot the problem?
 
Dec 12, 2011 at 3:45 AM
Senior Member
"Huzzah!"
Join Date: Aug 10, 2011
Location:
Posts: 222
I'm sorry it's just that I've still not got the hang of modding, and I usually don't get much time, so I forget the complicated parts I already know. I might upgrade to a newer computer in my room, so I can mod more often there. :critter:
 
Dec 12, 2011 at 3:50 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
linkruler said:
I'm sorry it's just that I've still not got the hang of modding, and I usually don't get much time, so I forget the complicated parts I already know. I might upgrade to a newer computer in my room, so I can mod more often there. :critter:

That doesn't really justify a complete disregard for solving problems yourself though
there are an infinity of resources you can use to see what should be done before asking here such as maybe even experimenting!!!
yes it's scary I know but we all must be bold in the face of progress.

and since I'm posting anyway
Code:
void __cdecl TakeDamage(int damage)
{
  if ( GameState | 2 )
  {
    if ( !invincTimer )
    {
      PlaySound(16, 1);
      PlayerFlags &= -2u;
      invincTimer = 0x80u;
      if ( InFishBattle != 1 )
        PlayerYVel = -0x400u;
      currentHealth -= damage;
      if ( EquippedItems & 0x80 )
      {
        if ( numWhimStars > 0 )
          --numWhimStars;
      }
      if ( EquippedItems & 4 )
        weaponEnergy[5 * currentWeapon] -= damage;
      else
        weaponEnergy[5 * currentWeapon] -= 2 * damage;
      while ( weaponEnergy[5 * currentWeapon] < 0 )
      {
        if ( weaponLevel[5 * currentWeapon] <= 1 )
        {
          weaponEnergy[5 * currentWeapon] = 0;
        }
        else
        {
          --weaponLevel[5 * currentWeapon];
          weaponEnergy[5 * currentWeapon] += *(&dword_493660[3 * weaponType[5 * currentWeapon]]
                                             + 4 * (weaponLevel[5 * currentWeapon] - 1));
          if ( currentHealth > 0 )
          {
            if ( weaponType[5 * currentWeapon] != 13 )
              CreateEffect(PlayerX, PlayerY, 10, 2);
          }
        }
      }
      createNumObj(&PlayerX, &PlayerY, -damage);
      if ( currentHealth <= 0 )
      {
        PlaySound(17, 1);
        PlayerFlags = 0;
        createExplosion(PlayerX, PlayerY, 5120, 64);
        runTsc(40);
      }
    }
  }
}

There's the takeDamage function (roughly) converted to C
have fun
 
Dec 12, 2011 at 3:55 AM
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
MagicDoors said:
Anyone spot the problem?
well for one thing, [49ebcc] aint the current health, [49e6cc] is.

Other things:
Code:
[B]BAD THING THE FIRST[/B]

jg A
jmp B
A ...

that is stupid. don't do that. use instead:
jle B
...


[B]BAD THING THE SECOND:[/B]
push 2b
call 421990

unless you're REALLY tight on space, don't use tsc. the assembly version simply isn't that much more confusing, and is a heckofalot faster.
also note that invincibility is removed when you run tsc, which is what's causing that problem (the offender is at 0x4219f2)


[B]BAD THING THE THIRD:[/B]
mov eax, [49e6cc]
cmp eax, 0

you don't need that extra step, dawg:
cmp [49e6cc],0
 
Dec 12, 2011 at 3:56 AM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
Sorry about that. I think BCC is the last 3 characters for the SelectedWeaponID, or something.
EDIT: That is NOT the problem. Doing that wouldn't get me near as far as I am currently.
 
Dec 12, 2011 at 4:06 AM
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
I revised my post. Look again.
Your problem is running a TSC event.

(also note that when you call it it doesn't go immediately, it has to wait a tick or so I believe)
 
Dec 12, 2011 at 4:12 AM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
Lace said:
Code:
[B]BAD THING THE SECOND:[/B]
  push 2b
  call 421990

unless you're REALLY tight on space, don't use tsc. the assembly version simply isn't that much more confusing, and is a heckofalot faster.
also note that invincibility is removed when you run tsc, which is what's causing that problem (the offender is at 0x4219f2)
I need to check for an item to see if the conditions are met, though. Also it'll look weird if the player's health is randomly refilled...I guess I could say "life refilled" after everything else is finished.

Lace said:
Code:
[B]BAD THING THE THIRD:[/B]
you don't need that extra step, dawg:
  cmp [49e6cc],0
Really? Cool.

Hmm...maybe I can make a <DIE command that kills the player if all else fails.
 
Dec 12, 2011 at 4:18 AM
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
Well, keep in mind that TSC does not invoke immediately. Check if conditions are met with assembly (noxid's compendium should tell you how to do this) and tell the character that their health was refilled afterwards.

Those would be my suggestions.
Take them as you will.
 
Dec 12, 2011 at 4:22 AM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
Sorry, uh
MagicDoors said:
I need to check for an item to see if the conditions are met, though.
I meant that I'm not sure if there's a RAM offset or something that checks what items you have or something. In other words, I don't know how to do an <ITJ in assembly.
 
Dec 12, 2011 at 4:26 AM
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
Well what is stopping you from going to <ITJ's offset and seeing how it does it?
 
Dec 12, 2011 at 4:26 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
because looking at the <ITJ command's code would be KRRAAZY!

@ your response of "I don't know where it is"

because someone cataloging and publicly posting a list of almost every function in the game and a good portion of the memory map would be KRRAZY!
 
Dec 12, 2011 at 4:30 AM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
Uh-huh. I can't find it in the compendium.
 
Dec 12, 2011 at 4:34 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
00499b40 Inventory[0x00] 0x04 x 0x20 in size.

00422510 - TSC Parser

can you read without assistance?
for the first one I literally hit ctrl-f for "item". It wasn't even the right word but it was nearby.
 
Dec 16, 2011 at 3:58 PM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
Huzzah said:
Edit: I found it, it's for Cave Editor which works terribly on my computer. I can only use Sue's Workshop, is it possible to link a custom made map to a custom made map in Sue's Workshop?
You shouldn't use Sue's Workshop. :/

BoringToaster said:
For the record, you can make chests work without flags. Just use CNP to change the closed chest to an open once you run the chest's script, and ITJ/AMJ at the beginning of the script to make it jump to 0001, the "Empty" message once you have whatever's in it.
This assumes that the item in the chest will never be lost at a later time.

Noxid said:
Good thing the internet is made of backups
Heh, nice one. :p

Lace said:
for the record, the special bosses are the ones which are tied to specific maps. <BOA essentially sets the boss's scriptstate. unless you know assembly, use wwpd to figure out which number to use.
Sounds like someone needs to make a list! :p

Noxid said:
There's the takeDamage function (roughly) converted to C
Why are you using MSVC extensions (__cdecl)? :/
 
Dec 16, 2011 at 4:23 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
Celtic Minstrel said:
Why are you using MSVC extensions (__cdecl)? :/

because I actually made IDA decompile it and then I just filled in the names of functions / variables to make it a bit more human-readable.
I have found doing the whole thing by hand to be not only more time-consuming, but also more likely to introduce errors.
 
Dec 17, 2011 at 7:57 AM
Novice Member
"Officially Worth 1 Rupee"
Join Date: Dec 17, 2011
Location:
Posts: 1
Noob In need of some advice about basic modding..

I'm new to the board, and Yes, I have taken the time to read the stickies, but they have not been any help to me.

Anyway, I've recently gotten into modding CS and I'd like to learn more about it.

But I can't seem to find any helpful very basic tutorials on modding and scripting out there (I'm using CaveEditor by the way) and yes, I've tried using google, but I still can't find anything helpful.

Maybe some of my questions can be answered here, If not I'd be happy if someone could point me in the direction of a beginner's tutorial for modding.

My questions:

1: How does one place an existing enemy NPC in a map, (what are the necessary flags, events and entity ID's to make an enemy actually do as its supposed to and show up in a map.) Example: Making a bat move up and down, or making an enemy move, or making the enemy entity show up at all

2: How do I create doors that lead the character to another map.

3: How do I script or make a chest give you an item.


Please, remember i'm a beginner to this, so please try to be patient and understanding.

Thank you. :sun:
 
Dec 17, 2011 at 2:55 PM
graters gonna grate
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jul 2, 2008
Location: &
Posts: 1886
Age: 31
Re: Noob In need of some advice about basic modding..

How closely have you read the stickies? I'd recommend Noxid's beginner's guide, which, as I recall, is fairly easy to follow, and answers all of your questions.
 
Dec 17, 2011 at 3:28 PM
Senior Member
"Huzzah!"
Join Date: Jun 28, 2010
Location: Scotland
Posts: 205
Age: 34
Re: Noob In need of some advice about basic modding..

Best advice i can give you is slow down. You'll learn more if you take your time with it. The stickies and all the guides that have been made are your best bet. That, and experimenting with cave editor with a spare copy of Cave Story. This stuff will take a bit to get your head around, so set aside some time for this.
 
Top