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

Maldra

Veteran
Veteran
Joined
May 31, 2017
Messages
88
Reaction score
10
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

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,356
Reaction score
8,771
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

Veteran
Veteran
Joined
May 31, 2017
Messages
88
Reaction score
10
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

Veteran
Veteran
Joined
May 31, 2017
Messages
88
Reaction score
10
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
Veteran
Joined
Jul 2, 2014
Messages
2,830
Reaction score
1,657
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

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,192
Reaction score
15,545
First Language
English
Primarily Uses
RMMV

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

 

Maldra

Veteran
Veteran
Joined
May 31, 2017
Messages
88
Reaction score
10
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
Veteran
Joined
Jul 2, 2014
Messages
2,830
Reaction score
1,657
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

Veteran
Veteran
Joined
May 31, 2017
Messages
88
Reaction score
10
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
Veteran
Joined
Jul 2, 2014
Messages
2,830
Reaction score
1,657
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

Veteran
Veteran
Joined
May 31, 2017
Messages
88
Reaction score
10
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
Veteran
Joined
Jul 2, 2014
Messages
2,830
Reaction score
1,657
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 Posts

Latest Profile Posts

Well, someone "reviewed" my game. Didn't credit me anywhere in the video and spent 2 minutes insulting it. Going to ignore that and move on.
To cut down on map lag, I've been researching how to implement a lighting layer as a single map overlay instead of a bunch of individual lights. Hopefully I'll have a screenshot soon!
Imagine having a game broken up into a whole bunch of chapters? Like Chapter 11 should be about the party members going bankrupt.
Over 1/4th of the calendars are already out :eek: Have you already put something to a good use?

Forum statistics

Threads
117,261
Messages
1,105,921
Members
153,431
Latest member
shadowking1901
Top