A few questions regarding YEP_BattleEngineCore and Action Sequences

I've started laying the groundwork for my battle animation a few days ago and it's going... well, it's making progress I think. I've stumbled over a few hurdles though, and have a couple of questions.

Question 1:
Code:
IF ... ELSE STATEMENTS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
For those familiar with programming, you can use if...else statements to
perform different actions based on different conditions. Use 'if' to
specify a block of code to be executed, if a specified condition is true.
Use 'else'  to specify a block of code to be executed, if the same
condition is false. Use 'else if' to specify a new condition to test, if
the first condition is false. Use 'end' to specify where the conditions
are to end.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example:
    if $gameSwitches.value(1)
        action effect
    else if $gameSwitches.value(2)
        action effect
        action effect
    else
        action effect
        action effect
        action effect
    end

I would like to try using this to play a context-based animation on the attacker depending on the id of the weapon they currently have equipped. Problem is, I don't know how to address them. What would the proper syntax be for a conditional like "if $(attack user).hasWeapon($dataWeapons[3])".

I need to do this via if statement btw, because I need to be able to control when in the Action Sequence it is executed.

On a side note: Is there a repository of these little tags like "hasWeapon", "isActor", etc. that I can look up somewhere? They seem useful.


Question 2:

Code:
MOVE target: args
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MOVE target1: HOME, (frames)
MOVE target1: RETURN, (frames)
MOVE target1: FORWARD, (distance), (frames)
MOVE target1: BACKWARD, (distance), (frames)
MOVE target1: POINT, x coordinate, y coordinate, (frames)
MOVE target1: target2, BASE, (frames), (offset)
MOVE target1: target2, CENTER, (frames), (offset)
MOVE target1: target2, HEAD, (frames), (offset)
MOVE target1: target2, FRONT BASE, (frames), (offset)
MOVE target1: target2, FRONT CENTER, (frames), (offset)
MOVE target1: target2, FRONT HEAD, (frames), (offset)
MOVE target1: target2, BACK BASE, (frames), (offset)
MOVE target1: target2, BACK CENTER, (frames), (offset)
MOVE target1: target2, BACK HEAD, (frames), (offset)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This is a move command. Arguments can be used in the above formats. This
action sequence command will move target1 to any of those locations listed
in the arguments. If it's towards target2, you must include what location
relative to target2 for target1 to travel to.
Note: Moving only works with Sideview.

Is there a way to somehow combine "MOVE target1: POINT, x coordinate, y coordinate, (frames)" and "MOVE target1: target2, FRONT CENTER, (frames), (offset)"? I'd like my actor to move to a point that is level with the target on the y-axis (relative), but keep their x position constant at something like, say, 600 pixels (absolute).

The problem I run into here is that the coordinate point I want to end up at is a mix of relative and absolute, whereas both of these commands refer to a fully absolute or fully relative point. I can't use the offset either, as that is also a relative value.

I hope I'm explaining this in a way that makes sense. If not, here are some examples:
  • If the target is at position x240,y450, I want the actor to move to x600,y450
  • If the target is at position x80,y60, I want the actor to move to x600,y60
  • If the target is at position x770,y310, I want the actor to move to x600,y310

Question 3:

I put this line into the finish action of one of my skills:

"hp -12.5%: user, show"

Intent is to make the user of the skill lose 1/8 of their max HP after execution. The problem is that, regardless of the user's HP, the skill always subtracts 12 HP. It's as if the parser isn't recognizing the % and treats 12.5 as a flat value.

Is there a way I can fix this?
On a side note: Is there a repository of these little tags like "hasWeapon", "isActor", etc. that I can look up somewhere? They seem useful.
You can Google it - almost everything has been asked about MV, so if I search for "rpg maker mv script call equipped weapon" the first result gives hasWeapon()

You could also reference the pinned thread of MV Script Calls, but that requires scrolling through the correct categories or searching for the right word.
What would the proper syntax be for a conditional like "if $(attack user).hasWeapon($dataWeapons[3])".
You've actually mostly gotten it, you're just adding random extra symbols/words. The action sequence instructions give a list of target types you can use, and user is one. So you'd simply do:
Code:
if user.hasWeapon($dataWeapons[3])

Is there a way to somehow combine "MOVE target1: POINT, x coordinate, y coordinate, (frames)" and "MOVE target1: target2, FRONT CENTER, (frames), (offset)"? I'd like my actor to move to a point that is level with the target on the y-axis (relative), but keep their x position constant at something like, say, 600 pixels (absolute).
You could try throwing the math in there.
Code:
move user: point, 600, target._screenY

I put this line into the finish action of one of my skills:

"hp -12.5%: user, show"

The problem is that, regardless of the user's HP, the skill always subtracts 12 HP. It's as if the parser isn't recognizing the % and treats 12.5 as a flat value.
My starting wager is that the decimal in the percentage is throwing it off. Make it an even 12 or 13 percent and see if that works correctly.
You can Google it - almost everything has been asked about MV, so if I search for "rpg maker mv script call equipped weapon" the first result gives hasWeapon()

You could also reference the pinned thread of MV Script Calls, but that requires scrolling through the correct categories or searching for the right word.

You've actually mostly gotten it, you're just adding random extra symbols/words. The action sequence instructions give a list of target types you can use, and user is one. So you'd simply do:
Code:
if user.hasWeapon($dataWeapons[3])
I did actually try to google it; I usually attempt to figure this stuff out on my own before asking questions, that's actually how I got the ".hasWeapon($dataWeapons[3])" part. I just needed some help getting it put into shape. Didn't know I could just put "user" in front of there and it would work. I guess I've been too traumatized from trying to figure out various forms of C where you have to memorize some pretty wacky strings to do even the most basic stuff.

I'll give the script call thread a read in a bit. Thanks.

You could try throwing the math in there.
Code:
move user: point, 600, target._screenY

There wouldn't happen to be a way to get this to work with multi-target/AoE skills, would there? I tried to look through the documentation for a target type a la "first target" or something, but couldn't find anything. It's okay if there isn't, just figured I should ask.

My starting wager is that the decimal in the percentage is throwing it off. Make it an even 12 or 13 percent and see if that works correctly.

That actually seems to have fixed it. Thanks.
Will be more wary of decimal points in the future.
I did actually try to google it...that's actually how I got the ".hasWeapon($dataWeapons[3])" part. I just needed some help getting it put into shape.
If you look at my post and what I quoted from you, the suggestion to Google wasn't about how to get the correct syntax vis-a-vis "user". It was in response to "how to find useful script calls like hasWeapon()".

You can either read the script call list or the MV library, or just Google specific things as you need them.

There wouldn't happen to be a way to get this to work with multi-target/AoE skills, would there? I tried to look through the documentation for a target type a la "first target"...
Well, there really isn't one, right? When you're confirming a skill that has more than one target, your cursor isn't on any specific enemy, they're all highlighted.

You can try replacing target with BattleManager._targets[0]
My bad, I guess I must have considered that section I wrote as one coherent block and that the response applied to all of it.

Astoundingly, I have come up with another silly question that stumps me:

Code:
if user.hasWeapon()
action animation
else
animation 16: target
end

Sooo... I thought "hasWeapon()" would return a boolean and I could use this to reference whether the user has ANY weapon equipped, but apparently this will always return as false.

Felt cheeky after that and tried "user.hasWeapon($dataWeapons[1..200])", not really expecting that to do anything. It doesn't, I'm just surprised it didn't throw an error at me.

THEN I tried some kind of nutty setup with "!" and ".nil", no surprises that also didn't work.

Unfortunately I'm out of ideas now.
try user.weapons().length >= 1
You see, using something like user.hasWeapon($dataWeapons[200]) might have worked... if No. 200 does exist in your DB, of course.
Sooo... I thought "hasWeapon()" would return a boolean and I could use this to reference whether the user has ANY weapon equipped, but apparently this will always return as false.
As a general rule, if a function takes an argument you can't just choose to omit it. It's used by the code inside the function. You're getting false because the code is erroring out.

The code @AphoticAmaranth gave will do what you're looking for. You could also use do !user.hasNoWeapons() - again, found in the library and script call pages I linked you to. No guessing required 😉
Using "user.weapons().length >= 1" did it. Thank you for the assist.

There may come a day far in the future where I will understand the wiles of javascript.
Nah, it's not exactly a pure JS issue but a Maker-JS-based-DSL issue and how to use Array#length.
You could try throwing the math in there.
Code:
move user: point, 600, target._screenY

I've now tested this with a single target skill, and it's throwing a "target is not defined" reference error at me.

Code:
move user: point, -200, target._screenY


The offending action in question.
it's throwing a "target is not defined" reference error at me.
You can try replacing target with BattleManager._targets[0]
Ah, it works.

tumble1.gif

tumble2.gif

fire.gif


Glorious! Thank you.

You can try replacing target with BattleManager._targets[0]

Sorry, I had a momentary brain fart and thought that solution applied only to multi-target skills. It makes sense that referencing position 0 of an array that stores attack targets would also apply to single target skills. I don't know why I thought otherwise.

Original thread: https://forums.rpgmakerweb.com/threads/a-few-questions-regarding-yep_battleenginecore-and-action-sequences.159677/