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

goldrat1

Villager
Member
Joined
Nov 4, 2016
Messages
12
Reaction score
0
Primarily Uses
N/A
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
145
Reaction score
24
First Language
English
Primarily Uses

<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 Posts

Latest Profile Posts

i watched the sonic movie it was pretty good i hope they make a sequel
tomorrow I'ma go on a cruise for the first time ever... lets hope I'll survive the experience!
Omg! 8 years in this forum :o
Ksi
Streaming the last of the RMN Valentiny event games so feel free to drop on by and watch me cry (whether that's from laughter, rage or sheer pain, who knows?)
Today I went to sleep without setting an alarm, so I could sleep more than 2 hours. I woke up after 2 hours.

Forum statistics

Threads
94,318
Messages
919,856
Members
124,064
Latest member
kt040
Top