[XP]Battle System Editing

Basically, what I have is a very simple sideview script that I found on another forum a while back, but there's a problem with it's built-in HP and MP gauges: whenever MP is 0 for any battler on either side, the game crashes and the error is on line 30.

I want to know how I would go about fixing this, since the script is not commented properly, I can't find exactly where it is to fix.

The Code

If someone more RGSS literate would look over the code for me and tell me how to fix it, I'd be very appreciative! :cheers:

EDIT: Now I have another problem. The script makes no provision to notify the player of a level up. What should I do?
It didn't crash for me in a blank project. Do you have other scripts installed? If so, which ones affect the Bitmap class? (Search all scripts (Ctrl+Shift+F) for "class Bitmap")
Not when MP hits zero, when MAX MP is zero.

I have no other scripts editing the bitmap class.
Oh, sorry. That makes sense, I guess, it's pretty much a divide by 0. What do you want it to do instead? Have a full bar, empty bar, or no bar at all?
I want it to have a full bar if MAX MP is zero.
Go to line 743 and change
  1. rate = i.to_f / @battler.maxsp
Expand to see the code.

to (only the first line)
  1. rate = ((@battler.maxsp == 0) ? 1.0 : (i.to_f / @battler.maxsp))
  2. # the above is a short way of doing
  3. #   if @battler.maxsp == 0
  4. #     rate = 1.0
  5. #   else
  6. #     rate = i.to_f / @battler.maxsp
  7. #   end
Expand to see the code.

Which says if the battler's maxsp is 0 it uses the full bar (rate = 1.0), otherwise it does things the normal way (current sp / max sp).

If that doesn't work or you have a question about it, say so.
no error! Thanks! :cheers:
I'm bumping this topic because I have another question.

I've put it in my first post and removed the resolved note in the title.
Bump.
Bump
Metatron wrote:
EDIT: Now I have another problem. The script makes no provision to notify the player of a level up. What should I do?
Note that this isn't game design support... you should know how you want your player to be notified of a level up (for example, RMXP's default, while not being completely bad, still sucks ;) )

So, as soon as you know what you want, you know what you need for that: A modified window, probably another window, an animation played, SE or ME playback, sprite display, stats being displayed, nude chicks dancing on poles, ... that's when you can come again and ask for script support ;)
I would prefer a modified window to notify the player that the characters have leveled up.
bump
bump
bump
Metatron wrote:
I would prefer a modified window to notify the player that the characters have leveled up.


...Perhaps it would help if you, I don't know, mentioned how you wanted it to look/work/etc.? >.>
Ok, I've decided I want a window in the bottom left-hand corner of the screen to show up with the name and stats of the character that leveled up, plus the improvement.

So...

  1.  
  2. [Name] Level Up
  3. LVL 1 > 2
  4. STR 1 > 2
  5. DEX 1 > 2
  6. AGI 1 > 2
  7. INT 1 > 2
Expand to see the code.


Or something like that.
bump
can you give me an idea where on the screen you want all this?
bottom left-hand corner please
like option a or b?
Image
B, since the script does away with the dms' battlestatus screen.

And I forgot about skills. I want a notification when a new skill is learned, just like "New Skill" or "Learned X"
so i have the mock up working, but im trying to get the operational code to work, however the code you have posted doesnt work for me, it doesnt crash but none of the players can attack(so obviously i cant win a battle to test), is there more to the code?
You can't use actor number 1.

I'll re-upload the code I have in my project right now.
feckit send me a demo of whatever battle system and junk you're using and I'll make it for you >.>:
Umm... there's one more thing.

I, without thinking, wrote a character that uses ranged weapons, even though I know this battle system doesn't have a way to stop character movement easily.

I'd rather not rewrite the character, so I wonder if someone could write an addon to stop a character from moving if equipped with a weapon with element 14?

(I probably shouldn't have used super-simple sideview, but I've put so much effort into it now, I'd rather not switch.)
bump?

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=66163