Status
Not open for further replies.

Ronove

♫꒰・‿・๑꒱
Veteran
Joined
Mar 12, 2012
Messages
1,085
Reaction score
374
First Language
English
Primarily Uses
RMMV
Hey! I think this is the right place to put this. First, I'm going to post a gif of what I'll be talking about.

cover.gif
As you can see on the gif, the spear woman just teleports in front of the first character to protect him from the blow. You know, basic substitute stuff. That's fine. I was wondering, however, if there was a way to use Yanfly's Action Sequence to actually spruce up her movements/have her do her guard animation, whatever. Something that isn't teleporting and then sliding back home like she's doing currently.

Since Substitute is a flag in the database, I wasn't sure how to go about adjusting it so I figured it wouldn't hurt to ask to see if anyone who knows a bit more about all this stuff has any ideas.
Thank you!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,307
Reaction score
703
First Language
English
Primarily Uses
RMMV
So, the ways you could approach this (that I can think of):

1 - If you want to use action sequences, those only execute when the skill is being performed. So what you'd have to do is write out a portion of action sequence that checks for the presence of the Substitute flag in the defending party, do the motions you want, then copy that code into every single attacking skill that you want to be able to trigger substitution. It should be possible.

2 - Change what happens in the code for Substitute. I think it's in rpg_manager.js, look for where it queries "checkSubstitute" and find the portion that actually transfers the damage, then write a plugin for that function that adds in sprite movements. This, of course, would require the use of actual JavaScript commands used by the engine, not the simplified action sequences.
 

Ronove

♫꒰・‿・๑꒱
Veteran
Joined
Mar 12, 2012
Messages
1,085
Reaction score
374
First Language
English
Primarily Uses
RMMV
@ATT_Turan Yeah, I thought about number 2 but once I found where it was, I had no idea how to call the poses, haha.
1 sounds a little a lot since it has to be present on every enemy skill that can be substituted, but that might work out. Do you happen to know how I would be able to do that check?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,307
Reaction score
703
First Language
English
Primarily Uses
RMMV
The actor member function isSubstitute() will return true if that actor is currently flagged to substitute for their allies. So it's easy to write a loop that looks through the game party and sees if anyone has that.

The tricky part is that the action sequence commands use "actor x" to control battlers other than the user and target, and there's no way to use a variable for that. So it would get really convoluted as you do an if check for every single party member to see if they can substitute, then repeat the action sequence code four times.
 

Ronove

♫꒰・‿・๑꒱
Veteran
Joined
Mar 12, 2012
Messages
1,085
Reaction score
374
First Language
English
Primarily Uses
RMMV
Still definitely sounds DOABLE just convoluted, haha. I'll give it a shot this weekend but in the meantime, totally open to anyone else's suggestion!

And by "actor x" is x the number the character is in battle (so 1-4 essentially)? Since this character only ever takes up spot 3 and 4, that would cut down on the convoluted-ness if that's the case. Also I'm sorry for the really probably obvious question, plugin stuff is usually over my head.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,712
Reaction score
2,824
First Language
English
Primarily Uses
RMMZ
The actor one is actor ID as defined in the database rather than party position, but I'm pretty sure there's one for party member as well.
 

Ronove

♫꒰・‿・๑꒱
Veteran
Joined
Mar 12, 2012
Messages
1,085
Reaction score
374
First Language
English
Primarily Uses
RMMV
Oh, if it's actor ID, then I wouldn't need to repeat it four times then since only one person can substitute?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,307
Reaction score
703
First Language
English
Primarily Uses
RMMV
@Trihan had it slightly backward (and @Ronove, this is all in the action sequence documentation for you to just read) - the action sequences use "actor x" to "select the actor in slot x" - there is also "character x" which will "select the specific character with actor ID x."

So if you have your party composition and position locked (only this character can use the substitute skill and they're always in party slot X), then this is much more doable.

Here's a quick example that I did not test, but I think is correct off the top of my head. You'd put it inside the target action section:
Code:
if target.isActor() && $gameParty.members()[2].isSubstitute()
    immortal: actor 3, true
    jump actor 3: 150%, 60
    move actor 3: target, front, 60
    action animation: actor 3
    action effect: actor 3
    jump actor 3: 150%, 60
    move actor 3: home
    immortal: actor 3, false
else
    action animation
    action effect
end

So this should see if your third party member is flagged to substitute, jump them in front of the incoming attack, take the damage, and jump back. If they're not flagged, the regular target takes the hit.

I think that the "actor x" command uses the party slot like we would number it (1-4) whereas members()[] goes from 0-3. If you see the wrong actor moving, just change which number it has every time you see "actor 3". If you want to check a different party member, change the number in $gameParty.members()[2]
 
Last edited:

Ronove

♫꒰・‿・๑꒱
Veteran
Joined
Mar 12, 2012
Messages
1,085
Reaction score
374
First Language
English
Primarily Uses
RMMV
@ATT_Turan When I tried that as is, the numbers and animation disappeared. So I tried changing $gameParty.members()[2].isSubstitute() to 3 instead of 2, the numbers/animation showed back up, but she wasn't doing the animation (but she was still substituting). (And I also tried changing the actor 3s to 2s as an off-chance also did not work).

For reference sake this is how the enemy's skill is set up --
Code:
<setup action>
  clear battle log
  display action
  immortal: targets, true
  perform start
</setup action>

<target action>
  jump user: 150, 12
  move user: point, 425, 350, 10, offset x +50
  wait: 10
  face user: target
  clear battle log
if target.isActor() && $gameParty.members()[2].isSubstitute()
    immortal: actor 3, true
    jump actor 3: 150%, 60
    move actor 3: target, front, 60
    action animation: actor 3
    action effect: actor 3
    jump actor 3: 150%, 60
    move actor 3: home
    immortal: actor 3, false
else
    action animation
    action effect
end
  shake screen: 7, 7, 7
  wait: 3
  face user: target
  wait: 3
  death break
</target action>

<follow action>
  wait for new line
  clear battle log
  immortal: targets, false
  jump user: 50, 15
  move user: return, 15
  wait for movement
</follow action>

<finish action>
  wait for movement
  wait for effect
  perform finish
  action common event
</finish action>

EDIT: OK, if I change $gameParty.members()[2].isSubstitute() to 3 instead of 2, it just throws out an error in the console. So changing the number didn't fix anything I guess the game just ignored the statement altogether??
1624028092976.png
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,307
Reaction score
703
First Language
English
Primarily Uses
RMMV
Whoo, okay, you have a bunch of stuff going on here. Let's do one thing at a time, okay?
@ATT_Turan When I tried that as is, the numbers and animation disappeared.
So the first thing: what exactly worked and what exactly failed? Did the party member with substitute jump in front of the target?
So I tried changing $gameParty.members()[2].isSubstitute() to 3 instead of 2, the numbers/animation showed back up, but she wasn't doing the animation (but she was still substituting). (And I also tried changing the actor 3s to 2s as an off-chance also did not work).
You're changing a lot of stuff, and most of it shouldn't be guesswork. Again, members()[] goes in order of your party members, 0-3. So there should be zero guessing on your part - hit Escape in the game to see the menu. The party member on top is 0. Then going down 1, 2, 3. So you know exactly which party member is using your substitute skill, there's no guessing involved.

The only question is whether the "actor 3" places should be the same number as that, or one higher.
For reference sake this is how the enemy's skill is set up --
I'm not going to dissect your entire action sequence, because some of it you may want to be doing intentionally differently from how I would. A few things that should definitely be done:
- Add a "wait for movement" after the jump and move lines that I gave you, I forgot that.

- I don't know why you have "wait for effect" way down in the finish action when you've done so much stuff after the "action effect". This may be why you don't see the damage popup, because it's immediately processing the next part. Move your "wait for effect" immediately after the "end" in the code I gave you.
EDIT: OK, if I change $gameParty.members()[2].isSubstitute() to 3 instead of 2, it just throws out an error in the console.
Again, that number should not be a guess, it should be you looking at your party and counting. The error in the screenshot that you attached indicates you don't have a fourth party member at the moment.
 

Ronove

♫꒰・‿・๑꒱
Veteran
Joined
Mar 12, 2012
Messages
1,085
Reaction score
374
First Language
English
Primarily Uses
RMMV
I know it shouldn't be a guess, but I was just trying everything before I said "hey it didn't work". And yeah, the action sequence is old and hot garbage but it was what I was testing with sorry. EDIT: and even when I move "wait for effect" to be right after the conditional, the below still happens.

When I put the code in, as is, the enemy goes forward, the screen shakes, the enemy moves back. No substitution, no damage (it doesn't show and nothing takes damage), no animation.


EDIT x2: OK, it has to be actor 2. Thank you! I'm going to play around with this to see if I can get her in the right position (right now she jumped very high in the air which was hilarious but not the desired effect). With some testing, I can't seem to get her to move in front of the character who is being targeted. I got it.

EDIT x3: okay done with editing this post. It works with a little more finagling and I can get by with the rest on my own. Thank you so much @ATT_Turan for dealing with me!

EDIT x4
Code:
if target.isActor() && target.isDying() && $gameParty.members()[2].isSubstitute() && target!=$gameParty.members()[2]
This is the full conditional as posted by ATT_Turan below to do what I wanted. Putting this here instead of the wrong one I had before.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,712
Reaction score
2,824
First Language
English
Primarily Uses
RMMZ
Whoops! Well I can't be right 100% of the time, life would be boring.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,307
Reaction score
703
First Language
English
Primarily Uses
RMMV
EDIT x4 because I am not done: even at full HP, she will substitute everyone, but I think that's simple enough to figure out on my own. Just fair warning for anyone else who looks at this thread. (to stop the cover anyone at whatever HP, you can do "if target.isDying() && $gameParty.members()[2].isSubstitute()", but then that makes her cover whoever is dying, even herself which is silly so I'm still working on whatever the third conditional will be.)
Right, as I said, this was just a basic version for you to customize as you like. Many people want an ally who's "covering" for others to do it regardless of their HP - you want it only when they're in the yellow, and you figured out how to do that.

For the covering herself part, that was just me not being thorough enough:
if target.isActor() && target.isDying() && $gameParty.members()[2].isSubstitute() && target!=$gameParty.members()[2]
If you leave out the isActor check, your party member will start defending enemy targets.
 

Ronove

♫꒰・‿・๑꒱
Veteran
Joined
Mar 12, 2012
Messages
1,085
Reaction score
374
First Language
English
Primarily Uses
RMMV
Yeah, I realized the isActor check is needed after I posted that edit, haha. No worries it was definitely back in there once I was reading more closely. Thank you! This works for sure. I appreciate the help!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,899
Reaction score
14,995
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Does the word "research" imply that you're searching for something that had been found before?
So Dad broke the blinds two days ago and he finally decided to try to fix them. I doubt he'll do very well without some help. And I can't help him myself--I don't know how the stink to fix those blinds. My knowledge is just plushies, mascots, computers, animation, and video game design. And also, I've had to stop family and friends from downloading viruses too many times to count.
IlluminaughtyStore.jpg
:kaojoy:
Welcome to the Illuminaughty store.
Yes... they are "wearing Illuminati branded everything, reclining on huge Illuminati body pillows. Occasionally they'll "teehee" at each other and have pillow fights with Illuminati branded pillows full of hundred dollar bills."
BCj
Working on Escalia again, feels good. Have this overwhelming urge to map as well, but need to get some extra tiles commissioned first :D
Lee Sang wrote on Bandito's profile.
Hi, I've just tried your plugin "Game is Active" and when I tested it on Android, it gave me an error, something about "Cannot read property 'underfined' of underfined.

Forum statistics

Threads
113,871
Messages
1,078,077
Members
147,962
Latest member
CuidadoDoyJuegos
Top