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.

Defend command during battles

------------
USING RMXP
------------

Another question from super noob about scripting here :]
The 'Defend' command in battles.
Is there any way to change how powerful full it is?
Or is there any way you could make it that, when defending, if you get attacked, you lose abit of 'SP' instead?

Thanks in advance
 

kkxkn

Member

Yes, it's possible. In game_battler3, look in the attack_effect and skill_effect sections. Look for this section:

Code:
        # Guard correction
        if self.guarding?
          self.damage /= 2
        end

(there's also some other stuff on the if line for the one in skills)

Change the damage modifier there.

Making it an SP loss instead is a bit more complicated.

Try this:

First, delete the sections I posted above.

Find in both of them, this code:
Code:
last_hp = self.hp
      self.hp -= self.damage
      effective |= self.hp != last_hp

And replace it with:

Code:
	if self.guarding?
		last_sp = self.sp
	    self.damage /= 10
		self.sp -= self.damage
		effective |= self.sp != last_sp
	else
		last_hp = self.hp
		self.hp -= self.damage
		effective |= self.hp != last_hp
	end

Remove the self.damage /= 10 line if you don't want the damage to be less when it hits SP.
 

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