Get enemy and actor id in a common event

Evolite

Villager
Member
Joined
Mar 8, 2019
Messages
5
Reaction score
0
First Language
french
Primarily Uses
RMMV
Hello everyone !

I have trouble with getting IDs.

I want the id of my actor who used the skill but also the id of the target.

I put this in the damage formula :

v[2] = b.enemyId()

This just works, but in need this information in a common event who is launched when you use the skill, and the game call the event before the skill is used. i don't know how to use this << v[2] = b.enemyId() >> in a common event, i tried the script button, but it's say something like "b is not defined". why does he understand in the damage formula and not in the common event ? and also how i use this in a comon event ?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Common events are called after the skill is used, not before. Unless you have a plugin that changes that.
 

Evolite

Villager
Member
Joined
Mar 8, 2019
Messages
5
Reaction score
0
First Language
french
Primarily Uses
RMMV
I don't know why, but when i attack, my test msgbox pop BEFORE the attack occurs. it mean the variable is not set the first time i use the skill. It can be a plugin, but i don't really care, i just want an answer to my question, how do i get enemy ID and actor ID related to a skill (user and target) in variables outside the damage formula ? It's not possible ? And futhermore, how can i see the system vars ? cause i think like id, the stats like atk,def,HP ect are stocked somewhere. but can i use this kind of variables ? like if i want to have the target enemy atk, how do i do ?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
"b is not defined". why does he understand in the damage formula and not in the common event ?
Because the damage formula evaluator actually sets b = your target, that is why it only works inside the damage formula
 

Evolite

Villager
Member
Joined
Mar 8, 2019
Messages
5
Reaction score
0
First Language
french
Primarily Uses
RMMV
Okay. so i guess a will be the launcher of the attack ? that's interesting. But can i get the Id of current actor" or "current target ? maybe i check it with a state. but it's pretty lame, cause I forced to check all Possible actor and enemy id ?
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
399
Reaction score
221
First Language
English
Primarily Uses
RMMV
If your skill is setting the variable and you want to access the variable value in your common event almost every event command allows you to designate a value using a variable.

If for whatever reason that's not suitable, you can use the script
Code:
$gameVariables.value(id)
where id is the variable id. This will get the value you've set in the damage formula.
 

Evolite

Villager
Member
Joined
Mar 8, 2019
Messages
5
Reaction score
0
First Language
french
Primarily Uses
RMMV
I know that ! but the problem is i call a common event in my skill. and the game call the event BEFORE the skill action. so exactly like I said in my first post, it works, but because the common event is called before, the vars are not set. if i use the skill twice in the same instance of the game, it works the second time.

Maybe what I do is just too complex.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,366
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
and the game call the event BEFORE the skill action
this cannot happen in default.
If the common event is called before skill action, then your battlesystem has been changed by a plugin, because in default the common events called by skills always run at the end of the turn.
So for further help, you would have to find out which of your plugins change that.

that said, ever considered a different way to identify actor or target?
you can apply an invisible state to the user and the target, and then have a loop in the common event check all possible users and targets as to who have that state and then you'll know them. Not as easy as a direct variable access, but usually better to handle.
 

Evolite

Villager
Member
Joined
Mar 8, 2019
Messages
5
Reaction score
0
First Language
french
Primarily Uses
RMMV
i have a plugin who change that in fact, cause my RPG is a tactical rpg, and the battle are on the map. I tried with a state "engaged", but I just reporting the problem, cause if i want to apply the state, i have to put it in the damage formula, cause i can't have the ID in the common event. And since the common event is called before....

The solution would be to simply call the common event in the damage formula. How can I do this ?
 
Last edited:

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

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,081
Members
137,582
Latest member
Spartacraft
Top