Weakness Stun

Chaos Avian

Abyssal Wing
Restaff
Joined
Jul 16, 2012
Messages
3,231
Reaction score
784
First Language
English
Primarily Uses
Hi there, I've been wanting to make hitting a weakness create the benefit. Like Persona 3 and 4, where hitting a weakness gives you another turn except I want to make the result of hitting a weakness a chance of stunning rather than an extra turn. I do have an Ace version of this and I'm hoping if anyone would be willing to convert it into an MV plugin. The code itself is short and I'd gladly appreciate a port~

((EDIT : I just saw you wanted the effect to be a CHANCE to stun upon hitting a weakness.  You can do this by changing the self.add_state(33) line to the following:


if rand(100) < 40 (or whatever percentage you want instead of 40)


self.add_state(33)


end
Code:
class Game_Battler < Game_BattlerBase  #--------------------------------------------------------------------------  # * Get Element Modifier for Skill/Item  #--------------------------------------------------------------------------  def item_element_rate(user, item)    if item.damage.element_id < 0      the_rate = (user.atk_elements.empty? ? 1.0 : elements_max_rate(user.atk_elements))    else      the_rate = (element_rate(item.damage.element_id))    end    if the_rate > 1.0      self.add_state(33)    end    return the_rate  end end
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English
Did you make that edit? seems a bit strange.


Anyways what does it mean for someone to be weak against something?
 

Chaos Avian

Abyssal Wing
Restaff
Joined
Jul 16, 2012
Messages
3,231
Reaction score
784
First Language
English
Primarily Uses
I just copied the code from the Ace topic. Came out weird I guess. And by weakness I mean if you use an attack that an enemy is weak against. For example you use Fire on Slime, Slime is weak to Fire therefore is afflicted with a state upon taking damage.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English
By default, when working with element rates, 100% means no change.


Anything higher than 100% means they take more damage.


Anything less than 100% means they take less damage.


Would this be the basis for weakness/strength? If the selected element rate is greater than 100%?


var TH_GameAction_calcElementRate = Game_Action.prototype.calcElementRate;
Game_Action.prototype.calcElementRate = function(target) {
var rate = TH_GameAction_calcElementRate.call(this, target);
if (rate > 1) {
target.addState( 30 )
}
return rate;
};


This is what the snippet you've provided is basically doing.
 
Last edited by a moderator:

Chaos Avian

Abyssal Wing
Restaff
Joined
Jul 16, 2012
Messages
3,231
Reaction score
784
First Language
English
Primarily Uses
Would this be the basis for weakness/strength? If the selected element rate is greater than 100%?


No I didn't make the edit (I don't know why the code formatted itself that way...), but yes this would be the basis for weakness/ strength.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English
No I didn't make the edit (I don't know why the code formatted itself that way...), but yes this would be the basis for weakness/ strength.
The snippet I provided might do the trick.
 

Chaos Avian

Abyssal Wing
Restaff
Joined
Jul 16, 2012
Messages
3,231
Reaction score
784
First Language
English
Primarily Uses
Awesome, it does the job perfectly!~ Though how would I add a percentage chance like 35% for example? I'm using Stun as the state to inflict and I don't want to have to enemies in an infinite stun lock.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English
@Chaos AvianYou can add a condition to it.


Of course, this applies to everything that involves elemental calculations.

Code:
var TH_GameAction_calcElementRate = Game_Action.prototype.calcElementRate;
Game_Action.prototype.calcElementRate = function(target) {
    var rate = TH_GameAction_calcElementRate.call(this, target);
    if (rate > 1) {
       // random number between 0 and 1
       if (Math.random() < 0.35) {
         target.addState( 30 )
      }
    }
    return rate;
};
 
Last edited by a moderator:

Regino

Warper
Member
Joined
Jun 13, 2014
Messages
4
Reaction score
5
First Language
English
Primarily Uses
RMMV
@Chaos Avian This is a really cool idea how exactly do you implementthat code to a project in MV? In the database, under states?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Well, looks like I need to build myself a quest system. Or really just a system for "Helpful voices" to talk to the player. I'm sure nothing will go wrong listening to them.... They're "helpful". :LZSwink:

Should be pretty easy with PIXI just letting me write all over the screen. :LZSexcite:
I'm starting to think I just dont like anime since the last one I enjoyed was none of them.
It's still here...
Hi guys, Im new here. Im using RPGMMV. In this community i would like to learn more and become better rpg developer.
The main character for the first game was originally going to become a member of the party in the third game but I'm probably changing him to an important NPC instead. That brings the third game's total ensemble roster down to nine with one optional secret character.

Forum statistics

Threads
95,591
Messages
930,303
Members
125,896
Latest member
Yilou
Top