Nectar

Bees love me.
Veteran
Joined
Jul 7, 2017
Messages
245
Reaction score
41
First Language
English
Primarily Uses
RMMV
I am using Yan's Buffs and States core... I'm trying to figure out how to execute some events if the state is being added to an enemy. Something like this:

<Custom Apply Effect>
if (state being added to = troop/enemy)
{
do such and such
}
</Custom Apply Effect>

I was doing some research but couldn't find anyone with similar problems.
 

Capitán

kind of a big deal
Veteran
Joined
Jul 9, 2013
Messages
576
Reaction score
147
First Language
Engilsh
Primarily Uses
RMMV
What exactly are you trying to do because Custom Apply Effect applies when the state is applied
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
662
Reaction score
284
First Language
english
Primarily Uses
RMMV
sounds like they trying to get common event to run when state is applied to an enemy.
but buff/state core isnt even needed for that.
can have the skill that is adding the state also run common event.
whether the event is triggered by the skill or a custom apply effect it would still be the same thing,
the event would need a series of conditional check to figure out which enemy the state was applied to and then do stuff to that enemy.
this is usually just done with an invisible "target" state and the event checking for that state.
(remember to remove the target state with the event too.)

custom apply effect would be used to skip the whole event checking each target for the state before doing stuff and just do the stuff directly.
for someone to help with that coding we would need to know exactly what the event was intending to do to the target.
 

Nectar

Bees love me.
Veteran
Joined
Jul 7, 2017
Messages
245
Reaction score
41
First Language
English
Primarily Uses
RMMV
What exactly are you trying to do because Custom Apply Effect applies when the state is applied
Well, I'm basically just trying to figure out how to check if the state is being applied to an enemy. If it is being applied to an enemy, run some code. This code is only to be processed if a certain variable is enabled, in this case, a special party skill called Vampire which is a skill that works only using code and variables.

I'm just basically just trying to figure out how to check if the state is being applied to an enemy so it runs this code only once per enemy it is applied to.

-Edit-
Knowing how to do so will also help me with keeping track of variables that check how many enemies have been applied with X state to complete achievements or something.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
913
Reaction score
576
First Language
English
Primarily Uses
RMMV
A <custom apply effect> only happens if the state was successfully applied, so anything you put inside that tag will only happen if the state had been successfully applied. The script inside can safely assume the state had been applied, otherwise that block of code wouldn't be running.
Code:
<custom apply effect>
console.log('state applied!')
</custom apply effect>
Putting just this example will show that the text only shows up in the console if the state has been applied successfully. So if an enemy resists it, this code doesn't happen at all.
 

Nectar

Bees love me.
Veteran
Joined
Jul 7, 2017
Messages
245
Reaction score
41
First Language
English
Primarily Uses
RMMV
A <custom apply effect> only happens if the state was successfully applied, so anything you put inside that tag will only happen if the state had been successfully applied. The script inside can safely assume the state had been applied, otherwise that block of code wouldn't be running.
Code:
<custom apply effect>
console.log('state applied!')
</custom apply effect>
Putting just this example will show that the text only shows up in the console if the state has been applied successfully. So if an enemy resists it, this code doesn't happen at all.
Lmao, I understand how it works, I just need to know how to check if the state was applied to an enemy and not to an actor since both can receive this state. But I want to check if it's the enemy receiving it, and if it is, then do so and so.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
913
Reaction score
576
First Language
English
Primarily Uses
RMMV
Gotcha.
Code:
<custom apply effect>
if (target.isEnemy()){
    //do stuff
} else {
    //do other stuff
}
</custom apply effect>
 

Latest Threads

Latest Posts

Latest Profile Posts

Progress on one of my projects has been slow, but I'm at a spot now where I feel like sharing the four main characters.

From left to right we have: Amabel, Tibby, Dusty, and Wren.

tibbyrpgcast.jpg
I'm in a much better mood about my game than I was 2-3 days ago. I keep switching between sideview and front because of the amount of assets needed for side (I'm drawing it all myself)... but I've decided to stick with front, for my own sanity. sidenote... people, planning is important. I've spent so long on just getting my game's ideas off the ground because I didn't plan ahead.
unknown.png

"Fight me."
I'll finally wash my clothes today!
SA46ATTACK.gif :kaojoy:New Arab character in action.

Forum statistics

Threads
110,609
Messages
1,054,686
Members
143,736
Latest member
wildsky
Top