A_Higher_Plane

Veteran
Veteran
Joined
Oct 3, 2015
Messages
339
Reaction score
48
First Language
Russian
Primarily Uses
RMMV
Hey so I am trying to do a custom motion but it just doesn't work. Please help me out. Here's what I have so far in some Game_Actor function:

var this_Sprite_Actor = new Sprite_Actor(this); this.requestMotion('swing'); this.requestMotionRefresh(); this_Sprite_Actor.updateMotion();
 

Warilized

Random Encounter
Veteran
Joined
Mar 19, 2018
Messages
80
Reaction score
20
First Language
Indonesia
Primarily Uses
RMMV
I'm still learning in JS so I can't really assist you thoroughly, but your script looks wrong. First there's no function to invoke, "this" keyword will not work.
If you wanted to just request swing animation, you can just use simple scriptcalls (I can't remember which but it start with $, probably look at the RPG_*.js)
A plugin named YEP action core also let you do that I believe.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,764
Reaction score
2,111
First Language
EN
Primarily Uses
RMMZ
var whatever = new Sprite_Actor(this) says "make a new sprite based on this actor". You're not adding it to any display object, so it won't show up.

To clarify, what are you trying to do?
  1. Animate an existing Sprite_Actor (e.g. in battle)?
  2. Create a new Sprite_Actor somewhere? If so: where, exactly?
  3. Something else?
 

A_Higher_Plane

Veteran
Veteran
Joined
Oct 3, 2015
Messages
339
Reaction score
48
First Language
Russian
Primarily Uses
RMMV
I'm trying to animate an existing sprite_actor.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,764
Reaction score
2,111
First Language
EN
Primarily Uses
RMMZ
In that case, I think something like this should be sufficient:
JavaScript:
$gameParty.members()[0].requestMotion('swing');
I.e. "request the swing motion for party member 0 (i.e. the leader)". Sprites should automatically update based on their battlers. If you want them to do their attack motion, including their weapon, use performAttack instead, e.g.
JavaScript:
$gameParty.members()[0].performAttack();
...and if you want to reference an actor by their ID rather than their position in the party:
JavaScript:
$gameActors.actor(1).requestMotion('swing');

If you're using plugins then you might need a different approach. ^ Test this first, though! :kaohi:
 

A_Higher_Plane

Veteran
Veteran
Joined
Oct 3, 2015
Messages
339
Reaction score
48
First Language
Russian
Primarily Uses
RMMV
Okay $gameParty.members()[this.index()].performAttack(); has worked!!
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,764
Reaction score
2,111
First Language
EN
Primarily Uses
RMMZ
Oh, if it's in a Game_Actor method then you could just use:
JavaScript:
this.performAttack();
Regardless, good to hear it's working! Happy RPG Making~ :kaojoy:
 

Latest Threads

Latest Profile Posts

Us:
"This game is awesome! I wish there are more games like this in the future."
Also us:
"I hate how games stopped being original and start copying other successful games."
Should've done this a few days ago but...
PRI_200136808.jpg
Rest in Peace, Sir Clive Sinclair
1940 - 2021
Entrepreneur, Technologist, Father of the British Computing Industry, and protagonist of Legend of ZUN.

Without you, England's games and tech industry wouldn't be where it is.
Woof, haven't touched any game-making elements in a couple of weeks I think.
Doing a thing in MV...

R3PuRjF.png

Forum statistics

Threads
115,285
Messages
1,088,626
Members
149,905
Latest member
Raizus
Top