Enemy that builds up resistance to elements it is attacked with?

goldrat1

Veteran
Veteran
Joined
Nov 4, 2016
Messages
37
Reaction score
4
First Language
English
Primarily Uses
RMMV
Hey, RPGMV community,
I'm currently trying to make an enemy that 'learns' from the player's used moves, and slowly builds up resistance to any enemies that it is attacked with up to certain point before it gets reset, e.g If a Fire-based skill is used against it, it increases its Fire Element Rate by -10% or so, and once any Rate value drops to lower than, say, 10% then it goes into Burnout, which resets its Element Rates and stops it from moving for a few turns.
Is there a way to do this in RPGMaker, detecting what element its attacked with? I'm guessing it'd involve plugins, or maybe scripting but I am complete trash at scripting. Anyone aware of a way to achieve this?

Thanks in advance!
 

Zerothedarklord

Veteran
Veteran
Joined
Jun 25, 2013
Messages
311
Reaction score
94
First Language
English
Primarily Uses
RMMV

<Custom Respond Effect>
// Check if the target received HP damage.
if (target.result().hpDamage > 0) {
// Get all of the elements used for this attack.
var elements = this.getItemElements();
// Loop through all the elements.
while (elements.length > 0) {
// Get the current element.
var element = elements.shift();
// Set the default state.
var state = 0;
// If the current element ID is 7...
if (element === 7) {
// ...then apply state 121.
state = 121;
// If the current element ID is 8...
} else if (element === 8) {
// ...then apply state 122.
state = 122;
// If the current element ID is 9...
} else if (element === 9) {
// ...then apply state 123.
state = 123;
// If the current element ID is 10...
} else if (element === 10) {
// ...then apply state 124.
state = 124;
// If the current element ID is 11...
} else if (element === 11) {
// ...then apply state 125.
state = 125;
// If the current element ID is 12...
} else if (element === 12) {
// ...then apply state 126.
state = 126;
// If the current element ID is 13...
} else if (element === 13) {
// ...then apply state 127.
state = 127;
// If the current element ID is 14...
} else if (element === 14) {
// ...then apply state 128.
state = 128;
// If the current element ID is 15...
} else if (element === 15) {
// ...then apply state 129.
state = 129;
// If the current element ID is 16...
} else if (element === 16) {
// ...then apply state 130.
state = 130;
}
// If the state is a positive number...
if (state) {
// ...then add the state to the target.
target.addState(state);
// And play an animation on the target.
target.startAnimation(53);
}
}
}
</Custom Respond Effect>
 

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

Latest Threads

Latest Profile Posts

Woo! Getting another xray today. Much fun, very irradiated.
If the universe is so big then why won't it fight me?
Does anyone know the name of the game where you play as someone called the batter? I can't remember the name of the game...
Got my R-Tree working /o/


Also here's what it looks like in memory (kind of):


The label on the nodes is the bounding box for all the objects it contains (in this case, the rectangles that make up the walls on the room).
"He, who wields the Excaliburn, will shine brighter than the sun itself, only his will can light up the flames of life"

Forum statistics

Threads
107,351
Messages
1,029,021
Members
139,432
Latest member
OhMeGa
Top