Map Event using a skill on the player

How do I do this exactly? For example, in my game I want some events the player can walk through to do damage to them with a specific damage element. I already have the events set up to decrease HP (not pictured), but if they could do damage of a certain element the player can wear armor/use items to reduce it.

I am currently experimenting with "force action" but so far the skill in question isn't doing damage to the player.

Skill:
1712894899490.png


Common event that is trying to use the skill:
1712894930018.png
several possible problems:

1) where does a.roll(2,6) comes from? It is not a default method so it has to be added by script, and if anything is wrong with script code in the damage formula the result defaults to zero.

2) what are your mdf values? typically main parameters are in the dozens or hundreds, and that is a reduction from a very low damage number.

3) how is the common event called? curre3ntly it will do nothing on its own because it is not triggered, it needs to be called.
several possible problems:

1) where does a.roll(2,6) comes from? It is not a default method so it has to be added by script, and if anything is wrong with script code in the damage formula the result defaults to zero.

2) what are your mdf values? typically main parameters are in the dozens or hundreds, and that is a reduction from a very low damage number.

3) how is the common event called? curre3ntly it will do nothing on its own because it is not triggered, it needs to be called.
1. The a.roll(2,6) is from a script, and the formula is directly copied from a skill that works.
2. I use small numbers because MDF is used for flat damage reduction. Equipment uses a combination of that with percentage damage resistance. The player at this point only has 1 flat damage reduction, and 10% damage reduction from the element I want to effect them.
3. It's called by an event on the map the player walks over, which triggers.
1712968643858.png
Please place a show text on the map event to get a visible proof that the event triggers.
Because there are a few cases where map events are not triggered based on how the player gets to the event.

and next time, please post full screenshots as both the priority and the trigger of the event is important here.
Screenshot (514).png

1713068208413.png
Looks OK so far, which means I'll have to start guessing - all possibilities I thought about before are not the case here.

I don't remember the exact coding from VXA variant of force action, so can you make the following test and change the force action target from random to entire party?
You'll probably have to change it back if that suddenly has multiple uses, but it's a test.

Also as a test to be changed back later, can you change the damage formula to a fixed number without anything else? for example 10 or so, no roll and no mdf
This is to check if there still is a problem with the formula that is a bit more hidden.
Is the animation from the common event played on the actor? I didn't see that mentioned here.
If not can you do a text box in the common event and see if that shows up.
If it does then it really is just the force action.
There's also the fact that force action is intended for the battle scene not map scene.

After trying a few things, this works

user = $game_party.members[0]
item = $data_skills[80]
user.item_apply(user, item)
1713105366618.png
Looks OK so far, which means I'll have to start guessing - all possibilities I thought about before are not the case here.

I don't remember the exact coding from VXA variant of force action, so can you make the following test and change the force action target from random to entire party?
You'll probably have to change it back if that suddenly has multiple uses, but it's a test.

Also as a test to be changed back later, can you change the damage formula to a fixed number without anything else? for example 10 or so, no roll and no mdf
This is to check if there still is a problem with the formula that is a bit more hidden.
Changing the damage number to flat has no effect. Also, I'm not sure if there's a function to change force action to the whole party, as its just enemies, specific actors, and then last target, random, or indexes.
Screenshot (516).png


Is the animation from the common event played on the actor? I didn't see that mentioned here.
If not can you do a text box in the common event and see if that shows up.
If it does then it really is just the force action.
There's also the fact that force action is intended for the battle scene not map scene.

After trying a few things, this works

user = $game_party.members[0]
item = $data_skills[80]
user.item_apply(user, item)
View attachment 301910
Yes, the animation is from the common event only. Can you explain how the script you posted works exactly? I can see I need to change the skill number to the one in my database, but do I need to change the party member number line or the user,item line?
Yes, the animation is from the common event only. Can you explain how the script you posted works exactly? I can see I need to change the skill number to the one in my database, but do I need to change the party member number line or the user,item line?
I meant does the animation actually play? But I assume it does.

the script is taking values and calling a Game_Battler method

user = $game_party.members[0]
this is the party member that you want to have the effect done on.
members[0] is the first member in the party.
user is a Game_Battler (class Game_Actor < Game_Battler)

item = $data_skills[80]
this is the item or skill you want the action to be used.

user.item_apply(user, item)
the first user is just make a reference to Game_Battler. since the actor is a Game_Battler and the method we call is in Game_Battler, then item_apply is called.
We supply the values to the method (user, item), which says use this item on this user.
I meant does the animation actually play? But I assume it does.

the script is taking values and calling a Game_Battler method

user = $game_party.members[0]
this is the party member that you want to have the effect done on.
members[0] is the first member in the party.
user is a Game_Battler (class Game_Actor < Game_Battler)

item = $data_skills[80]
this is the item or skill you want the action to be used.

user.item_apply(user, item)
the first user is just make a reference to Game_Battler. since the actor is a Game_Battler and the method we call is in Game_Battler, then item_apply is called.
We supply the values to the method (user, item), which says use this item on this user.
IDK if I'm just being dumb, but this is what I did and it doesn't work. Also, is there a way I can make it effect the whole party? I tried to add another game_party.members like but it crashed.

1713228697046.png
it doesn't work
I don't know what is wrong with your project then.
Spoiler: pics
1713235746408.png
1713235766216.png
1713235779715.png

1713235805958.png
Code:
$game_party.members.each do |mem|
item = $data_skills[80]
mem.item_apply(mem, item)
end
I don't know what is wrong with your project then.
Code:
$game_party.members.each do |mem|
item = $data_skills[80]
mem.item_apply(mem, item)
end
I don't know what sorcery you pulled off, but it works now! I also accidentally found out (I forgot to change the skill number so it used a different damaging skill) that the skill I was using should have targeted enemies instead of allies, which is weird. Thanks for the help!
It's nice to see that both of them were able to come to some useful conclusions that later let you trigger the elemental trap of sorts. Yet, I find a problem with the scriptlet that you're now using. You see, it has a flaw. It uses the current party member's stats. extracted from mem variable, as a base for the damage that should be dealt to that very same hero, also called mem there. This is a weird solution indeed. Normally, you'd pick an enemy to decide how strong the skill's base stats & effects will be. That's not the case here.

As a summary, it's a clear case of friendly fire.

Let's say your skill is magical by definition. That would mean that mages who normally have high MATK stats could be seriously hurt by that skill while fighters like :ehappy: Eric wouldn't. If it's physical by nature, then :esad: Eric would be the first casualty here. Of course, this might not take place if they also have high DEF or MDEF stats.

Of course, if you simply don't mind about these technicalities, well, you're good to go! 😀

My Suggestion

You better pick an enemy from the database to cast the spell instead.
And yes, it's that simple. :ewink:

Edit: The caster is expected to be a Game_Enemy not a DB enemy so I had to change that.
item doesn't need to be redefined every single time you pick another hero.

Ruby:
caster = Game_Enemy.new(0, 1) # Enemy ID is 1 here
item = $data_skills[80]
$game_party.members.each do |member|
  member.item_apply(caster, item)
end

It doesn't have to be enemy #1, obviously. :eswt:
It's nice to see that both of them were able to come to some useful conclusions that later let you trigger the elemental trap of sorts. Yet, I find a problem with the scriptlet that you're now using. You see, it has a flaw. It uses the current party member's stats. extracted from mem variable, as a base for the damage that should be dealt to that very same hero, also called mem there. This is a weird solution indeed. Normally, you'd pick an enemy to decide how strong the skill's base stats & effects will be. That's not the case here.

As a summary, it's a clear case of friendly fire.

Let's say your skill is magical by definition. That would mean that mages who normally have high MATK stats could be seriously hurt by that skill while fighters like :ehappy: Eric wouldn't. If it's physical by nature, then :esad: Eric would be the first casualty here. Of course, this might not take place if they also have high DEF or MDEF stats.

Of course, if you simply don't mind about these technicalities, well, you're good to go! 😀

My Suggestion

You better pick an enemy from the database to cast the spell instead.
And yes, it's that simple. :ewink:

Ruby:
caster = $data_enemies[1]
$game_party.members.each do |member|
  item = $data_skills[80]
  member.item_apply(caster, item)
end

It doesn't have to be enemy #1, obviously. :eswt:
Let me explain the context for this. It's similar to the anomalies from Stalker, which are areas with weird stuff going on in them, and they damage you. Some burn you with flames or chemicals, some zap you, etc. All I am looking for is for the map event to act like that, and damage you with a skill, as thats the only way I know of to cause damage with specific elements.
I'm not a programming wizard or anything so what works, works.
Honestly, I didn't need that context at all to understand the situation. Yet, I don't mind if you don't need to correct that strange situation happening there. That's why I told you that you were good to go with the solution provided by someone else.

I just wanted to let you know what was obvious for me after analyzing that code. You had the right to know about it and make a decision based on that fact.
Kyonides suggestion is correct.
The way it is now each actor is using their atk power to determine the damage.
Unless you have the skill set to a specific value.
So using an enemy that you can easily make and use it as the damage atk value will make the damage to each actor the same.
Kyonides suggestion is correct.
The way it is now each actor is using their atk power to determine the damage.
Unless you have the skill set to a specific value.
So using an enemy that you can easily make and use it as the damage atk value will make the damage to each actor the same.
If the skill damage doesn't scale off any player or enemy stats, does it really matter? Thank you both for the help!

Original thread: https://forums.rpgmakerweb.com/threads/map-event-using-a-skill-on-the-player.167668/