Benku

Mecha King
Regular
Joined
Oct 3, 2012
Messages
130
Reaction score
28
First Language
english
Primarily Uses
RMMZ
Hi there! I'm currently attempting to develop a plugin that would allow me to use images during battles, instead of relying on face sets that are tied to the actor's ID. I'm struggling with the coding aspect of it and was hoping someone could lend a hand in making sense of it or even assist me in creating it. Any help would be greatly appreciated!

// Define a function to load and display a picture based on actor class ID.
function showPictureByClassId(classId, x, y, pictureName) {
var actor = $gameParty.members().find(function(actor) {
return actor.currentClass().id === classId;
});

if (actor) {
var pictureId = $gameScreen.showPicture(-1, pictureName, 0, x, y, 100, 100, 255, 0);
actor.setPictureId(pictureId); // Store the picture ID on the actor for reference.
}
}

// Define a function to remove a picture associated with an actor.
function removePictureByActor(actor) {
if (actor && actor.pictureId !== undefined) {
$gameScreen.erasePicture(actor.pictureId);
actor.pictureId = undefined;
}
}

// Extend the Game_Actor class to store the picture ID associated with each actor.
Game_Actor.prototype.initialize = function(actorId) {
// ... Existing code ...
this.pictureId = undefined; // Initialize the picture ID property.
};

// Extend the BattleManager class to handle picture display and removal during battle.
var _BattleManager_startBattle = BattleManager.startBattle;
BattleManager.startBattle = function() {
_BattleManager_startBattle.call(this);
// Iterate through the party members and display pictures based on class IDs.
$gameParty.members().forEach(function(actor) {
showPictureByClassId(actor.currentClass().id, 100, 100, "PictureName"); // Change "PictureName" to your picture filename.
});
};

var _BattleManager_endBattle = BattleManager.endBattle;
BattleManager.endBattle = function(result) {
_BattleManager_endBattle.call(this, result);
// Iterate through the party members and remove pictures associated with them.
$gameParty.members().forEach(function(actor) {
removePictureByActor(actor);
});
};
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,087
Reaction score
9,016
First Language
English
Primarily Uses
RMMV
I'm struggling with the coding aspect of it and was hoping someone could lend a hand in making sense of it
Almost all of the coders on this forum have said they're not willing to help troubleshoot code written by AI. Primarily because it often makes things up and troubleshooting it actually involves rewriting it.

That's a tool to be used to save time if you already know what you're doing, not a substitute for a knowledgeable person.

Also, the code in your post is basically unintelligible when pasted in as forum text.

Good luck! You may get better results starting fresh and posting in plugin support with what you're trying to accomplish.
 

AquaEcho

Script Kitty
Regular
Joined
Sep 20, 2021
Messages
1,682
Reaction score
1,150
First Language
English
Primarily Uses
RMMV
hoping someone could lend a hand in making sense of it
ChatGPT outputs nonsense code. I'm not kidding, like making up functions that dont exist in the engine and trying to call them. It's servicable for short, generic Javascript snippets like "loop through an array and return all instances of x" but when it comes to writing entire plugins where it's context dependent it falls apart.
 

Benku

Mecha King
Regular
Joined
Oct 3, 2012
Messages
130
Reaction score
28
First Language
english
Primarily Uses
RMMZ
Thank you for that information ill keep looking for something.
 

coyotecraft

Mythographer
Regular
Joined
Mar 13, 2012
Messages
502
Reaction score
275
First Language
English
Primarily Uses
N/A
Maybe you need to specify how you want to manage these pictures.
I don't think the code is nonsense. What I see is a lack of understanding of Rpg Maker's architecture and the relationship with the user. Like generating a room with a door on the ceiling. Oubliettes are technically a thing, but I digress.

If I'm reading this correctly, it looks like it's assigning Game Actors a picture. What picture? ShowPicture ID "-1". As if the developer would have already designated that through event commands. Except Picture IDs only go from 1 to 100. Using -1 is certainly the kind of solution script/plugin developers use to overcome the editor's limitations, but unfortunately it's not valid in this situation.

And what's the point of giving an Actor a picture?
I don't know what your prompt was. But if it was something like "Use pictures instead of facesets"; actors are assigned faceset images, so why not images too? Unfortunately no plugin is going to add a checkbox to the the ShowMessage dialogue box.
If you want to display a Bust image instead of a faceset, I think you'd want to modify the Show Message Window, so instead of drawing a faceset of Actor1 index 1, it'll display the picture corresponding to the faceset used. Like "Actor1_1.png"
The ultimate purpose being something that requires few actions to set up. But that's the crux of it.
A lot of developers just call a Common Event process to display or swap out portraits.
So there's not a lot of difference between that and a Plugin Command.
 

Benku

Mecha King
Regular
Joined
Oct 3, 2012
Messages
130
Reaction score
28
First Language
english
Primarily Uses
RMMZ
Okay, so I'm working on a mech RPG. The mechs are considered classes for combat. I should have stated this earlier, so I apologize. Based on the actor's class ID, it will show the mech they equipped. as a battler portrait in battle instead of a face set image. this fLtQ8EC.pngto this W9CZmgL.png
 

AquaEcho

Script Kitty
Regular
Joined
Sep 20, 2021
Messages
1,682
Reaction score
1,150
First Language
English
Primarily Uses
RMMV
Okay, so I'm working on a mech RPG. The mechs are considered classes for combat. I should have stated this earlier, so I apologize. Based on the actor's class ID, it will show the mech they equipped. as a battler portrait in battle instead of a face set image. this View attachment 277030to this View attachment 277031
If you just want to show an image with healthbars you could do this in SRD HUDMaker.
 

Benku

Mecha King
Regular
Joined
Oct 3, 2012
Messages
130
Reaction score
28
First Language
english
Primarily Uses
RMMZ
The "SRD HUDMaker" is for mv I'm using mz. and that was just a mock-up with what I want. it's literally the last thing I need for my project I have been trying to do this since the mz came out.i just want to replace the face set with a picture that uses the class id other then the actor id I know I'm asking a lot..
 

AquaEcho

Script Kitty
Regular
Joined
Sep 20, 2021
Messages
1,682
Reaction score
1,150
First Language
English
Primarily Uses
RMMV
The "SRD HUDMaker" is for mv I'm using mz. and that was just a mock-up with what I want. it's literally the last thing I need for my project I have been trying to do this since the mz came out.i just want to replace the face set with a picture that uses the class id other then the actor id I know I'm asking a lot..
There's an MV and an MZ version (Ultra). The MZ one is actually MORE advanced than the MV one

I actually think what you're asking for isn't a lot, you probably just need to alias the function responsible for showing that image and put a conditional check for class > rewrite the image reference to your new image. I just wouldn't know what function that is because I'm not that familiar with Battle Scene functions since I don't use it in my game
 

Benku

Mecha King
Regular
Joined
Oct 3, 2012
Messages
130
Reaction score
28
First Language
english
Primarily Uses
RMMZ
Thats fair. To be honest i might just look for someone willing to do it for money. if there's appropriate threads here.
 

AquaEcho

Script Kitty
Regular
Joined
Sep 20, 2021
Messages
1,682
Reaction score
1,150
First Language
English
Primarily Uses
RMMV
I believe you just need a plugin to change the Battle Status Window, write one yourself by modifying the core engine code, or hide it altogether and use SRD HUDMaker to show the image you want.
 

Benku

Mecha King
Regular
Joined
Oct 3, 2012
Messages
130
Reaction score
28
First Language
english
Primarily Uses
RMMZ
I can't code, thats why i trying to use AI with the SRD Hud Maker. Is it possible to make the actor's battler pictures change based on their class ID? My game's mechanic allows stealing other mechas. and each mech is treated as a class
 

coyotecraft

Mythographer
Regular
Joined
Mar 13, 2012
Messages
502
Reaction score
275
First Language
English
Primarily Uses
N/A
This is the default function that draws the faceset in the Battle Status window. It's in rmmz_windows.js
JavaScript:
Window_BattleStatus.prototype.drawItemImage = function(index) {
    const actor = this.actor(index);
    const rect = this.faceRect(index);
    this.drawActorFace(actor, rect.x, rect.y, rect.width, rect.height);
};

I think all you need is to add a conditional statement like
"If actor.classId is a specific number, draw this image instead. "

JavaScript:
Window_BattleStatus.prototype.drawItemImage = function(index) {
    const actor = this.actor(index);
    const rect = this.faceRect(index);
    if (actor._classId == 1){
                                            //(bitmap,sx,sy,width,height,dx,dy)
        this.contents.blt(ImageManager.loadPicture("Mecha"), 0, 0, 180, 313, 0, 0);
        return;
    };
    this.drawActorFace(actor, rect.x, rect.y, rect.width, rect.height);
};

There could be some fine tuning involved. Like adjusting the Battle Status Items. Idk how much of your mockup is functional.
Edit: Sorry, I don't know anything about SRD Hud Maker.
 

Benku

Mecha King
Regular
Joined
Oct 3, 2012
Messages
130
Reaction score
28
First Language
english
Primarily Uses
RMMZ
Oh wow this is the first time this works I'm sorry I'm so poor with scripting how would I put conditional strings cause it looks like this right now but its a good step. But I'm lost I have no idea how to code.Screenshot_10.png
 

coyotecraft

Mythographer
Regular
Joined
Mar 13, 2012
Messages
502
Reaction score
275
First Language
English
Primarily Uses
N/A
You can try adjusting the width, height, x, and y coordinates
this.contents.blt(ImageManager.loadPicture("Mecha"), 0, 0, 180, 313, 0, 0);
That's: (bitmap,sx,sy,width,height,dx,dy)
Change the dx and dy for the x and y coordinates.
It doesn't have to be a number. You could change the x's 0 value to something like Math.floor(this.innerWidth/2) to get something in the center of the battle status window.
But I don't know if your windows are modified or just hidden and replaced with something else.
 

Benku

Mecha King
Regular
Joined
Oct 3, 2012
Messages
130
Reaction score
28
First Language
english
Primarily Uses
RMMZ
Yes, there are two plugins that modify my battle status window.

They are

XPStyle
and
SuperFrontViewMZ
 

Attachments

  • SuperFrontViewMZ.js
    47 KB · Views: 1
  • XPStyle.js
    46 KB · Views: 0
Last edited:

Latest Threads

Latest Profile Posts

I keep thinkin' that someday I'll be a real girl. I dunno, maybe today is the day.:kaopride:

alice_curved_citadel.png
Counting down to Wind Ryder release
milhouse-time.gif


Hello everyone, I inform you that you can now freely try my new Plugin: Dynamic Switch for RPG MAKER MZ.

You can see the official post in the forum: https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mz-plugin-dynamic-switches.161525/

I hope you like it and I'm looking forward to your comments and suggestions! :)
Right, finally responded to everyone who had an open commission query with me. If I've missed anyone, please let me know.
Okay, so it looks like I've bamboozled by that dastardly placebo effect again. Still taking the meds, which seemed to help at first, but yesterday evening my chest got this odd numbness, which didn't last long, but still. AND its still difficult to breathe. Guess I'll go spend the money I was saving for homebuying costs on another doctor visit :\

Forum statistics

Threads
134,853
Messages
1,251,199
Members
177,644
Latest member
Valya
Top