PikaMew

Villager
Member
Joined
May 6, 2017
Messages
13
Reaction score
0
First Language
French
Primarily Uses
RMMV
Hello,

To put you in the context, I've been trying Yanfly's Area of Effect plugin but I've told to myself that it would be a good idea if enemies could move on the battlefield. So, I created a skill that does just that.

My problem is if I can indeed change their position ("BattleManager.getSprite(user).setHome(New X position,New Y position);" through Yanfly's Battle Engine Core plugin) I can't actually make them look like they are moving. They are more like teleporting to their new position.

I tried to do it through stop motion but even that fails to work. Here is the code for those interested. The wait is set at 60 frames so I can see for sure if the wait command is working or not. The code is supposed to :
- Set a variable at 100,
- While the variable is above 0,
- Move the sprite of -10 X according to its actual position,
- Lower the value of the variable by 10,
- If the value is inferior or egal to 0,
- Break the loop.
- Else,
- Wait for 60 frames then repeat the "while" command.

Code:
<After Eval>
$gameVariables.setValue(15, 100);
while ($gameVariables.value(15) > 0) {
    BattleManager.getSprite(user).setHome(user.homeX()-10,user.homeY());
    $gameVariables.setValue(15, $gameVariables.value(15)-10);
    if ($gameVariables.value(15) <= 0) {
        break;
    } else {
        BattleManager._actionList.push(['WAIT', '60']);
    }
}
</After Eval>

What this code is actually doing is teleporting the sprite to the end destination without delays then after moving the sprite, it goes with the wait command.

What I am expecting through this topic is finding a way to actually make the sprite look like they are moving and not teleporting around. Even if it isn't done through stop motion (which would be better).

I precise that I am using a battle system with a frontview perspective. Thus, the Row Formation plugin doesn't move the sprites and action commands such as "move" doesn't work.

Thank you for your time.
 

PikaMew

Villager
Member
Joined
May 6, 2017
Messages
13
Reaction score
0
First Language
French
Primarily Uses
RMMV
Hello there,

As it's been 3 days now, I hope you don't mind I up this threat a bit.

If you have any questions, something you don't understand or just a precision you would like I make, please, don't hesitate to ask! ^^
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,147
Reaction score
10,708
First Language
Czech
Primarily Uses
RMMV
No wonder it does what it does. This code in translation means "While variable is greater than 0, decrease it by ten and add a wait command after this whole cycle ends.".
Also, the code can be simpler.¨
if ($gameVariables.value(15) <= 0) {
break;
is unnecessary, because once the variable reaches zero, the cycle ends anyway.
So instead of it it's enough to use just
if ($gameVariables.value(15) > 0) {
code}
Or even better, you can remove it entirely. As for the code, it might be better to use an actual event script call. So maybe
Code:
while ($gameVariables.value(15) > 0) {
 $gameVariables.setValue (x, $gameVariables.value(15) - 10)
 $gameInterpreter.wait(60);
}

or if you really want the if thing, because you don't want the wait command in last cycle...
Code:
while ($gameVariables.value(15) > 0) {
 $gameVariables.setValue (15, $gameVariables.value(15) - 10) 
 if (gameVariables.value > 0) {
  $gameInterpreter.wait(60);
 }
}
I hope it works.
 

PikaMew

Villager
Member
Joined
May 6, 2017
Messages
13
Reaction score
0
First Language
French
Primarily Uses
RMMV
Hello Poryg,

Thanks for your answer.

Sadly, "$gameInterpreter.wait" doesn't work, I've already tried it before. I tried it again as you suggested but it still doesn't work.

17070210495496069.png

So, I've tried again with "BattleManager._actionList.push(['WAIT', '60']);" instead and I'm just back at my original situation where it just moves to its final destination and executes the "wait"command only afterwards. :s
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,147
Reaction score
10,708
First Language
Czech
Primarily Uses
RMMV
Okay, that gives me another idea though. What about cheating an empty battle animation that is 60 frames long and playing it instead of the wait command? I'm literally just guessing, because I don't really know how to exactly solve the problem, but maybe it could help.
 

PikaMew

Villager
Member
Joined
May 6, 2017
Messages
13
Reaction score
0
First Language
French
Primarily Uses
RMMV
Alright, it can work out with an animation but I have one last problem with this solution. I know that's a detail but this is the kind of detail that makes you feels odd once you see it. Once the animation is over (I make the animation so the sprite disappears for 60 frames), the sprite reappears at its original position for like 1 frame before going to its destination. Which is kinda off. :s

Putting the animation in the code instead causes the sprite to move first even if you put the code that plays the animation before the code that moves the sprite.

Code:
<After Eval>
user.startAnimation(121);
BattleManager.getSprite(user).setHome(user.homeX()-100,user.homeY());
</After Eval>
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,147
Reaction score
10,708
First Language
Czech
Primarily Uses
RMMV
So if I understood correctly, now you created an animation during which the character disappears and then reappears in the last few frames?
 

PikaMew

Villager
Member
Joined
May 6, 2017
Messages
13
Reaction score
0
First Language
French
Primarily Uses
RMMV
Actually, it reappears right after the end of the animation at the initial position before moving.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,147
Reaction score
10,708
First Language
Czech
Primarily Uses
RMMV
That doesn't make sense though... May I see the full code of the after eval again?
 

PikaMew

Villager
Member
Joined
May 6, 2017
Messages
13
Reaction score
0
First Language
French
Primarily Uses
RMMV
This is the actual code:

Code:
<After Eval>
BattleManager.getSprite(user).setHome(user.homeX()-100,user.homeY());
</After Eval>

With the animation set to be played directly from the editor's database in the same skill.

The reason why he does this is easy to understand to me (or maybe I'm wrong), it's that the game waits for the animation to end before resolving the effect, though as the sprite disappears for the duration of the animation only, the sprite reappears briefly before moving.

That's why I tried:

Code:
<After Eval>
user.startAnimation(121);
BattleManager.getSprite(user).setHome(user.homeX()-100,user.homeY());
</After Eval>

In the hope that the sprite would move during the animation playing instead of waiting for it. Unfortunately, what I do not understand is that when the "startAnimation" is set into the code, he doesn't play the said animation before actually moving but after.
 

PikaMew

Villager
Member
Joined
May 6, 2017
Messages
13
Reaction score
0
First Language
French
Primarily Uses
RMMV
Hello!

Been a few days now without answers and my problem is still current so I up this thread once again !

Don't forget to ask me questions if there is something you don't understand!

Thanks! :)
 

Latest Threads

Latest Profile Posts

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
Don't you just hate it when you get a high level armor only for it to look like a metal plated bikini on your female character?? Seriously. How can that protect you??? Enemies can hit the squishy parts! :kaosigh:

Forum statistics

Threads
115,284
Messages
1,088,622
Members
149,904
Latest member
Martine1979
Top