Scan Enemy through switches/common events?

coticka

Veteran
Veteran
Joined
May 30, 2015
Messages
68
Reaction score
8
First Language
English
Primarily Uses
RMMV
Hello friends. I am currently trying to figure out a way how I can set up a switch with a variable and perhaps a common event to be called when using an item on an enemy, and I think I need some help. So would it be along the lines of-
-Item is used on enemy.
-Switch is turned on.
-Variable is called for the certain troop.
-Common Event is activated.
Or something along those lines? I'm having a hard time thinking how I could specify which common event to call
based on which enemy is chosen to use the item on during battle.
If anyone can point me in the right direction that'd be most helpful.
 

CaRa_CrAzY

Undefined Custom Title
Veteran
Joined
Jan 19, 2019
Messages
42
Reaction score
19
First Language
Portuguese
Primarily Uses
Other
I think you can't do it properly solely on Events, because that would require you to set multiple conditional branches for each common event for each troop, and since common events does not support calls based on variable IDs, this would be a very repetitive labor. Time is a valuable resource! Don't waste it on repetitive labor.

However, It is pretty simple while using scripts calls (Last item in the third event command tab, if I am not mistaken):
Code:
$gameTemp.reserveCommonEvent(n)
Just change the n inside brackets to the common event's ID you need to call.

If you are able to store the targeted troop's index inside a variable it should be as simple as:
Code:
$gameTemp.reserveCommonEvent($gameVariables.value(n))
Just change the n inside brackets to the variable's ID you want to use as a holder for the enemies IDs.

But we have a problem here, which is...
I think there isn't an event way to retrieve the information about which troop is being targeted, so you would have to build extremely complex events in battle just to retrieve a simple information, like in the old days of the 2k/3 era of custom battle systems built solely on events.

Luckily we have a way to retrieve that info using the item's formula.
Instead of putting some damage in there, we can assign the targeted enemy's ID to a game variable:
Code:
$gameVariables.setValue(n, b.enemyId())
Do not forget to change the n inside the brackets to the ID of the variable you want to use for keeping the enemy IDs.

These are the posts I found most of this info:
Get Targeted Enemy ID
List of Script Calls

Now, it's up to you to call those common events and set them up.
 

coticka

Veteran
Veteran
Joined
May 30, 2015
Messages
68
Reaction score
8
First Language
English
Primarily Uses
RMMV
Ahh, okay I see. I was toying around with it and tried having the item apply a state to the enemy when used.
Then, in a troop event there would be a conditional branch set to moment that checks individually for each enemy if it has
the state applied, then it would call the correct common event for that enemy type and erase the state.
The problem is, and I don't really know why but- The common event refuses to call from that conditional branch.
Even though it can be called just fine if placed by itself. Strange.
But I'll try this method as well.
 

CaRa_CrAzY

Undefined Custom Title
Veteran
Joined
Jan 19, 2019
Messages
42
Reaction score
19
First Language
Portuguese
Primarily Uses
Other
Can you post a screenshot from those conditional branches you mentioned?
 

CaRa_CrAzY

Undefined Custom Title
Veteran
Joined
Jan 19, 2019
Messages
42
Reaction score
19
First Language
Portuguese
Primarily Uses
Other
Are sure the state isn't gone by its own when the check is made?
 

coticka

Veteran
Veteran
Joined
May 30, 2015
Messages
68
Reaction score
8
First Language
English
Primarily Uses
RMMV
Yep. I gave the state an icon (just to make sure it's applying) and I see it over the enemies' head.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

The new intro Logo for my videos.

I speed it up, the one I use to use was to long.
The workweek is now over. Now I can work on my GamZzzzzZzzzzZzzzZzzZz....
Just watched Onward with the family. One of the best movies I've ever seen. <3
2 hours & 20 minutes remaining. :D
...trying to hurry finish up all commissions before I never put the controller down again ;)

Forum statistics

Threads
95,823
Messages
932,196
Members
126,257
Latest member
GGMaX
Top