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,713
Reaction score
8,497
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,912
Reaction score
2,098
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

Another comic with Backstage Malak...
If you want to ask him anything, you can ask on my DeviantArt page! I'm not sure if you're allowed to do it here.
Forum tip of the day ...
If you get a temporary suspension for being a jerk to people who are trying to help you, and arguing with mods and admins, don't go making new accounts. Chances are, if you p**s us off enough to suspend you for a week, we're not going to hesitate giving you a permanent ban when you give us a reason.
E_6fAErVkAQILXu.png
I'm so close to releasing my game on steam! :blush::blush::blush:
Us:
"This game is awesome! I wish there are more games like this in the future."
Also us:
"I hate how games stopped being original and start copying other successful games."
Should've done this a few days ago but...
PRI_200136808.jpg
Rest in Peace, Sir Clive Sinclair
1940 - 2021
Entrepreneur, Technologist, Father of the Modern British Computing Industry, and protagonist of Legend of ZUN.

Without you, England's games and tech industry wouldn't be where it is.

Forum statistics

Threads
115,287
Messages
1,088,659
Members
149,913
Latest member
badalias
Top