Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Im trying to make an enemy who casts a random state on themselves and the mechanic of this battle is the players don't know which state the enemy has.
I would like to make a state that combines Runic and Lightning Rod but for enemies. So that the enemy will automatically absorb the players next spell and does so secretly, then the state is removed.


This is the code I have for the state that is Runic absorb
Code:
<Foe Aura: 113>

<Custom React Effect>
// Check to see if the skill is a magical skill and deals positive HP damage.
if (this.isSkill() && this.isHpEffect() && value > 0) {
  // Change the amount of damage received to 0.
  value = 0;
  // Check to see if the action is a skill.
  if (DataManager.isSkill(this.item())) {
  // If the action is a skill, get the MP cost of the skill.
    var mp = user.skillMpCost(this.item());
    // Recover the MP.
    target.gainMp(mp);
  }
  // Play an animation for the Runic effect.
  target.startAnimation(58);
}
</Custom React Effect>


<Custom Turn End Effect>
user.removeState(109);
</Custom Turn End Effect>


This is the code I have for the "foe aura"
Code:
<Custom Action Start Effect>
// Get the current action.
var action = user.currentAction();
// Check if the action exists and targets an opponent.
if (action && action.isForOpponent()) {
  // Get the Lightning Rod origin state ID.
  var lightningRod = 109;
  // Get the action's elements.
    var pool = [];
    // Get the opponent's unit's alive members.
    var group = user.opponentsUnit().aliveMembers();
    // Loop through each one.
    for (var i = 0; i < group.length; ++i) {
      // Get the currently looped member.
      var member = group[i];
      // Check if the member exists and is a Lightning Rod origin.
      if (member && member.isStateAffected(lightningRod)) {
        // Add that member to the pool.
        pool.push(member);
      }
    }
    // Check if the pool's size is larger than 0.
    if (pool.length > 0) {
      // Get a random Lightning Rod origin from the pool.
      var rod = pool[Math.floor(Math.random()* pool.length)]
      // Set the action's target to the Lightning Rod origin.
      action.setTarget(rod.index());
    }
  }
}
</Custom Action Start Effect>
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
606
First Language
English
Primarily Uses
RMMV
If you don’t want the player to know then don’t use an icon for the state. You could also have the state applied when the enemy does some other seemingly normal skill/attack.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
If you don’t want the player to know then don’t use an icon for the state. You could also have the state applied when the enemy does some other seemingly normal skill/attack.

Some more information. The enemy is a support minion and I gave him 4 random states that all have the same Icon and do different things. The icon is not the issue.
Currently its not working, I want this specific state to redirect any magic skill from another target to this minion.
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
606
First Language
English
Primarily Uses
RMMV
Okay, sorry about the misunderstanding.

What part is not working? I'm not really understanding the effect you want to achieve. It looks to me like the runic ability negates any incoming magical damage and restores MP to the user, while the lightning rod basically does the same thing except it only draws lightning element attacks.

Since the runic ability is better, I'm not sure what effect you are looking to achieve.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Okay, sorry about the misunderstanding.

What part is not working? I'm not really understanding the effect you want to achieve. It looks to me like the runic ability negates any incoming magical damage and restores MP to the user, while the lightning rod basically does the same thing except it only draws lightning element attacks.

Since the runic ability is better, I'm not sure what effect you are looking to achieve.

The runic ability works perfectly but it's not for players it's for enemies and well it's super easy for players to just ignore using magic on the enemy while its active.
To add an element of difficulty I want the player not to know if the enemy will have runic up or not, so the player will not just play around it and make the fight too easy.

If I put magical taunt on the enemy then it let's players know that this time the state is runic and just use physical attacks.

Let me explain in full details. I made a mischievous imp that has high speed to go first and 4 attacks all called the same and the icon for the states are the same.
1/4 chance of the imp casting each of the following.
-runic with spell redirect (1 time use)
-physical atks will deal 0 dmg and confuse the actor (1 time use)
-triple ATK skill on removal of state or end of turn.
-sleep on actor unless it takes physical dmg.

Does this make it a bit more clear? I'm trying to make a support enemy that disrupts the players strategy. You won't use your best magic skills on the boss with a chance that it might be cast on a lackey instead and negated! You might first test it.

Anything I think because thunder rod is designed for players to use, now that an enemy is using it it messes things up?

Alternatively what I can do is if the imp casts runic instead of having it cast runic I put an invisible state on all enemies that negates the first spell targeting them and then removes that state from all enemies so it only happens once on the first enemy. Except I don't know how to do that, user.addstate and target.addstate are simple but not sure how to get addstate to all enemies and removestate.

Does this make more sense, to sum up lightning rod is not redirecting spells players cast on enemies to the enemy with the state up.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,053
Reaction score
2,315
First Language
English
Primarily Uses
RMMV
The problem is that your foe aura code has one } too many. Remove the one at the end and it should work.
 
Last edited:

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
The problem is that your foe aura code has one } too many. Remove the one at the end and it should work.
I tried and fixed that and it still doesnt work.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,053
Reaction score
2,315
First Language
English
Primarily Uses
RMMV
It works for me. What is it doing/not doing?

If you give your runic/aura states an icon, does the icon appear on everyone you'd expect it to?
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
It works for me. What is it doing/not doing?

If you give your runic/aura states an icon, does the icon appear on everyone you'd expect it to?

The icon appears on my enemy when runic is up. On actors turn the Foe Aura aka lightning rod appears on their turns.
What happens is runic IF targeted by any skill will absorb and gain MP. However if I target a different enemy the skill hits that enemy when I want the runic user to take the hit in its place.

Edit: Just noticed regular attacks are triggering the Runic too lol
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,053
Reaction score
2,315
First Language
English
Primarily Uses
RMMV
"attack" is a skill so that doesn't surprise me. You may have to change that to isMagical()
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
"attack" is a skill so that doesn't surprise me. You may have to change that to isMagical()
Yeah figured, any idea to why its not redirecting to a different enemy though?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,053
Reaction score
2,315
First Language
English
Primarily Uses
RMMV
I'm investigating now to see what's up with it.

It's because you remove the Lightning Rod state at end of turn. The aura doesn't kick in until the end of the turn during which the enemy uses the Runic skill, so at the point where it's checking for a lightning rod target there isn't one because the state's been removed (I missed this in my test because I originally had the enemy set up to use Runic every turn).

Make the Runic state expire in 2 turns instead and take out the turn end effect.
 
Last edited:

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
I'm investigating now to see what's up with it.

It's because you remove the Lightning Rod state at end of turn. The aura doesn't kick in until the end of the turn during which the enemy uses the Runic skill, so at the point where it's checking for a lightning rod target there isn't one because the state's been removed (I missed this in my test because I originally had the enemy set up to use Runic every turn).

Make the Runic state expire in 2 turns instead and take out the turn end effect.
Thanks I'll try it. I don't know why but removing states using default at the end of 1 action never works for me. Is there a reason or a fix to this? I always manually remove states this way.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,053
Reaction score
2,315
First Language
English
Primarily Uses
RMMV
Manually removing the state that way is fine, but it doesn't gel so well with the aura effect because that only gets applied at the end of the turn as well. So at the point where the aura is checking for the state, it's already been removed.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Manually removing the state that way is fine, but it doesn't gel so well with the aura effect because that only gets applied at the end of the turn as well. So at the point where the aura is checking for the state, it's already been removed.

So doesnt work still, Im using YF STB and turn ends are after everyone goes, it doesnt matter if its 1 turn or 2. I tested it without removing the state and it still does not work.
Also 1.5.1 if it makes a difference.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,053
Reaction score
2,315
First Language
English
Primarily Uses
RMMV
I'll try it with STB and see if more changes are needed for compatibility there.

It works for me even with STB active. What is it not doing on your end?
 
Last edited:

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Still need help on this I dont know how to get it to work.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
I'll try it with STB and see if more changes are needed for compatibility there.

It works for me even with STB active. What is it not doing on your end?

The runic works, its the lightning rod does nothing. I tried various things but it does not redirect any spell or attack towards the user with the aura.
I basically want a secret magical taunt that negates the spell.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,053
Reaction score
2,315
First Language
English
Primarily Uses
RMMV
Can you screenshot everything you have currently for the Lightning Rod setup?
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses

Attachments

  • lightningrod state.gif
    lightningrod state.gif
    249.2 KB · Views: 3
  • runic state.gif
    runic state.gif
    237.4 KB · Views: 3
  • mischief skill.jpg
    mischief skill.jpg
    221.2 KB · Views: 3

Latest Threads

Latest Posts

Latest Profile Posts

How would you judge a game you played? Art/Graphics? Story? Gameplay?
Learn MV sales goal = 2%
NSFW game sales goal = 2500% (no jokes) :guffaw:
After gathering, sorting out & reconsidering hundreds of enemy battlers over the last two das, finally my favorite part begins: Inventing names and lore for them all :D
I'm running a sale for Learn RPG Maker MV on Itch.io, can I compete with NSFW games earning goals?

Forum statistics

Threads
111,375
Messages
1,060,569
Members
144,707
Latest member
musicm122
Top