How to change the size of the selection Highlight.

RHachicho

Veteran
Veteran
Joined
Jan 16, 2016
Messages
273
Reaction score
127
First Language
English
Hi there .. I was wondering if anyone knew how to change the size of the selection highlight? If you're wondering what I mean I am illustrating it on the screenshot below. Basically I want to make the yellow actor selection highlight thinner so it only highlights the area outside the planned menu art. Rather than just encompasses the entire actor area.


 

Leon Kennedy

Restaff Novice
Restaff
Joined
Aug 14, 2016
Messages
613
Reaction score
470
First Language
english
Primarily Uses
RMMV
Okay I found a very dirty solution.


in rpg windows.js look for this line


Window_Selectable.prototype.itemRect = function(index) {
    var rect = new Rectangle();
    var maxCols = this.maxCols();
    rect.width = this.itemWidth= 100; 
    rect.height = this.itemHeight();
    rect.x = index % maxCols * (rect.width + this.spacing()) - this._scrollX;
    rect.y = Math.floor(index / maxCols) * rect.height - this._scrollY;
    return rect;
};


Item width will make the highlight box smaller or larger you will need to adjust i just did 100 as example, do the same edit as I did for height right below it to adjust the highlight box height. Be careful though as this effects all the highlight boxes in the game not just actor menu but I don't see another way to get this done.


1231.png
 
Last edited by a moderator:

kien

Villager
Member
Joined
Dec 11, 2015
Messages
20
Reaction score
15
First Language
Chinese
Primarily Uses
N/A
It can be achieved by calling this.setCursorRect(x, y, width, height)


In default, Window_Selectable will automatically call Window_Selectable.prototype.updateCursor and use above function to set the cursor rect same as current item's rect.


You can change the return value of Window_MenuStatus.prototype.itemRect (this function should not exists in default script, just add one), or change Window_MenuStatus.prototype.updateCursor ( same as above)'s behavior to call this.setCursorRect with a desired size.


Note that this answer is assuming you using default Window_MenuStatus.
 
Last edited by a moderator:

Leon Kennedy

Restaff Novice
Restaff
Joined
Aug 14, 2016
Messages
613
Reaction score
470
First Language
english
Primarily Uses
RMMV
It can be achieved by calling this.setCursorRect(x, y, width, height)


In default, Window_Selectable will automatically call Window_Selectable.prototype.updateCursor and use above function to set the cursor rect same as current item's rect.


You can change the return value of Window_MenuStatus.prototype.itemRect (this function should not exists in default script, just add one), or change Window_MenuStatus.prototype.updateCursor ( same as above)'s behavior to call this.setCursorRect with a desired size.
Ah good advise! It would probably just be easier to call from ingame so nice find.
 
Last edited by a moderator:

RHachicho

Veteran
Veteran
Joined
Jan 16, 2016
Messages
273
Reaction score
127
First Language
English
Thanks for the answers but I'm not really script savvy. I'm getting that I want to call setCursorRect every time the actor window becomes selectable but how exactly would I do that? Would it be better to commission a plugin? I know a guy on the forums that does scripting for me when I need it for reasonable rates. But I figured something like this would have some function to change it within the editor.


If it's something I'd need a scripters help with well I know where to go from there :) But if you could give me instructions suitable for scripting dummies I can follow simple steps. Since I'm really not sure exactly what you're telling me to do here.


That being said I think I could probably manage the dirty solution .. so long as it doesn't also effect other highlights like the side menu or the choice menu ... just the actor/skill select.


Update : dirty solution doesn't seem to work for me either .. just gives me a type error : Number is not a function.
 
Last edited by a moderator:

Leon Kennedy

Restaff Novice
Restaff
Joined
Aug 14, 2016
Messages
613
Reaction score
470
First Language
english
Primarily Uses
RMMV
Thanks for the answers but I'm not really script savvy. I'm getting that I want to call setCursorRect every time the actor window becomes selectable but how exactly would I do that? Would it be better to commission a plugin? I know a guy on the forums that does scripting for me when I need it for reasonable rates. But I figured something like this would have some function to change it within the editor.


If it's something I'd need a scripters help with well I know where to go from there :) But if you could give me instructions suitable for scripting dummies I can follow simple steps. Since I'm really not sure exactly what you're telling me to do here.


That being said I think I could probably manage the dirty solution .. so long as it doesn't also effect other highlights like the side menu or the choice menu ... just the actor/skill select.
I believe he's referring to a standard plugin call via events on the very last page on the bottom right, what I posted you would either save to a notepad file as a .js making your edits first of course then just activate it like any other plugin. Or you could just go to rpg_windows and make the edit there which should be last resort. 
 

RHachicho

Veteran
Veteran
Joined
Jan 16, 2016
Messages
273
Reaction score
127
First Language
English
Yep still no clue how to do this. I know about the script call function. But I can't just run a common event to constantly set the cursor to what I want. Not only that but setting the cursor's x,y to arbitrary values breaks everything too. So I would need to know how to set up a script call to get the cursor x,y that I actually need and then set the width, height. I think it's time to see a man about a plugin. It will probably be a cheap one as I don't imagine this is complex for anyone who actually knows what they are doing. I might be able to figure it out if i take hours .. but it will stress me the eff out lol.
 

Leon Kennedy

Restaff Novice
Restaff
Joined
Aug 14, 2016
Messages
613
Reaction score
470
First Language
english
Primarily Uses
RMMV
Yep still no clue how to do this. I know about the script call function. But I can't just run a common event to constantly set the cursor to what I want. Not only that but setting the cursor's x,y to arbitrary values breaks everything too. So I would need to know how to set up a script call to get the cursor x,y that I actually need and then set the width, height. I think it's time to see a man about a plugin. It will probably be a cheap one as I don't imagine this is complex for anyone who actually knows what they are doing. I might be able to figure it out if i take hours .. but it will stress me the eff out lol.
I don't know how describe the script call more simply. Just take the code I posted save as a .js file in notepad via my documents/games/project folder/js and play with the numbers here's a reminder and I even changed the width value so it's adjustable also, all you have to do is change the numbers next to this.itemWidth= x and/or this.itemHeight=x as you wish they are on 100 just by example.


Window_Selectable.prototype.itemRect = function(index) {    var rect = new Rectangle();    var maxCols = this.maxCols();    rect.width = this.itemWidth= 100;     rect.height = this.itemHeight= 100;    rect.x = index % maxCols * (rect.width + this.spacing()) - this._scrollX;    rect.y = Math.floor(index / maxCols) * rect.height - this._scrollY;    return rect;};
 
Last edited by a moderator:

RHachicho

Veteran
Veteran
Joined
Jan 16, 2016
Messages
273
Reaction score
127
First Language
English
Yeah I understand that much. However I just get a TypeError : Number is not a function when I do that. Tried with values for the window size I want .. tried with your double 100's Type Error .. every time.
 

Leon Kennedy

Restaff Novice
Restaff
Joined
Aug 14, 2016
Messages
613
Reaction score
470
First Language
english
Primarily Uses
RMMV
Yeah I understand that much. However I just get a TypeError : Number is not a function when I do that. Tried with values for the window size I want .. tried with your double 100's Type Error .. every time.
Hmm Appears you are right, it will let you adjust the width of the screen but height will not allow to be edited for some reason. Probably needs a certain call that I'm not aware of however try this I saved as a .js file for you to use. I think its the setting you want but if not just reopen in notepad and edit the width. Obviously with this discovery though I can only help with making the highlight box smaller from one side. Sorry :/


View attachment highlight.js
 
Last edited by a moderator:

RHachicho

Veteran
Veteran
Joined
Jan 16, 2016
Messages
273
Reaction score
127
First Language
English
It's cool :) Thanks for trying! I'll give the js file a whack and if it doesn't work well .. I guess it's time to talk about commissioning a plugin hehe :)


Edit : I'm afraid that highlight.js does some very strange things to the actual windows. It seems to act on the display areas rather than the actual highlight cursor. And it doesn't just affect the actor selection it affects all the select windows making stuff like item selection windows silly big etc etc. So whatever you tried there isn't going to be a solution to the problem I'm afraid :(


Once again thank you for trying though!
 
Last edited by a moderator:

kien

Villager
Member
Joined
Dec 11, 2015
Messages
20
Reaction score
15
First Language
Chinese
Primarily Uses
N/A
Thanks for the answers but I'm not really script savvy. I'm getting that I want to call setCursorRect every time the actor window becomes selectable but how exactly would I do that? Would it be better to commission a plugin? I know a guy on the forums that does scripting for me when I need it for reasonable rates. But I figured something like this would have some function to change it within the editor.


If it's something I'd need a scripters help with well I know where to go from there :) But if you could give me instructions suitable for scripting dummies I can follow simple steps. Since I'm really not sure exactly what you're telling me to do here.


That being said I think I could probably manage the dirty solution .. so long as it doesn't also effect other highlights like the side menu or the choice menu ... just the actor/skill select.


Update : dirty solution doesn't seem to work for me either .. just gives me a type error : Number is not a function.
Sorry for the slow reply, I just have time to take a look : )


This problem will require a plugin ( or atleast some modifications on core script) If you want me to do it, please tell me what plugins you are using ( and if possible, a link to those plugins) to avoid conflicts. Then i can give you a fix for it after i gain access to my computer.
 

Leon Kennedy

Restaff Novice
Restaff
Joined
Aug 14, 2016
Messages
613
Reaction score
470
First Language
english
Primarily Uses
RMMV
Sorry for the slow reply, I just have time to take a look : )


This problem will require a plugin ( or atleast some modifications on core script) If you want me to do it, please tell me what plugins you are using ( and if possible, a link to those plugins) to avoid conflicts. Then i can give you a fix for it after i gain access to my computer.
Their only problem was that height is not adjustable, once that is reset to defaults the errors go away so the box is still customizable but only the length. Just wanted to clarify that, it does seem for height of highlight box to be adjusted either a different call needs to be made or something I'm not positive why one works and other doesn't.
 

kien

Villager
Member
Joined
Dec 11, 2015
Messages
20
Reaction score
15
First Language
Chinese
Primarily Uses
N/A
Their only problem was that height is not adjustable, once that is reset to defaults the errors go away so the box is still customizable but only the length. Just wanted to clarify that, it does seem for height of highlight box to be adjusted either a different call needs to be made or something I'm not positive why one works and other doesn't.
If he is using some menu plugin, it is possible that plugin overrides itemRect, causing yours to take no effect.


And also, mine is not to be called in Script command, but to build into his menu plugin. That's why i want him tell me what plugins he is using, to figure out what class i need to modify
 

Leon Kennedy

Restaff Novice
Restaff
Joined
Aug 14, 2016
Messages
613
Reaction score
470
First Language
english
Primarily Uses
RMMV
If he is using some menu plugin, it is possible that plugin overrides itemRect, causing yours to take no effect.


And also, mine is not to be called in Script command, but to build into his menu plugin. That's why i want him tell me what plugins he is using, to figure out what class i need to modify
Well problem is it leads to an error screen, I just tested with a brand new project script reads


Error number is not a function. But on the line right on top of it I made the same exact edit and when you enter with only width edited and not height it works. So it seems editing height is the problem but width alone is doable.
 

kien

Villager
Member
Joined
Dec 11, 2015
Messages
20
Reaction score
15
First Language
Chinese
Primarily Uses
N/A
Well problem is it leads to an error screen, I just tested with a brand new project script reads


Error number is not a function. But on the line right on top of it I made the same exact edit and when you enter with only width edited and not height it works. So it seems editing height is the problem but width alone is doable.





 






 
The error is caused by the line


rect.width = this.itemWodth = 100


this line will assign a numerical value into the property this.itemWidth, which was a function that is used heavily in default code.


after this assignment, when the system tries to call this function, it will raise an exception as you had change the value of it into a number.


Also, override functions in Window_Selectable directly are not recommended, as it will take effect to all windows, break the system heavily.


Edited:Here is a fix assuming your project is using default Window_MenuStatus. Change the values as comment state to adjust the cursor.

View attachment changeCursorRect.js
 
Last edited by a moderator:

RHachicho

Veteran
Veteran
Joined
Jan 16, 2016
Messages
273
Reaction score
127
First Language
English
The error is caused by the line


rect.width = this.itemWodth = 100


this line will assign a numerical value into the property this.itemWidth, which was a function that is used heavily in default code.


after this assignment, when the system tries to call this function, it will raise an exception as you had change the value of it into a number.


Also, override functions in Window_Selectable directly are not recommended, as it will take effect to all windows, break the system heavily.


Edited:Here is a fix assuming your project is using default Window_MenuStatus. Change the values as comment state to adjust the cursor.


View attachment 47521


This works perfectly Thanks a lot!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Are we allowed to post about non-RPG Maker games? And, if so, would any of you be interested in a short, proof of concept type non-euclidian puzzle game?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:

Forum statistics

Threads
105,883
Messages
1,017,232
Members
137,607
Latest member
Maddo
Top