Moghunter Actor CM change picture

faerin

Villager
Member
Joined
Aug 23, 2016
Messages
23
Reaction score
2
First Language
English
Primarily Uses
Hello everybody!


I'm using MOG_ActorPictureCM plugin, which shows an actor picture on the screen when it's his/her turn according to their actor ID (the pictures are labeled actor1.png, actor2.png...). The plugin is used in a Sailor Moon project made with RPG Maker MV. I'm making for my nieces as Christmas gift.


I have two requests, if either one would be answered, it would be much appreciated.


- If someone is familiar with the sailor senshi, they can transform. With the help of Yanfly actor transformation tip (http://yanfly.moe/2016/07/06/tips-tricks-actor-transformations-rpg-maker-mv/), I was finally able to let the girls transform. The problem is, I'm only able to change the battlers, not the big picture shown by MOG_ActorPictureCM plugin.


Is there any way for me to change the actor's graphic shown by MOG_ActorPictureCM plugin during battle transformation, for example when transforming they'll use actor1_1.png?


- I would like to ask if it's possible to make one character change their picture after a job promotion (permanently), like after a certain event/acquiring certain job/item, they'll use actor_1_A.png instead of the default actor_1.png. I only have limited knowledge when it comes to programming, and the only way I know to change the picture shown by MOG_ActorPictureCM is to change the whole actor since the pictures are labeled after the actor's ID, but that will cause a lot of problems. I was thinking about grabbing a clone plugin to clone the actor to a different ID, but it causes issues to other conditions (i.e: if actor# is in the party) or common events.


Any kind of help and advice would be very much appreciated. Of course, credit will be given to the person who will help me.


I have the plugin attached and this is where I got the script: (https://atelierrgss.wordpress.com/rmv-actor-picture-cm/). If it's a very difficult thing to do and you would like something in return, please let me know and I'll see if it's within my power.


I'm currently at work so I don't have RMMV with me, but I can post the screenshot if necessary, once I got home.


Thank you again and I hope everyone will have a nice day!

View attachment MOG_ActorPictureCM.js
 

Punamaagi

Hero on their own terms
Veteran
Joined
Jan 23, 2016
Messages
211
Reaction score
313
First Language
Finnish
Primarily Uses
RMMV
While I'm not too familiar with Moghunter's plugins or scripts (partly because I can't speak Portuguese), it looks like the plugin allows you to define a second image for all actors. The pictures need to be named Actor_ ID + b.png; in other words, for actor 1, the second file would be named Actor_1b.png.


Unfortunately, I couldn't deduce from the code how or when these secondary pictures are used, so you might need to ask the plugin creator for more instructions (unless it's defined in one of their other plugins).
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
Hi!


Paste the following code inside the plugin file at line 226, replacing the original function. I suggest commenting out the original function using // at the lines beginning.


It should then look like this:


//Actor_CMPicture.prototype.fileName = function() { //Alteration Here
// return String("Actor_" + this._actor._actorId)
//};
Actor_CMPicture.prototype.fileName = function() { //Alteration Here
var v = function(id) {
return $gameVariables.value(id);
}
var string;
if ($dataActors[this._actor._actorId].meta.cmPicture) {
string = eval($dataActors[this._actor._actorId].meta.cmPicture)
} else {
string = String("Actor_" + this._actor._actorId);
}
return string
};




What this will allow you to do is to use a notetag to define the image file to use.


Then set up your actors with the notetag: <cmPicture: v(id)> replacing id with the id of a game variable. You'll the use the game variable to hold the picture name for your actor.


ex: <cmPicture: v(1)>


This will make the plugin look at the value of the game variable n*1 to pick what image to display.


You have to set the variable with the proper name at the beginning of the game, using Control variable: Script.


ex: Control Variable: Script: "Actor_1"


You have to use the quotes mark to provide the file name.


Then to change the displayed picture, just change the value of that variable


ex Control Variable: Script: "Actor_1Transform".


I tested it for a bit and it worked just fine, tell me how it goes for you.


I don't speak a single word of portuguese so I couldn't look at the instructions to see if there was another way so I whipped this up quickly.


Also, just report your threads and/or posts asking for them to be deleted and the mods will take care of it. There's no alternative that I know of.
 

faerin

Villager
Member
Joined
Aug 23, 2016
Messages
23
Reaction score
2
First Language
English
Primarily Uses
While I'm not too familiar with Moghunter's plugins or scripts (partly because I can't speak Portuguese), it looks like the plugin allows you to define a second image for all actors. The pictures need to be named Actor_ ID + b.png; in other words, for actor 1, the second file would be named Actor_1b.png.


Unfortunately, I couldn't deduce from the code how or when these secondary pictures are used, so you might need to ask the plugin creator for more instructions (unless it's defined in one of their other plugins).


Thank you for your reply! The plugin does offer a second image for all actors, but it's not for alternate picture, only for an additional image to be used along with the first one for better visual, both pictures are shown at the same time.


Moghunter made a demo, and in the screenshot below the actor_1b.png picture is the vertical picture on the right side, while the red lady is actor_1.png.


moghunter.jpg


I'm looking to replace the picture without having to change the actor ID themselves. I tried to send an email to Moghunter to show my appreciation and to ask about it a week ago or so but Moghunter probably doesn't have time to respond or they don't feel much comfortable with email written in English. I unfortunately can't speak Portuguese either, and I was afraid that google translate might offend them. :(

Hi!


Paste the following code inside the plugin file at line 226, replacing the original function. I suggest commenting out the original function using // at the lines beginning.


It should then look like this:



//Actor_CMPicture.prototype.fileName = function() { //Alteration Here
// return String("Actor_" + this._actor._actorId)
//};
Actor_CMPicture.prototype.fileName = function() { //Alteration Here
var v = function(id) {
return $gameVariables.value(id);
}
var string;
if ($dataActors[this._actor._actorId].meta.cmPicture) {
string = eval($dataActors[this._actor._actorId].meta.cmPicture)
} else {
string = String("Actor_" + this._actor._actorId);
}
return string
};




What this will allow you to do is to use a notetag to define the image file to use.


Then set up your actors with the notetag: <cmPicture: v(id)> replacing id with the id of a game variable. You'll the use the game variable to hold the picture name for your actor.


ex: <cmPicture: v(1)>


This will make the plugin look at the value of the game variable n*1 to pick what image to display.


You have to set the variable with the proper name at the beginning of the game, using Control variable: Script.


ex: Control Variable: Script: "Actor_1"


You have to use the quotes mark to provide the file name.


Then to change the displayed picture, just change the value of that variable


ex Control Variable: Script: "Actor_1Transform".


I tested it for a bit and it worked just fine, tell me how it goes for you.


I don't speak a single word of portuguese so I couldn't look at the instructions to see if there was another way so I whipped this up quickly.


Also, just report your threads and/or posts asking for them to be deleted and the mods will take care of it. There's no alternative that I know of.




Thank you so so muchly for answering this and for your time doing this for me! Forgive my idiocy, but when I tried to change the value from "Actor_2" to "Actor_2_2" it remained the same Actor_2. I pasted your code to below line 226 as instructed, I've attached the js file below.


I then put on a notetag "<cmPicture: v(100)>" onto a character:


11.jpg


Set a Variable script:


12.jpg


The game still runs normally with Actor_2.png as Picture CM, but after I tried to change the variable: script:


13.jpg


It remains the same Actor_2.png. I tried to include the file extension  "Actor_2_2.png" and it doesn't work still. I'm so sorry for my lack of experience, and for bothering you, but may I ask for some enlightenment here? Or, may I have your demo, if it's not too much trouble?


Thank you so much again!

View attachment MOG_ActorPictureCM2.js
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
You're welcome. 


My instructions were badly worded so you didn't understand them properly...


You've edited the plugin wrongly. I've attached the plugin file I use. In hindsight I should have done that in the first place.


Try with this one and tell me if it works.


The rest of the usage looks fine to me. Don't put the file extension in the file names.


View attachment MOG_ActorPictureCM.js
 
Last edited by a moderator:

faerin

Villager
Member
Joined
Aug 23, 2016
Messages
23
Reaction score
2
First Language
English
Primarily Uses
You're welcome. 


My instructions were badly worded so you didn't understand them properly...


You've edited the plugin wrongly. I've attached the plugin file I use. In hindsight I should have done that in the first place.


Try with this one and tell me if it works.


The rest of the usage looks fine to me. Don't put the file extension in the file names.


View attachment 52182


Oh wow thank you so so muchly! It works for me now! Your instructions were clear and helpful, I was the dense one who wasn't able to understand. I'm just a dolt when it comes to programming!


I've a slight problem that it automatically adds a "0" after the file name. If the name I used when I set the variable at the beginning of the game was "Actor_2"


15.jpg


Then in battle it'll notify me of:


16.jpg


14.jpg


If I renamed the Actor_2.png picture to Actor_20 and Actor_2b to Actor_20b it works normally and beautifully though! So that's not really a big deal! I was just confused at first, but I wouldn't want to bother you with that minor problem, you've helped me so much already!


Thank you so very much again Astfgl66 for your kind help! I'll tell my nieces to say thank you to you when they received their Christmas gift, even if you can't hear them! I hope you have a nice day and your work fruitful!
 

faerin

Villager
Member
Joined
Aug 23, 2016
Messages
23
Reaction score
2
First Language
English
Primarily Uses
@Astfgl66


I'm sorry for bothering you again, but I have a problem with the actor transformation thingy that uses Control Variable: Script: "Actor_2_2". I use the Actor Transformation tip from Yanfly (http://yanfly.moe/2016/07/06/tips-tricks-actor-transformations-rpg-maker-mv/)

<Custom Apply Effect>
// Check if user is an actor.
if (user.isActor()) {
// Archive the previous settings.
user._prevCharName = user._prevCharName || user._characterName;
user._prevCharIndex = user._prevCharIndex || user._characterIndex;
user._prevFaceName = user._prevFaceName || user._faceName;
user._prevFaceIndex = user._prevFaceIndex || user._faceIndex;
user._prevBattlerName = user._prevBattlerName || user._battlerName;
// Check if the actor ID is 2.
} else if (user.actorId() === 2) {
// The filename of the character graphic without the file extension.
var charName = 'ThereseSSJ';
// The index of the character graphic used.
var charIndex = 0;
// The filename of the face graphic without the file extension.
var faceName = 'ThereseSSJ';
// The index of of the face graphic used.
var faceIndex = 0;
// The filename of the battler graphic without the file extension.
var battlerName = 'Therese_SSJ1';
// If none of the above actor ID's match, use this setting.
} else {
// The filename of the character graphic without the file extension.
var charName = 'HaroldSSJ';
// The index of the character graphic used.
var charIndex = 0;
// The filename of the face graphic without the file extension.
var faceName = 'HaroldSSJ';
// The index of of the face graphic used.
var faceIndex = 0;
// The filename of the battler graphic without the file extension.
var battlerName = 'Harold_SSJ1';
}
// Changes the character image to the setting applied from above.
user.setCharacterImage(charName, charIndex);
// Changes the face image to the setting applied from above.
user.setFaceImage(faceName, faceIndex);
// Changes the battler image from the setting applied from above.
user.setBattlerImage(battlerName);
// Refreshes the user's appearance.
user.refresh();
}
</Custom Apply Effect>

<Custom Remove Effect>
// Retrieve archived settings.
var charName = user._prevCharName;
var charIndex = user._prevCharIndex;
var faceName = user._prevFaceName;
var faceIndex = user._prevFaceIndex;
var battlerName = user._prevBattlerName;
// Changes the character image to the archived setting.
user.setCharacterImage(charName, charIndex);
// Changes the face image to the archived setting.
user.setFaceImage(faceName, faceIndex);
// Changes the battler image from the archived setting.
user.setBattlerImage(battlerName);
// Clear archived data.
user._priorityCharacterName = undefined;
user._priorityCharacterIndex = undefined;
user._prevFaceName = undefined;
user._prevFaceIndex = undefined;
user._priorityFaceName = undefined;
user._priorityFaceIndex = undefined;
user._prevFaceName = undefined;
user._prevFaceIndex = undefined;
user._priorityBattlerName = undefined;
user._prevBattlerName = undefined;
// Refreshes the user's appearance.
user.refresh();
</Custom Remove Effect>



But I'm not sure how to apply the control variable here. Should I use $game_variables[n] = or something?


Alternatively, I tried a more commonly known way. I created a skill to apply the Transform state on the user, giving them extra boost in Attack, Defense and stuffs.


Then I call upon a Common Event:


21.jpg


20.jpg


The event changes the control variable, and it worked beautifully!


But after the Transform state ends, is there any way for me to revert the Control Variable to the original Actor_2?


If you have an answer to either of them, would you mind letting me know? I feel bad or asking too much. I tried every methods that I know so I won't have to bother you but I still can't get it done.
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
I'm not sure where you got the  $game_variables[n] script call from, but that's from Ace and won't work in MV.


You should use:


$gameVariables.setValue(variableId,value)


For your first solution it should do the trick. Try it and tell me if it works.


For future reference you can grab a google doc with all script call equivalent of event commands in this thread:





Happy making!


Edit: Also it's very weird that it asks for an additional 0 in the file name. It doesn't when I use it in my project, so something odd is going on. I don't have much time to try and fix it though, so if it works let's keep it that way.
 
Last edited by a moderator:

faerin

Villager
Member
Joined
Aug 23, 2016
Messages
23
Reaction score
2
First Language
English
Primarily Uses
Ah, I saw that $game_variables[n] script call when I was looking for a way to use control variable in note tag, I forgot to look at the version of RPG maker! Thank you for clearing that up for me!


I tried the one you suggested for me and it worked perfectly! I had a slight problem with when the effect wears off the variable is still at Actor_2_2 but I figured that I need to set it back to Actor_2 at the <Custom Remove Effect> part too!


Thank you so muchly for your time! You've been a huge help!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,569
Latest member
Shtelsky
Top