Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

making a status effect deal percentage damage?

Right, simply put, I hate how Xp calculates combat damage. Rather than have things like poisons deal damage based on your character's level or anything, i'd rather have each spell that afflicts a status ailment be able to deal percent damage.
For example, there's two spells in my game.
The first is Poison. It should deal 2% of the target's health as damage on each turn.
The second is Toxic Corrosion. It should deal 3% of the target's health as damage on each turn, but also keeps their armour constantly reduced by 20% for the duration of the effect.

I'm really not sure how to change it to percent damage, there doesn't seem to be an option. Do I need a script for this? (I hope not. I can't script.)
 
They are currently set to % damage. Slip damage does ~10% per turn in battle, and 1% per every 2 steps on the map.

This will allow you to modify the percent per state in battle. If you want the same control on the map, let me know.

Paste above Main

Code:
 

class Game_Battler

  #--------------------------------------------------------------------------

  # * Application of Slip Damage Effects

  #

  #   Add variable slip damage per state

  #   Remove 15% variation

  #--------------------------------------------------------------------------

  def slip_damage_effect

    #----------------------------------------------------------

    # enter a state ID, and the percent of slip damage per turn

    #

    # for example, Venom 2%, Blink 3% would be

    #

    # { 3 => 2, 16 => 3 }

    #----------------------------------------------------------

    

    custom_slip_damage = { 3 => 2, 16 => 3 }

    

    # Set damage

    pct = 10

    for i in @states

      if $data_states[i].slip_damage

        if custom_slip_damage.include?(i)

          pct = custom_slip_damage[i]

        end

      end

    end

 

    self.damage = self.maxhp * pct / 100

    # Subtract damage from HP

    self.hp -= self.damage

    # End Method

    return true

  end

end

 

Ref: NNolund_world_map
 
That looks VERY promising! Thanks for the help, i'll see about slotting this baby in there.

EDIT:
This is VERY weird. I put the code in, tested it with my statuses
(1 was default for RMXP, 2 was toxic corrosion, 3 was poison)

It ran without causing any problems whatsoever, however reguardless of the fact TC does 3% and Poison does 2%, on an enemy with 200 HP, both of them did 19-20 damage. Which is wrong. 2% of 200 is 4. 3% is 6.

I decided to edit some more statuses so that I could test for sure. States 7, 8 and 9 became percentage effect items. I edited these in precisely how the script explains on line 18 of the script.
when I went to test battle, I get the error line 2: Syntax Error occurred.
Line 2 is nothing other than class Game_Battler.
It had not been edited at all. It worked before, why not now?
Anyway.
I deleted the entire script, then put in the version copy-pasted from yours, and it's STILL giving me a line 2 syntax error.
I didn't touch line 2.

I delete the script ENTIRELY from the database, try to test battle, and it still says that the script has a line 2 syntax error. The script doesn't EXIST!

What's happening?
 
Are you sure it's not erroring on line 2 of another script.

Try again, with a brand new project, and recopy the script from above. It was missing a [ i ] because the forum parsed it as an italic tag.

I just tested it again to be sure. I set the enemy actions to "do nothing", set the state "Venom" on Aluxes, and "Defended" every turn. He starts with 771 HP, and it was doing 14 damage each turn.

You do understand that "Paste Above Main" means select "Main" in the script editor, Right-Click -> Insert, then paste the script in the new page above Main?
 
It was a new project to start with, no other scripts in there (i'm bad with them so I haven't used any before this) and it was saying the error was on line 2 of "Custom Slip Damage", which is what I named the page that i'd inserted above main.
I'm confused as to why it didn't cause an error when testing it at first, but it did when i'd added some more.
Could it be because I put it so the status effect was unblockable? Just trying all the options here.

I'll be completely honest and say I know nothing about scripts. Common Events, Variables, Fork Conditions and Switches i'm fine with, but RGSS has always given me a bit of a headache to understand.
Which is a shame, as my project is going to need quite a bit of intensive scripting for the features I want.
 
here's a fresh project with it in. Sadly, I could only get it to upload to Rapidshare. Hope that's good enough, man.
http://rapidshare.com/files/192650169/FP2.exe.html

Before I begin, I must apologise for being such a nuisance.
This is kind of worrying for me, as i'm going to need a -lot- of script to make my game, and this one's seemingly simple and I can't do it right.

Changes made to game:
002 state changed to "Poison"
003 (Venom) state changed to "Toxic Corrosion"
Skill 033: Venom changed to "Toxic Corrosion"
New skill added: Poison, influcting status 003.
Monster: Ghost HP set to 100, so we can get a CLEAR percentage.

Changes made to code:
Line 18 custom_slip_damage = { 2 => 3, 3 => 2 }

Added to a new script entry, added directly above main, titled Custom Slip Damage.

Error:
Both skills still dealing 10 damage each. Which... is default, I think. It's as if the game is now ignoring the code.
Which is what it did on my old game project, and then when I tried to edit the three other skills in, it errored, causing combat to become useless.

Also, if I do at any point get a cbs, this script can be called on, right?
 
I copy-pasted it without the lines, put it back in, and presto, syntax error line 2.

What's interesting, is that I then deleted the blank line one, so that line two is the part the program ignores, and line one is the one with class Game_Battler.
And it still believes theres a syntax error on line two.

Why is this not working for me? Is 1.02a a bad version of the maker?
 
I think 1.02a is the only version released for the legal english RMXP.

wierd thing is, I did the same thing. Copied the script from above in this thread, and it works just fine in your project.

I'm stumped.
 
Well, this certainly doesn't bode well for the project.
hrm.
Don't suppose you'd have the spare time to sit down and work on a project with me? I know it's asking much, but this weird scripting thing puts everything i've got planned at stake.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top