Last Target Index Issue

Achija

Warper
Member
Joined
Apr 7, 2020
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMVXA
Hi There! Long time Lurker first time poster.

So I'm having an issue with the last target on the force action system and I understand from this post
that there is a bug in it.
Problem is I implemented Archeia's code and the issue is still happening.

More details:

I am putting together a diplomacy system in my game that requires eventing to interact with the enemy. The user uses the diplomacy skill and it calls a common event. If successful it makes the enemy leave and rewards players with Exp. If unsuccessful it makes the enemy annoyed and gives them a state that makes them attack harder. Both of these I am currently handling with states that are granted by a force action call from the event to make the actor use a skill granting the state on the last target after a very long string of branching paths. The interaction tree is working great but when I get to the force action it automatically targets enemy 1 not last target.

I have also tried finding a script call that just grants the targeted enemy the required state (I already have a variable that is being set to the enemy's troop id for reference upon use of the skill). This or forcing the enemy to leave when successful would be a more elegant solution but no such script call seems to exist in my extensive research.

The only out of house scripts I am using are:
Yanfly's Ace Message System
Kread-EX's Game Over Event
Mr. Trivel's Roguelike Saves

I am trying to limit my use of other folks script as much as possible as an exercise to try and get better, unless I find an issue that is WAY beyond my understanding. I am teaching myself the basics of coding and I've learned a lot but this one has stumped me.

HELP!
Edit: tried a few more things and found how to script last target enemy sate
Skill has: $game_variable[x]=b.id;
before the damage code.
Then in script call:
a = $game_variables[x]
$game_troop.members[a].add_state(y)

This solves the specific issue of this skill but not the general issue of last target which other skills in my game use, so I definitely still need help with that!
 
Last edited:

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,573
Reaction score
6,503
First Language
Indonesian
Primarily Uses
RMVXA
I looked up directly at the code, and how the code work is like this.

Enemy 1 previously target actor 2
Next turn you use forced action on enemy 1, with the target is the last index.
Enemy 1 should target actor 2.

This is very basic on what should be happening. But it doesn't happen on your end?
Try a simpler event and forget the branches. If that works, then you can probably trace on what is happening in your event and figuring where is the fault. If that doesn't work, maybe we can figure out by looking under the hood.

It probably also better if you show how you do your event.
 

Achija

Warper
Member
Joined
Apr 7, 2020
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMVXA
As I said in my edit the specific problem of this event I have solved by using a script call to directly grant the state to the enemy. The problem of last targetting remains however. I'll describe the event and what it led to though maybe you can make heads or tales of it.

Player (there is only one actor in party in this game) uses diplomacy on Bandit A. Skill takes enemy name and id before damaging willpower by 1 ($game_variables[x]=b.name; $game_variables[y]=b.id; 1). Skill calls common event diplomacy. Common event runs a series of d&d style skill checks to determine if diplomacy was successful. This purely uses variables and conditional branches to accomplish, no interaction with the Bandit A battler occurs. If successful force action actor 1 use charm skill on last target. If neutral force action actor 1 use neutral skill on last target. If unsuccessful force action actor 1 use annoyed skill on last target. That is how it's programmed. Again I could remove the branching paths completely roll a random number between 1 and 3 and assign which force action to take and nothing would change except the skill checks.

Here's how it actually flows in battle:
Attempt 1
Actor use dip skill target Bandit A
Branching unsuccessful
Force action Actor use annoyed skill last target
Bandit A annoyed
Actor use dip skill target Bandit B
Branching successful
Force action Actor use Charmed skill last target
Bandit A (not bandit B my last target) Charmed.

Attempt 2
Actor use Dip skill target Bandit B
Branching successful
Force action Actor use Charmed skill last target
Bandit A (not Bandit B my last target) Charmed.

I ran these trials with every possible combination and every time I last target on Bandit B Bandit A is targetted. Even tried in a troop with 3 enemies. Bandit A still always targeted. So the best I can figure is the battle engine is reading the -2 of the last target index as whatever Enemy 1's target index is; 0 or 1 if I'm remembering the code correctly.

Again using the troop id to grant the status has fixed the specific problem of this skill but other skills in the game like a gun skill that uses a follow up shot on last target also use the last target system and are similarly bugged.
 
Last edited:

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

Latest Threads

Latest Profile Posts

mlogan wrote on alltheyuriz's profile.
Please be aware that our Status rules ask members not to make more than 2 status updates in 24 hours.
rux
Just 80% of my motivation on game making lmao, anyone got tips on how to not be unmotivated?
I've signed up for a job training program for people with Asperger's Syndrome. I went to a "test run" today so they could see how well I did with simple jobs, and I amazed them. Most new people do it in 30+ minutes, while I finished in a mere 15 minutes. Gives me time to work on a screenplay for Studio MDHR...
People,I have seen that Someone from China/Chile and London is doing a Vaccine Against COVID-19.

Forum statistics

Threads
105,467
Messages
1,013,917
Members
137,108
Latest member
maxmach
Top