Hello, I'm working on a custom battle system that is made through events and not using any of the built-in battles or plugins in RPG Maker MZ. I just finished creating a health bar that is controlled with a variable.
Here's a video of it working in-game.
My next task is that I'd like the bar to be able to follow the event on the screen as it moves. For some reason, the move picture commands I've been trying haven't exactly been working. Instead, the picture just doesn't move at all.
Here's my code for showing the picture, based on the variable:
And then here's a breakdown of what the above variables are referring to:
Now, for the Move Picture command, I got this code from the rmmz_objects.js file:
So I tried to convert that into what I could use for my game.
Currently in my event, here's what I have:
◆Set Movement Route:Ally1
: :◇Move Down
◆Control Variables:#0081 A1 HP X = Screen X of Ally1
◆Control Variables:#0082 A1 HP Y = Screen Y of Ally1
And then it loops back up to my code for showing the picture.
I'm sure it's just a slight coding issue that's causing it to not move, but I haven't received any error messages, it just simply doesn't move. Does anyone have any ideas on what I might be doing wrong here?
Here's a video of it working in-game.
My next task is that I'd like the bar to be able to follow the event on the screen as it moves. For some reason, the move picture commands I've been trying haven't exactly been working. Instead, the picture just doesn't move at all.
Here's my code for showing the picture, based on the variable:
JavaScript:
$gameScreen.showPicture(3, $gameVariables.value(97), 0, ($gameVariables.value(81) - 100), ($gameVariables.value(82) - 225), $gameVariables.value(98), 100, 255, 0);
And then here's a breakdown of what the above variables are referring to:
JavaScript:
$gameScreen.showPicture(3, // Picture #3
$gameVariables.value(97), // Picture File Name is stored in this variable
0, // 0 Upper Left
($gameVariables.value(81) - 100), // X-Position of the Event (with an offset)
($gameVariables.value(82) - 225), // Y-Position of the Event (with an offset)
$gameVariables.value(98), // Width stored in this variable
100, 255, 0); // Height, Opacity, Blend Mode
Now, for the Move Picture command, I got this code from the rmmz_objects.js file:
JavaScript:
Game_Screen.prototype.movePicture = function(
pictureId, origin, x, y, scaleX, scaleY, opacity, blendMode, duration,
easingType
)
So I tried to convert that into what I could use for my game.
Currently in my event, here's what I have:
◆Set Movement Route:Ally1
: :◇Move Down
◆Control Variables:#0081 A1 HP X = Screen X of Ally1
◆Control Variables:#0082 A1 HP Y = Screen Y of Ally1
JavaScript:
$gameScreen.movePicture(3, 0, ($gameVariables.value(81) - 100), ($gameVariables.value(82) - 225), $gameVariables.value(98), 100, 255, 0, 60, 0);
And then it loops back up to my code for showing the picture.
I'm sure it's just a slight coding issue that's causing it to not move, but I haven't received any error messages, it just simply doesn't move. Does anyone have any ideas on what I might be doing wrong here?