RMMV Setting actor position to enemy home position in skill

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
350
Reaction score
81
First Language
English
Hi everyone,

I'm trying to create a skill used by enemies whereby the skill user will travel to its target (an actor), and then move back into its HOME position - taking the actor with them. The actor must then remain there for the battle until a certain condition will make them travel back.

The primary plugin I am dealing with here is YEP's Action Sequence Pack 2.

I'm trying to put this together, and here is my current model:

1) Enemy begins the skill.

2) At the beginning of the action sequence, a common event is executed that is supposed to store the enemy's X and Y values for their home position in two global variables (111: EnemyPosX and 112: EnemyPosY). The common event runs a simple script:

Code:
var ex = target.spritePosX();
var ey = target.spritePosY();
$gameVariables.setValue(111, ex);
$gameVariables.setValue(112, ey);

(These variables always return 0 when checked, so I'm already doing something wrong).

3) In the action sequence, the enemy then uses a MOVE command to move to the target.

4) After the movement, two more movement commands are used: one to get the enemy back to their home position, and another to get the target (the actor, in this case) to move approximately to the enemy's home position using a simple "MOVE target: user, FRONT BASE, 30" etc.

5) After all of this movement is complete, I run a secondary common event which is supposed to use the stored values / variables from earlier in this script:


Code:
var ex = $gameVariables.value(111);
var ey = $gameVariables.value(112);
SceneManager._scene._spriteset._actorSprites[1]._homeX = ex;
SceneManager._scene._spriteset._actorSprites[1]._homeY = ey;

But because the values are 0,0 the actor just ends up somewhere in the top left corner.

So, in addition to the issues with above process, I would really like to be able to store in global variables:

- The actor ID of the enemy's target
- The enemy ID of the user
- How to change the default way an actor faces so I can flip it, and then flip back again when they return

I would also really like a way for multiple enemies of this type to use the same skill, but if they do using the process I have outlined above, the variables will get all mixed up if the move is used more than once. What would be a better way to do it?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,207
Reaction score
1,897
First Language
English
Primarily Uses
RMMV
Okay, going through in order.
The primary plugin I am dealing with here is YEP's Action Sequence Pack 2.
You should have 1 and 2 installed, a lot of the basic commands to actually make a skill do something are in 1.

The common event runs a simple script:

Code:
var ex = target.spritePosX();
var ey = target.spritePosY();
$gameVariables.setValue(111, ex);
$gameVariables.setValue(112, ey);

(These variables always return 0 when checked, so I'm already doing something wrong).
Your common event doesn't have any idea what "target" means. That's not any kind of reserved word in MV's engine that can be used at all times - it only means anything inside of things like notetag fields where the author has defined it. (Incidentally, it doesn't make it break, but there's no point to declaring variables that are only used once. It makes more sense to just say $gameVariables.setValue(111, target.spritePosX());)

The game variable for the current action's target should be BattleManager._action._targetIndex.

So you should be able to do (and here I will make the extra variable for readability :stickytongue: ):
Code:
var battler = $gameParty.members()[BattleManager._action._targetIndex];
$gameVariables.setValue(111, battler.spritePosX());
$gameVariables.setValue(112, battler.spritePosY());

So, in addition to the issues with above process, I would really like to be able to store in global variables:

- The actor ID of the enemy's target
- The enemy ID of the user
Just do so. Note that when you're using the Eval: command from Action Sequences 1, you can use the user/target words. So you can simply do:
Code:
Eval: $gameVariables.setValue(X, user.enemyId());
Eval: $gameVariables.setValue(X, target.actorId());
- How to change the default way an actor faces so I can flip it, and then flip back again when they return
The functions that Action Sequence 2 uses are listed starting on line 647: actor.spriteFaceForward(), etc.
I would also really like a way for multiple enemies of this type to use the same skill, but if they do using the process I have outlined above, the variables will get all mixed up if the move is used more than once. What would be a better way to do it?
Instead of using the game's global variables, just create them on the battler itself.
Code:
Eval: target.stored_X=target.spritePosX();
They'll just stay there and you can reference them whenever you want.
 

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
350
Reaction score
81
First Language
English
@ATT_Turan - haven't got around to implementing this yet but thanks so much for your detailed response. I think it has everything I need. :)
 

Latest Threads

Latest Profile Posts

Seeker Clones.png
Work on the Decepticon Seeker sprites is taking longer than I anticipated. I have five down: Starscream, Thundercracker, Skywarp, Acid Storm and Nova Storm. Three left to go: Ion Storm, Sunstorm (needs rework), and Slipstream. After completing their walking sprites, should I wait to post them after I've done a transformation sequence?
yRMekcF.gif


Run, <null> run!
(sprite got butchered a bit while making gif file...)
WOOP WOOP!
NEW CHARACTER ALERT!!!
Please, welcome to the stage...
Ramona Albright.png

Ramona Albright! A 20-year old World Key Guardian in training (More about the WKG's soon!), She is very impulsive, which leads us to the problem of the game. OOF. Kinda wanna wait till you know how to use the friggin World Key, huh?!
Bust sketch here!
IMG_20220124_110105.jpg
Little-by-little, keep improving your projects. That's how you finish them! ;)

Forum statistics

Threads
118,670
Messages
1,117,748
Members
155,781
Latest member
BombchuSquad
Top