theweirdnerd

Villager
Member
Joined
Oct 9, 2020
Messages
21
Reaction score
5
First Language
English
Primarily Uses
RMMV
I've had an idea for a skill that functions kind of like the Wabbajack from the Elder Scrolls. Instead of doing flat damage or inflicting a status effect, it randomizes a variable. Depending on what that variable lands on, it'll pull from a list of effects. From healing the user, drenching everyone in oil (causing all active fighters to take more fire damage), to transforming an enemy into another enemy. Like a chicken.

Doing this in a common event is the way to go, but I hit a roadblock with the transforming part. I noticed there isn't an option to pick the last target, instead you have to pick from a list of enemies on the field. This means that even if you hit enemy 4 and land on chicken time, enemy 1 gets bugawked instead.
Is there a way to set it so the enemy the player attacked is the one getting hit with the status effect? I'll include screen shots below.
1622617428293.png

The options have it so I can choose enemies 1-8 but I can I specify that the last enemy the player targeted is the one that gets chickified?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,716
Reaction score
8,498
First Language
German
Primarily Uses
RMMV
there is a workaround here - for direct targeting you would need a plugin that creates that ability, but you can trick the engine into remembering with event commands as well.

in the skill that calls the common event (the one that the player targeted), have it apply an invisible state to the target.
By invisible I mean no messages, no icon, no effect, only the named state itself.

Then in the common event, have eight conditional branches for the eight enemy index numbers, each checking if that enemy has the target state applied.
if yes, make your changes to that enemy and remove the state.
 

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,913
Reaction score
2,099
First Language
English
Primarily Uses
RMMV
You could just make multiple versions of the same skill for each different effect, and each time one is cast, have it be removed removed from the character and then roll a random variable to determine which version of the skill they get to use next time.

And randomise the skill put on the character once again at the start of each encounter, so a player loading the same saved game more than once doesn't run into getting the exact same version to cast each first time they use it in their first next battle.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,755
Reaction score
2,848
First Language
English
Primarily Uses
RMMZ
You can use

BattleManager._subject._lastTargetIndex

to get the enemy index of the target of the actor who used the skill.
 

theweirdnerd

Villager
Member
Joined
Oct 9, 2020
Messages
21
Reaction score
5
First Language
English
Primarily Uses
RMMV
there is a workaround here - for direct targeting you would need a plugin that creates that ability, but you can trick the engine into remembering with event commands as well.

in the skill that calls the common event (the one that the player targeted), have it apply an invisible state to the target.
By invisible I mean no messages, no icon, no effect, only the named state itself.

Then in the common event, have eight conditional branches for the eight enemy index numbers, each checking if that enemy has the target state applied.
if yes, make your changes to that enemy and remove the state.
Did this and it works like a charm! Mostly. The enemies do transform correctly, however, there was something I did with the variable that causes every effect to trigger instead of one different effect each time.
I'll include some screen caps in case if anyone face a similar problem, thanks for the help!
1622656111993.png1622656184376.png
This causes every effect to trigger.
1622656474051.png
Instead of asking if the variable is less than or equal to a number, set the max number to how many effects you're going to use, then ask if the variable is at a number.
 

Drakkonis

Veteran
Veteran
Joined
Mar 5, 2021
Messages
210
Reaction score
160
First Language
English
Primarily Uses
RMMZ
The way you have that set up, if the variable is over a certain amount, it will trigger EVERY effect that is below that number as well.

If you don't want to check specific numbers(which could lead to potentially lower variation when used with few effects), instead put further checks inside the else clause of the if statements. This way it ONLY continues checking if the current condition wasn't met.
 

Drakkonis

Veteran
Veteran
Joined
Mar 5, 2021
Messages
210
Reaction score
160
First Language
English
Primarily Uses
RMMZ
So basically it would be: If number <= #1, do this. If not (else), check if number <= #2. If yes, do this. If no, check if number <= #3. And so on for each threshold you have.
 

Latest Threads

Latest Profile Posts

Is it weird that i feel overwhelmed from reading codes that i wrote few months ago? Lol.

I dont even know where to continue!:hsad:
Ami
Gosh,I want to Play this Game Again one more again!

Seeing my Own Character & Kannono Once Again!
Tales_of_the_World_Radiant_Mythology_3_JPN_PSP-Coverart.jpg
I've been a bit to depressed to get work done on the game lately. Don't worry, I'll be okay.
LunarFlareStudios wrote on Solar_Flare's profile.
Hey, my name is Lunar Flare Studios, and you're Solar Flare? That's so weird!

Forum statistics

Threads
115,304
Messages
1,088,779
Members
149,947
Latest member
SpanglyBobby99
Top