RMMV Javascript Syntax to move battler back home and change opacity to full

Maldra

Regular
Regular
Joined
May 31, 2017
Messages
102
Reaction score
11
First Language
English
Primarily Uses
RMMV
Hi, I currently have a "High Jump" ability that jumps the user up and brings their opacity down. I came across a bug that if the player dies from a DOT while in the air, they die and do not reappear where they normally stand. I already am using a plugin that runs a common event when an actor dies, and was thinking of using it for this too, since the yanfly Custom Leave Effect does not work with death. However, I do not know what the syntax is to move the user's battler back to the original spot and bring the opacity back to full. Does anyone know what the script command should say?

Thanks in advance.
 

Andar

Regular
Regular
Joined
Mar 5, 2013
Messages
39,922
Reaction score
11,871
First Language
German
Primarily Uses
RMMV
it should basically be the same commands, just with other numbers.
opacity is set absolute, so the command should just be repeated with the opposite number

and positions you should store the original position in new variables before the move, and then set it to that stored position whenever you think that is needed.
 

Maldra

Regular
Regular
Joined
May 31, 2017
Messages
102
Reaction score
11
First Language
English
Primarily Uses
RMMV
Not really... to change the opacity and movement was from the skill and utilized yanfly plugin, I need the actual javascript syntax.
 

Maldra

Regular
Regular
Joined
May 31, 2017
Messages
102
Reaction score
11
First Language
English
Primarily Uses
RMMV
bump, can anyone assist with the javascript syntax to bring a battler back to its home position and to change the opacity to normal?
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
12,607
Reaction score
11,090
First Language
English
Primarily Uses
RMMV
So the function for opacity is within the Game_Sprite class, and I'm having a hard time figuring out how to get to a battler's sprite from the actor data.

If you have Yanfly's Action Sequences installed, you should be able to call battler.spriteOpacity(100, 0); where, obviously, the reference for "battler" depends on where you're calling the script from.

And I haven't poked at it, but bringing them home might be battler.performActionEnd();

I would suggest that an easier (and more user friendly) fix would be this: make activating your jump skill apply an immortal state to the character, which is then removed after they deal damage.

That way there's no frustrating/weird mechanic where they die in the middle of the jump, and if they're supposed to, then they'll just drop dead after finishing the jump and you don't have to worry about any script calls.
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,971
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Support. Thank you.

 

Maldra

Regular
Regular
Joined
May 31, 2017
Messages
102
Reaction score
11
First Language
English
Primarily Uses
RMMV
So the function for opacity is within the Game_Sprite class, and I'm having a hard time figuring out how to get to a battler's sprite from the actor data.

If you have Yanfly's Action Sequences installed, you should be able to call battler.spriteOpacity(100, 0); where, obviously, the reference for "battler" depends on where you're calling the script from.

And I haven't poked at it, but bringing them home might be battler.performActionEnd();

I would suggest that an easier (and more user friendly) fix would be this: make activating your jump skill apply an immortal state to the character, which is then removed after they deal damage.

That way there's no frustrating/weird mechanic where they die in the middle of the jump, and if they're supposed to, then they'll just drop dead after finishing the jump and you don't have to worry about any script calls.
Yeah, I thought about that... But it seems a bit weird to be able to finish an attack after their HP drops to 0 from poison or something of the like. I can easily identify which user needs to have their location updated and opacity changed, I'm just not sure what the javascript would be for that. The Yanfly stuff would work because the character is dead and would need to have the code ran through a common event instead.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
12,607
Reaction score
11,090
First Language
English
Primarily Uses
RMMV
Yeah, I thought about that... But it seems a bit weird to be able to finish an attack after their HP drops to 0 from poison or something of the like.
I think it seems more weird (and unexpected, as a player) to have my attack canceled when I'm off the screen. But that's preference.
I can easily identify which user needs to have their location updated and opacity changed, I'm just not sure what the javascript would be for that. The Yanfly stuff would work because the character is dead and would need to have the code ran through a common event instead.
I'm not sure what you mean, I just gave you two JavaScript functions to try. If they didn't work, you'll need to say what happened instead, or what error you got.
 

Maldra

Regular
Regular
Joined
May 31, 2017
Messages
102
Reaction score
11
First Language
English
Primarily Uses
RMMV
That javascript doesn't identify which battler, though? If its ran through a common event, it would need to specify that.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
12,607
Reaction score
11,090
First Language
English
Primarily Uses
RMMV
That javascript doesn't identify which battler, though?
Correct - I just assumed that since you were asking for code references, you knew how to make use of them.

I'm presuming you are using a state to track/control the actor using jump. If that's the case, and you have the Buffs & States Core installed, you'd try this:
Code:
<Custom Respond Effect>
user.spriteOpacity(100, 0);
user.performActionEnd();
</Custom Respond Effect>
I haven't tested this...it might not work properly with the action end being called outside of that actor's turn, and it might look weird. It's tricky because, honestly, you're wanting to do something pretty wonky here :wink:
 

Maldra

Regular
Regular
Joined
May 31, 2017
Messages
102
Reaction score
11
First Language
English
Primarily Uses
RMMV
I had already tried the Custom Leave Effect before creating this post, but I figured I'd try the Respond one too... It did not work.. I altered your code slightly first:

<Custom Respond Effect>
if (user.hp < 1)
{user.spriteOpacity(100, 0);
user.performActionEnd();
}
</Custom Respond Effect>

I also tried it just as you had the code and either the poison damage did not trigger anything to happen or it simply didn't do anything, I'm not sure which.

To note, though, The Custom Leave Effect did not work for other things when the character died, and only works when the character is alive. This is why I was trying to find some javascript code that I would be able to use in a common event, because I am already utilizing a plugin that calls a common event when a character dies in order to de-summon a wyvern:

1634531330895.png

I have confirmed that with the death common events plugin that this works, which is why I was trying to get the code that would work from here too.



EDIT: I got it to work! Here is how I finally was able to do it, using the Death Common Event plugin:

1634531957074.png

Thanks for your help!
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
12,607
Reaction score
11,090
First Language
English
Primarily Uses
RMMV
Oh, heh, I forgot this was about poison damage. So the custom respond stuff will only trigger off of attack actions.

Just put it in your common event on death, have conditionals that check each party member to see if they have the jump state, then use $gameActors.actor(ID).etc for calling the functions.

That only works if the common event on death gets called before death, of course, otherwise the jump state will be stripped off and you have no way of knowing which actor bit the dust.
 

Latest Threads

Latest Profile Posts

Uh... Forum test, forum test. Am I live?
New but not so new here. (Like, been lurking around as a guest). I hope to change my destiny.
That is, to make friends and learn from the community. I hope we all have fun and create memories worth keeping. :ptea:
made a face sprite for the little guy using default cat for comparison, I'm rather pleased with how it turned out!

image.png
Playing arounnd with NUUN's Battle Result as a VS Victory Aftermath alternative. Loving it so far despite the learning curve (there are a LOT of parameters)

1701665328725.png

Just have to figure out how to addin sub class progress.
Partitito's story is supposed to be about defeating poverty while thinking he is a capitalist with socialist ideas. But it's really about stories of redemption and perseverance.

Forum statistics

Threads
136,730
Messages
1,269,269
Members
180,450
Latest member
MatrixPDF64
Top