Status
Not open for further replies.

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
278
Reaction score
163
First Language
Swedish
Primarily Uses
N/A
Hello!

I am wondering how different character images are stored, and if they are stored at all.

The reason for this is because I have some time left over and I can't figure out anything that really affects gameplay that needs to be fixed. So I wanted to make characters armor change based on what armor type it is. E.g. light, medium, heavy, magical, spiritual.

So then I started to generate variations for each character, which would total quite a lot of extra character, battler and face images. Because I felt it would be too much effort to figure out how bitmaps work and if they are stored in the game somehow.

But, then I realized, what if I want to change something?!

So that leads me to wonder if the images are stored in the game when running.

For example, if Actor1.png is loaded for Actor1._characterName, is the image then stored somewhere in the engine in such a way that changes can be made to it?

Then I could just have each character be nekkid and then add an armor on top of them. This would also allow me to combine more variation, like a hat or something like that.

And it doesn't really matter if the image is reloaded from the source every time you enter a map, or every time the $gamePlayer.refresh() function runs. Because I could technically just intercept the image before this and parse it through my own function that changes the clothing on the character.
 

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,299
Reaction score
692
First Language
German
Primarily Uses
RMMV
the imgs are stored in your folder..

and the default sprite plugin loads them and makes sprites of them.

i made a plugin that can add child sprites to the gameplayer, related to region id.
(thats for visual changes related to the Map backround, like beeing in water or in deep grass)
this was requested here#1

its planed to upgrade this plugin to show the most default weapons on gameplayer related to the equiped weapon type of "gameparty leader"

a similar thing could be made for armor stuff, but ts not planed because armor char sprites can have a lot of different variations..
(i think thats a bit to much,but it could be done..)

if you are interressted in how the plugin works ..here is it:
terms are MIT free to use and free to edit
dopanLoad_ImgOnEvent.js
 
Last edited:

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
278
Reaction score
163
First Language
Swedish
Primarily Uses
N/A
the imgs are stored in your folder..

and the default sprite plugin loads them and makes sprites of them.

i made a plugin that can add child sprites to the gameplayer, related to region id.
(thats for visual changes related to the Map backround, like beeing in water or in deep grass)
this was requested here#1

its planed to upgrade this plugin to show the most default weapon on gameplayer related to the equiped weapon type of "gameparty leader"

a similar thing could be made for armor stuff, but ts not planed because armor char sprites can have a lot of different variations..
(i think thats a bit to much,but it could be done..)

if you are interressted in how the plugin works ..here is it:
terms are MIT free to use and free to edit
dopanLoad_ImgOnEvent.js
Well, I didn't ask for storage folder :p But then it would be the "sprites" that I am after in that case. So then making children to say a battler and character image would be possible. So, are all images turned into "sprites" when loaded into the game?

Thanks, I will see what the plugin does and I'll see what I can apply to my project :)
 

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,299
Reaction score
692
First Language
German
Primarily Uses
RMMV
Well, I didn't ask for storage folder :p But then it would be the "sprites" that I am after in that case. So then making children to say a battler and character image would be possible. So, are all images turned into "sprites" when loaded into the game?

Thanks, I will see what the plugin does and I'll see what I can apply to my project :)
read also the thread where this was requested , there i showed the main code,..here#12
..which is shorter than the plugin code.
that might be helpfull to figure out how it works

also you can study the rpg sprites plugin
 

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
278
Reaction score
163
First Language
Swedish
Primarily Uses
N/A
read also the thread where this was requested , there i showed the main code,..here#12
..which is shorter than the plugin code.
that might be helpfull to figure out how it works

also you can study the rpg sprites plugin
Hello!

Thanks, making good strides here. Not a lot of time to work on it atm, but I am currently trying to locate the crop location function or parameter for it. I.e. how to I display the second character in a character sheet? Or even a specific tile in a character sheet?

I'm likely to figure it out eventually, but if you're online and see this, maybe you know and can inform me :)
 
Last edited:

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,299
Reaction score
692
First Language
German
Primarily Uses
RMMV
you can see that in the plugin


you have 4 things to put in the "setframe"

those 2, which are the same on all 8 chars

var pw = this.patternWidth();
var ph = this.patternHeight();

and
var sx0 = (0 + this.characterPatternX()) * pw;
var sy0 = (this.characterPatternY()) * ph;

these 2 which have extra numbers in the name

number 0 is the first char, number 1 is the second char ect
(it starts with 0 )


another example:

var pw = this.patternWidth();
var ph = this.patternHeight();

var sx3 = (9 + this.characterPatternX()) * pw;
var sy3 = (this.characterPatternY()) * ph;
---
9 + this.characterPatternX()
top part nine frames more to the right
---------------------------------------
as we have 3x4 frame chars, with starting after 9 thats the charNR4 on the top part of the img (pink haired girl)
-----------------
-----------------
1 last example
var pw = this.patternWidth();
var ph = this.patternHeight();

var sx6 = (6 + this.characterPatternX()) * pw;
var sy6 = (4 + this.characterPatternY()) * ph;

this is char nr7 .. 6+ frames from left to right
(blonde_guy) ... 4+ frames from up to down
the numbers tells us where the system starts to display(3x4 frames)

after 6 frames and after 4 frames
with other words it will display the char frame from 5 to 8

and it will display the char frame from 7 to 9
=> 3x4 frames .. and thats the guy with yellow hair^^
Actor1.png


Screenshot_1.png
 
Last edited:

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
278
Reaction score
163
First Language
Swedish
Primarily Uses
N/A
you can see that in the plugin


you have 4 things to put in the "setframe"

those 2, which are the same on all 8 chars

var pw = this.patternWidth();
var ph = this.patternHeight();

and
var sx0 = (0 + this.characterPatternX()) * pw;
var sy0 = (this.characterPatternY()) * ph;

these 2 which have extra numbers in the name

number 0 is the first char, number 1 is the second char ect
(it starts with 0 )


another example:

var pw = this.patternWidth();
var ph = this.patternHeight();

var sx3 = (9 + this.characterPatternX()) * pw;
var sy3 = (this.characterPatternY()) * ph;
---
9 + this.characterPatternX()
top part nine frames more to the right
---------------------------------------
as we have 3x4 frame chars, with starting after 9 thats the charNR4 on the top part of the img (pink haired girl)
-----------------
-----------------
1 last example
var pw = this.patternWidth();
var ph = this.patternHeight();

var sx6 = (6 + this.characterPatternX()) * pw;
var sy6 = (4 + this.characterPatternY()) * ph;

this is char nr7 .. 6+ frames from left to right
(blonde_guy) ... 4+ frames from up to down
the numbers tells us where the system starts to display(3x4 frames)

after 6 frames and after 4 frames
with other words it will display the char frame from 5 to 8

and it will display the char frame from 7 to 9
=> 3x4 frames .. and thats the guy with yellow hair^^
View attachment 208657


View attachment 208655
Ah okay, I see. I wasn't finding that in the plugin, probably because I assumed it was directly tied to the parents character. I tried it with the code below. But the reply from you explains why it only worked for the idle frame. Also caused an issue where the first move didn't have an animation, so the character was just sliding.
Code:
var sx = (this.characterPatternX()) * pw + armorIndex * 48;
var sy = (this.characterPatternY()) * ph;

This seems to do the trick:
JavaScript:
var sx = (armorIndex * 3 + this.characterPatternX()) * pw;
var sy = (this.characterPatternY()) * ph;
 
Last edited:

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,299
Reaction score
692
First Language
German
Primarily Uses
RMMV
Ah okay, I see. I wasn't finding that in the plugin, probably because I assumed it was directly tied to the parents character. I tried it with the code below. But the reply from you explains why it only worked for the idle frame. Also caused an issue where the first move didn't have an animation, so the character was just sliding.
Code:
var sx = (this.characterPatternX()) * pw + armorIndex * 48;
var sy = (this.characterPatternY()) * ph;

This seems to do the trick:
JavaScript:
var sx = (armorIndex * 3 + this.characterPatternX()) * pw;
var sy = (this.characterPatternY()) * ph;
i am not sure why you think "armor index" should be inthere..

all positions of a 8sheet char img are shown in the plugin code.

if you have armors on an img, you have to trigger the img the same way.. only difference is the "triggers if condition", that should be related to the chars equiped armor, instead beeing related to the region ID ..
the plugin uses regionID in order to only trigger at the right position.
 

ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
522
Reaction score
432
First Language
English
Primarily Uses
RMMV
You could also utilize the current chara sheet layout to achieve this. Instead of characters sharing sheets, you could have multiple armor variations for one character on a sheet and change the character Index based on equipped armor. I believe there is a plugin that can run code when gear is equipped and unequipped.

If you search the $gameActors object, you'll see that each actor has the property "_characterIndex". This property selects the index of frames to apply to each actor from the image file designated in the "_characterName" property, as you mentioned above.

The only problem with using a script to directly change an actor's character index is that the changes won't take effect until the map updates.


-EDIT-

It looks like "$gamePlayer.refresh();" will work to refresh the character images. And you can get the On Equip Eval plugin here.

Here's an exmple of a scirp that might work using the above plugin:

<Custom On Equip Eval>
user._characterIndex = 1;
$gamePlayer.refresh();
</Custom On Equip Eval>

I don't have the plugin installed so I'm not able to test directly but I think this is worth a shot. Remember when choosing an index that index 0 is the first set of character images, 1 is the second set, and so on. So the above notetag would change the equipping actor's character image to the second set of images in whatever image file the actor is using for its original sprite set in the editor.

You might also want to use the remove notetag to set a default image in the event that the character removes all equipment that changes the index:

<Custom On Remove Equip Eval>
user._characterIndex = 0;
$gamePlayer.refresh();
</Custom On Remove Equip Eval>

If I were to set something like this up, I would probably use the 0 index of each sprite sheet for the actor's default.

I think its also worth noting that in this setup, having multiple equips that cnage the actors sprite will override one another and the most recent equip will control the actor's sprite. The easy solution to this is to only have 1 equip type that can change the look of an actor, so only one can be equipped at a time.

Hope this helps! Let me know if it works or not.
 
Last edited:

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
278
Reaction score
163
First Language
Swedish
Primarily Uses
N/A
i am not sure why you think "armor index" should be inthere..

all positions of a 8sheet char img are shown in the plugin code.

if you have armors on an img, you have to trigger the img the same way.. only difference is the "triggers if condition", that should be related to the chars equiped armor, instead beeing related to the region ID ..
the plugin uses regionID in order to only trigger at the right position.
armorIndex is selfmade variable.

You could also utilize the current chara sheet layout to achieve this. Instead of characters sharing sheets, you could have multiple armor variations for one character on a sheet and change the character Index based on equipped armor. I believe there is a plugin that can run code when gear is equipped and unequipped.

If you search the $gameActors object, you'll see that each actor has the property "_characterIndex". This property selects the index of frames to apply to each actor from the image file designated in the "_characterName" property, as you mentioned above.

The only problem with using a script to directly change an actor's character index is that the changes won't take effect until the map updates.


-EDIT-

It looks like "$gamePlayer.refresh();" will work to refresh the character images. And you can get the On Equip Eval plugin here.

Here's an exmple of a scirp that might work using the above plugin:

<Custom On Equip Eval>
user._characterIndex = 1;
$gamePlayer.refresh();
</Custom On Equip Eval>

I don't have the plugin installed so I'm not able to test directly but I think this is worth a shot. Remember when choosing an index that index 0 is the first set of character images, 1 is the second set, and so on. So the above notetag would change the equipping actor's character image to the second set of images in whatever image file the actor is using for its original sprite set in the editor.

You might also want to use the remove notetag to set a default image in the event that the character removes all equipment that changes the index:

<Custom On Remove Equip Eval>
user._characterIndex = 0;
$gamePlayer.refresh();
</Custom On Remove Equip Eval>

If I were to set something like this up, I would probably use the 0 index of each sprite sheet for the actor's default.

I think its also worth noting that in this setup, having multiple equips that cnage the actors sprite will override one another and the most recent equip will control the actor's sprite. The easy solution to this is to only have 1 equip type that can change the look of an actor, so only one can be equipped at a time.

Hope this helps! Let me know if it works or not.

Indeed, I did have that set up and it is written in the intro of the text that I was doing that originally but that I'd prefer to not do that since it will allow me for more freedom and easier configuration. E.g. I can change the character's hair, helmet, cloak and armor with ease and not have to worry about having a character sheet for character times the amount of clothing options and potential combinations.

And using a plugin counteracts what I am trying to achieve in terms of understanding javascript better. Rather, I am just aliasing the function for changeEquip as it will work better and give me more clarity in the console.
JavaScript:
(function(alias) {
    Game_Actor.prototype.changeEquip = function() {
        alias.apply(this, arguments);
        try {
            this.setShowArmor();
        } catch(e) {
            console.error(e);
        };
    }
}) (Game_Actor.prototype.changeEquip);
};

At any rate, the plugin I've made does work now in the way I desire :)
 
Last edited:

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,299
Reaction score
692
First Language
German
Primarily Uses
RMMV
armorIndex is selfmade variable.


(..)

At any rate, the plugin I've made does work now in the way I desire :)
perhaps you can use your selfmade var "armorindex" as "if condition", for the trigger in the "update frame" function..
But it has nothing to do in the "setFrame" stuff


the "setframe stuff" only handles which part of the loaded img is displayed..

the "if contition" is used to tell the "Update frame function" at which condition this should be triggered.

so if you want to display armor stuff the best way would be:

put the armor on an clean img at the correct position.. and use a if condition that is related to the equiped armor of the partyleader..
(if thats for the gameplayer)

And thats where my advice ends , because explaining step by step how to build a plugin makes more work ,(atleast for me) than building the plugin myself..
 

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
278
Reaction score
163
First Language
Swedish
Primarily Uses
N/A
perhaps you can use your selfmade var "armorindex" as "if condition", for the trigger in the "update frame" function..
But it has nothing to do in the "setFrame" stuff


the "setframe stuff" only handles which part of the loaded img is displayed..

the "if contition" is used to tell the "Update frame function" at which condition this should be triggered.

so if you want to display armor stuff the best way would be:

put the armor on an clean img at the correct position.. and use a if condition that is related to the equiped armor of the partyleader..
(if thats for the gameplayer)

And thats where my advice ends , because explaining step by step how to build a plugin makes more work ,(atleast for me) than building the plugin myself..
1638715075954.png
armorIndex determines which index the armor has. When changing equipment it sets the variable to the corresponding armorIndex and weight class. if armorType(which you cant see in my posted snippets of code) == "heavy" and armorIndex == 3 then you'll get the 3rd heavy armor displayed on the character.

Can't see why it would be better using an if statement.

Especially considering this will be used not just by the character, but also the battlers and face images. Meaning getting the data from a single variable, in my opinion, seems more reliable and easier to customize in terms of changing something.
 

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,299
Reaction score
692
First Language
German
Primarily Uses
RMMV
View attachment 208825
armorIndex determines which index the armor has. When changing equipment it sets the variable to the corresponding armorIndex and weight class. if armorType(which you cant see in my posted snippets of code) == "heavy" and armorIndex == 3 then you'll get the 3rd heavy armor displayed on the character.

Can't see why it would be better using an if statement.

Especially considering this will be used not just by the character, but also the battlers and face images. Meaning getting the data from a single variable, in my opinion, seems more reliable and easier to customize in terms of changing something.
the Plugin i showed uses 3 functions:

Sprite_Character.prototype.updateCharacterFrame

this is an update function, and its the final trigger, it needs a "if condition"..
.. to decide when stuff happens


Sprite_Character.prototype.setCharacterBitmap
this is used to load the img

Sprite_Character.prototype.createImgLoad
this is used to setup the IMG parts from the loaded img,that will be triggered with the update frame funtion
--------------------------------------------------------------------
the "if condition" is required.. and you can use as much "if conditions" as you want in the updateCharacterFrame-function..
or else you will have no trigger, that does use the Setup which you build..
no matter how this "setup" looks like..
 

ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
522
Reaction score
432
First Language
English
Primarily Uses
RMMV
I think the suggestion was to use
if (armorIndex) {}
To handle the updating of the images.
 

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,299
Reaction score
692
First Language
German
Primarily Uses
RMMV
I think the suggestion was to use
if (armorIndex) {}
To handle the updating of the images.
correct, but that isnt enough.. you also need script about on which char this is used..
(the gameplayer, any event or the battler or whatever..)

my plugin only trys to trigger the "gameplayer" or "all events" ..
thats why i used :

for gameplayer:

if (!this._character.eventId) {}
(the only sprite_character that has no event id on map is the gameplayer)
"!" means "no"..
,, in that context this script says:
-> if this sprite Char has no event id


for all events:
if (this._character.eventId) {}
(all events have an event id)
in that context this script says:
-> if the sprite Char has an event Id



EDIT
About default rpg projects that use sideview battles,this happen in the battle scene, i am not sure how to make any changes there..
-> but you should find the needed infos in the default rpg sprite plugin,
in order to figure out how to make changes in the
battle scene..

And Face IMGs and how they are loaded is probably handled somewhere else aswell
-> the 3 functions which i explained here, are for the spriteChar of mapChars (thats in the map scene)
--------------------------------------
.. also i am not sure if loading and updating a lof of imgs can make fps loss..
i fear that the more imgs you load , the easier you can get fps loss.
-> but i could be wrong on this theorie..
 
Last edited:

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
278
Reaction score
163
First Language
Swedish
Primarily Uses
N/A
correct, but that isnt enough.. you also need script about on which char this is used..
(the gameplayer, any event or the battler or whatever..)

my plugin only trys to trigger the "gameplayer" or "all events" ..
thats why i used :

for gameplayer:

if (!this._character.eventId) {}
(the only sprite_character that has no event id on map is the gameplayer)
"!" means "no"..
,, in that context this script says:
-> if this sprite Char has no event id


for all events:
if (this._character.eventId) {}
(all events have an event id)
in that context this script says:
-> if the sprite Char has an event Id



EDIT
About default rpg projects that use sideview battles,this happen in the battle scene, i am not sure how to make any changes there..
-> but you should find the needed infos in the default rpg sprite plugin,
in order to figure out how to make changes in the
battle scene..

And Face IMGs and how they are loaded is probably handled somewhere else aswell
-> the 3 functions which i explained here, are for the spriteChar of mapChars (thats in the map scene)
--------------------------------------
.. also i am not sure if loading and updating a lof of imgs can make fps loss..
i fear that the more imgs you load , the easier you can get fps loss.
-> but i could be wrong on this theorie..
Indeed, the armor index is based on this. It is applied to the gameplayer and the actors. But yeah, I mean, you don't see the code I am using. Just that I moved the variable from outside the pattern calculation into the parenthesis.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,742
Reaction score
9,291
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

I've got good news and bad news. The good news is, there aren't any bad news to report. The bad news is, there aren't any good news to report.

Or as others say, yesterday was uneventful.


I am curious that can you "understand/get the point" about what does this place do generally?
(ARPG game)
If anyone knows any C# programmers, please send them my way.
Chilling at night in a tavern.
ChillingAtTavern.png

After 'multiple breakdowns', it's finally over. 10/10 will do this again.
Ever notice that villains can reform and become better people, but heroes can only ever die... or live long enough to see themselves become villains?

Isn't that interesting?

Forum statistics

Threads
129,844
Messages
1,205,657
Members
171,000
Latest member
Nurseval
Top