MV Bush Opacity Change to a variable value with script or plugin

Hello everyone, I'm sorry for insisting but I definitely need help on opacity and bushes.
I'm using MV and I'd like to change at my will the bush opacity by a variable value. Some community respectful members helped about changing bush depth and there is a plugin by CT_Bolt which effectively changes opacity, but it somehow doesn't refresh very well and it isn't changing by variable value. Can someone help me?

This thread has all the sources:

Thanks to anyone willing to help! 😀
persisting a new thread is probably not allowed if you are asking for it.
best way is to bump it, and not everyone has the time to help on the
fly on it.

if you really need it, why not just bump the topic while you continue
on something else, giving the community a way to help you out if they knew?

have some patience though as we live in different time zones.
you're right however I've bumped three times, thought it was a less bad behavior to make another thread, if it's OK to rebump then I'd rebump!
after 72 hours, you can bump if needed, but there are also workarounds.
I can look later in it if you still need it and set it to a variable if you require it.
the opacity might not be a default option for bush if not added, so it require
some coding probably to add it.

I dont know ct_bolt bush plugin as it was on the browser, but doesn't seem
to work as it probably should.

just give it some time, if noone replies to help you, I might have some time
at the end of this month to look into it (with no promises).

so clear you head, do something else, and keep look at your thread the next
time you look at it.

as if you dont have a demo close or no deadline, than dont worry to much
on it, but try avoiding making threads on the same topic as alot of people
require help as well.

as we as community does this for free, so you need to have some patience,
if you have a deadline, why not commission it otherwise?
you're right, I'll wait more. No specific deadlines, however I'm stuck otherwise. Thank you, yes I've tried in the classified section too, but got no replies..
I'm using MV and I'd like to change at my will the bush opacity by a variable value. Some community respectful members helped about changing bush depth and there is a plugin by CT_Bolt which effectively changes opacity, but it somehow doesn't refresh very well and it isn't changing by variable value.

Fixed a couple things, everything should work now from what I can tell, briefly tested
[v0.41]:

Example notetag for events/actors looks like this:
<bush:{"depth":"$gameVariables.value(2)","opacity":"$gameVariables.value(1)"}>

After changing the variables it will need to refresh the bush depth of chosen events/actors with code like this:
Code:
$gameMap.event(2).refreshBushDepth()

Sooo yep seems to work pretty nicely from my brief testing..
Got it to do something like this:


Let me know how it goes 🙂
I'll try in minutes, will let you know by Edit.
However on a quick glance I'd need to change the global bush opacity value by a variable, not a specific event or player one. Is that possible? What Shaz did with a small plugin extension was to mod sprites.js to set a variable in depth value.

EDIT: unfortunately it doesn't work as needed 🙁

Shaz solution to depth bush problem is what I need, but for opacity:

Code:
Game_CharacterBase.prototype.refreshBushDepth = function() {
    if (this.isNormalPriority() && !this.isObjectCharacter() &&
            this.isOnBush() && !this.isJumping()) {
        if (!this.isMoving()) {
            this._bushDepth = $gameVariables.value(50);
        }
    } else {
        this._bushDepth = 0;
    }
};

Something flexible and global which can be used withouth notetags, events or player additional commands 🙁
Fixed a couple things, everything should work now from what I can tell, briefly tested
[v0.41]:

Example notetag for events/actors looks like this:
<bush:{"depth":"$gameVariables.value(2)","opacity":"$gameVariables.value(1)"}>

After changing the variables it will need to refresh the bush depth of chosen events/actors with code like this:
Code:
$gameMap.event(2).refreshBushDepth()

Sooo yep seems to work pretty nicely from my brief testing..
Got it to do something like this:


Let me know how it goes 🙂

@ct_bolt don't you think it would be very convenient for the average user like joket to simplify the notetag for events and actors?
@ct_bolt don't you think it would be very convenient for the average user like joket to simply the notetag for events and actors?
actually i can't notetag events and players because I'd like instead to mark regions with different opacities. This way it would be best just to have a small script (within a common event or as a small plugin like the Shaz one) that allows the opacity to set as a given variable value. This way when for example the player goes into the grass, region is 1 and event 1 is called setting variable to an X value. When player goes to another region for example sand, then variables changes. In my game, this would fit better, because it should work for all the events and player too, so be able to change the core opacity and depth with just a variable value is way better and smoother. I think solution is close enough because that plugin of CT does very cool stuffs, however it is slightly not in tune to what exactly needed
actually i can't notetag events and players because I'd like instead to mark regions with different opacities. This way it would be best just to have a small script (within a common event or as a small plugin like the Shaz one) that allows the opacity to set as a given variable value. This way when for example the player goes into the grass, region is 1 and event 1 is called setting variable to an X value. When player goes to another region for example sand, then variables changes. In my game, this would fit better, because it should work for all the events and player too, so be able to change the core opacity and depth with just a variable value is way better and smoother. I think solution is close enough because that plugin of CT does very cool stuffs, however it is slightly not in tune to what exactly needed
Sorry about the confusion. I meant that those notetags could be simplified.
Fixed a couple things, everything should work now from what I can tell, briefly tested
[v0.41]:

Example notetag for events/actors looks like this:
<bush:{"depth":"$gameVariables.value(2)","opacity":"$gameVariables.value(1)"}>

After changing the variables it will need to refresh the bush depth of chosen events/actors with code like this:
Code:
$gameMap.event(2).refreshBushDepth()

Sooo yep seems to work pretty nicely from my brief testing..
Got it to do something like this:


Let me know how it goes 🙂

Hi CT-bolt your plugin is great, however unfortunately it doesn't work as I need 🙁

Shaz apporach to depth bush problem is what I need for opacity:

Code:
Game_CharacterBase.prototype.refreshBushDepth = function() {
    if (this.isNormalPriority() && !this.isObjectCharacter() &&
            this.isOnBush() && !this.isJumping()) {
        if (!this.isMoving()) {
            this._bushDepth = $gameVariables.value(50);
        }
    } else {
        this._bushDepth = 0;
    }
};

This is a small code that overwrite the refreshbushdepth function and this way is something flexible and global which can be used withouth notetags, events or player additional commands 🙁
Is that possible for the default engine funcion?

Code:
Sprite_Character.prototype.createHalfBodySprites = function()
@joket when checking ct_bolts plugins, you might be able to
get it globally, just try it out.

on line 59: change $['Default Depth'] to eval($['Default Depth'])
this can set default depth param to $gameVariables.value(x)

on line 83: change $['Default Opacity'] to eval($['Default Opacity'])
this can set default depth param to $gameVariables.value(y)

this might work out for you for global part as well.

keep in mind that the refresh scriptcall is required, but not sure
how it works out globally though.
@ct_bolt don't you think it would be very convenient for the average user like joket to simplify the notetag for events and actors?
I considered it, I might
This script was more of just a test for me that I wrote years ago.. so never really made it user friendly

actually i can't notetag events and players because I'd like instead to mark regions with different opacities. This way it would be best just to have a small script (within a common event or as a small plugin like the Shaz one) that allows the opacity to set as a given variable value. This way when for example the player goes into the grass, region is 1 and event 1 is called setting variable to an X value. When player goes to another region for example sand, then variables changes. In my game, this would fit better, because it should work for all the events and player too, so be able to change the core opacity and depth with just a variable value is way better and smoother. I think solution is close enough because that plugin of CT does very cool stuffs, however it is slightly not in tune to what exactly needed
I will make it work as needed when I out of work today
Moderator note: @joket please do not make multiple threads for the same thing.

Now there are two threads to keep track of.
Moderator note: @joket please do not make multiple threads for the same thing.

Now there are two threads to keep track of.
sorry, I was anxious because otherwise I wasted a lot of already done work 🙁
I considered it, I might
This script was more of just a test for me that I wrote years ago.. so never really made it user friendly


I will make it work as needed when I out of work today
Thank you very much for your help!
sorry, I was anxious because otherwise I wasted a lot of already done work 🙁

Thank you very much for your help!

Ok sooo... I have made things to do what you asked, however after re-reading what your aiming for I might need to develop a whole new part for the script for region/terrain tagging to make each player/event "obey" the rules (depth, opacity) of the regions/terrain per bush instead of variables (as you requested)

Anyways... without further ado.. here is the run down...
I remade and overhauled basically everything...

I'll try my best to explain how to achieve good results:
Redownload the new version of my bush plugin:

Setup something like this via parameters:
Spoiler: BushEx Parameters
1674805792530.png

That will give you the ability to change ALL bush settings for every player/event/etc. with the chosen variables, this will not auto refresh depth though.

..that is where my next helpful script comes in at...

Download my ObjectEx plugin:

This plugin does a few handy things, the one we are going to use is execute code whenever variable(s) are changed like this:
Spoiler: ObjectEx Parameters
1674806349562.png

Ok so that's that.

That would do something like this:
Events shown in the video were set like this:
Spoiler
1674807318847.png


1674807399922.png
Oh yeah probably should note you don't have to use the script call like I did for "bush opacity"
That is just what I named variable #2
Spoiler
1674807674602.png
Then I just took advantage of another feature of my ObjectEx plugin which allows to use variables by name

Now this next possibly helpful plugin is a doosie & you might not require it but certainly can be helpful but requires some setup:

With this plugin you can run custom code when player/events/followers/etc. enters/moving on specified regions via map notetags... so in other words you can set it to change a variable upon the player/event(s)/etc. being in certain regions
& of course it can do much much more... I'm just gonna leave that one there for now.. I'm very tired & can't explain it fully at the moment, but feel free to try it out if you can use the help document... I'll explain further later if you need me to.

I think my next plan for the bush plugin though is to simplify the whole process by allowing custom settings via terrain tags.

Well there you have it, let me know how it goes. :popcorn:
It works greatly! What is even more interesting is the clever way you combined objectsEx.js plugin, which is a very interesting plugin, it opens a lot of possibilities!

However, a few fix to suggest you:
- if a spawned event is spawned in a bush with the YEP spawn event plugin, the event is not spawned and the following error is shown:
1674824545318.png


Is there a clever way to fix this? I've solved the error by commenting the lines 96 and 97 (but I guess now the script won't word with events)

- if the list of switches in the CTB_ObjectEx.js is empty from the plugin manager, the following error is returned in the console:

1674822184530.png


This is easily solved by adding e.g. switch 1 with an empty code.

- Opacity is set as an inverted value: e.g. if variable is set as 0, it returns the default 128 (which is how it was marked in the plugin [variable value || 128]. However, if the variable value is 1, the bush opacity is showing as if it was set at 254; if the variable value is 255, the bush opacity is seen as 0 (meaning if the opacity variable is set at 1 value, the bush covers the player entirely, while if the value is 255 then the bush is transparent). However that won't matter if one knows of that! 😀

p.s: what are the terms of use of these plugins? commercial and non-commercials with credit? should I buy rights to use? let me know!
@joket can we see your plugin database? to be sure your YEP plugins
are in order? as it works on my end.

so it can be a conflict or a wrong order to give you that order.

Original thread: https://forums.rpgmakerweb.com/threads/bush-opacity-change-to-a-variable-value-with-script-or-plugin.154403/