Status
Not open for further replies.

Monkeynugget

Veteran
Veteran
Joined
Sep 12, 2016
Messages
77
Reaction score
50
First Language
English
Primarily Uses
So i tweaked triaconte's trigger on equip and state plugin to work with my MZ game and it works great but i'd prefer it if on unequip instead of subtracting the note tag variable it set it back to zero

I reckon its this function i need to adjust but im not sure what i'd make it say

doies anyone have any ideas :kaocry:
1618765524316.png
 

Attachments

  • TriggerOnEquipAndState.js
    21.4 KB · Views: 3

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
950
Reaction score
498
First Language
English
Primarily Uses
RMMV
The function you've circled is very short, and it just calls other functions, so you'd have to search for each of those to see which one is doing what you want to change.

Edit: I downloaded the plugin you attached, and right in the help documentation it says "When attaching / detaching, ON / OFF is switched in the case of a switch, and the value increases/decreases in the case of a variable" - so you would want to be using a switch instead of a variable.

I can't read all of the documentation because it looks to be Japanese, but on line 64 are instructions on how to make it reference a switch instead of a variable.
 
Last edited:

Monkeynugget

Veteran
Veteran
Joined
Sep 12, 2016
Messages
77
Reaction score
50
First Language
English
Primarily Uses
The function you've circled is very short, and it just calls other functions, so you'd have to search for each of those to see which one is doing what you want to change.

Edit: I downloaded the plugin you attached, and right in the help documentation it says "When attaching / detaching, ON / OFF is switched in the case of a switch, and the value increases/decreases in the case of a variable" - so you would want to be using a switch instead of a variable.

I can't read all of the documentation because it looks to be Japanese, but on line 64 are instructions on how to make it reference a switch instead of a variable.
HI thanks for the reply, unfortunately the switch would not be a viable alternative as i use the variables to call a multitude of Armor pieces and weapons so instead of 10 variables id need something like 200 switches which would be unviable.

It figure somewhere in this pluging it defines the increase and decrease and thus i'd need to re-write the decrease to just read zero but clearly im bad at reading the code XD
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
950
Reaction score
498
First Language
English
Primarily Uses
RMMV
Can you explain a little more what you're doing? That explanation didn't make a lot of sense...I can't think of why you would want to add a variable up to different values as you put on multiple pieces of equipment, then make it zero as soon as you take one off.

If you can explain the situation a bit more clearly it might help us understand how to help you, or explain why a different solution might work better.
 

Monkeynugget

Veteran
Veteran
Joined
Sep 12, 2016
Messages
77
Reaction score
50
First Language
English
Primarily Uses
Can you explain a little more what you're doing? That explanation didn't make a lot of sense...I can't think of why you would want to add a variable up to different values as you put on multiple pieces of equipment, then make it zero as soon as you take one off.

If you can explain the situation a bit more clearly it might help us understand how to help you, or explain why a different solution might work better.
Ah ok let me re-try
So
1 : I made a plugin that switches images based on variable value (1 = Heavy Armor, 2 = Light Armor)
i do this as it allows me to have a fully foldered picture section that allows for a one common event picture equip system.
2 : I use triaconte equip plugin to change the variable on equip
i,e you equip silver helmet (increase variable to 1, other plugin recognises the 1 and changes the picture to silver helmet)
2b : If you unequip it minuses 1 leaving you at zero that erases the helmet picture.
3: Now in battle if you drop below 25% health i have it increase the variable to 2, which equals 'battered helmet'
4: Issue is with this if player wins or escapes and unequips the item it minuses 1 leaving a value of 1 instead of zero.

---
2 unideal workaround i have is to on the escape and win conditions have it look for player health and minus the relevant variable back down to the orginal.
I dont like this as player would then have full health armor again despite being at 25% health and cant walk around in the banged up armor.

Second is to scrap the armor damage event but i kinda like the immersion it gives

Thus the best solution is instead of increase and decreasing variable is tweak the unequip function so it sets to zero
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
950
Reaction score
498
First Language
English
Primarily Uses
RMMV
Well, I might approach it differently :wink: But that certainly works, and it makes your request make sense.

So if we just follow the functions through the code, we end up with Game_Actor.prototype.changeVariable(). So, to make removing an item set the variable to 0, change line 437:
Code:
if (resultValue<1)
    $gameVariables.setValue(variableId, 0);
else
    $gameVariables.setValue(variableId, originalValue + resultValue);

Try that out.
 

Monkeynugget

Veteran
Veteran
Joined
Sep 12, 2016
Messages
77
Reaction score
50
First Language
English
Primarily Uses
Well, I might approach it differently :wink: But that certainly works, and it makes your request make sense.

So if we just follow the functions through the code, we end up with Game_Actor.prototype.changeVariable(). So, to make removing an item set the variable to 0, change line 437:
Code:
if (resultValue<1)
    $gameVariables.setValue(variableId, 0);
else
    $gameVariables.setValue(variableId, originalValue + resultValue);

Try that out.


That worked like a dream :kaothx:

Many thanks, i wish this forum had a credit system so i could give you cred.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
8,395
Reaction score
5,546
First Language
Dutch
Primarily Uses
RMXP

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 Profile Posts

Hey everyone! No Studio Blue RPG Maker Critiques Stream today! But you can always check the playlist for old streams you've missed!

I ran out of paper sheets to draw, so I guess I'm forced to do digital for a while now...
x778xt8.jpg

Still haven0t found a colouring style that I like :kaoswt:
woods.pngshop.jpgboss.jpgRoom.png

Mapping is becoming so much easier!
FirestormNeos wrote on Neikoku's profile.
the cat in your profile picture is adorable
Are the default-size "chibi" sprites really a bad thing for a project? I'm not planning to sell my game anyway but I was wondering if they were as hated as some videos seem to claim...

Forum statistics

Threads
111,431
Messages
1,061,077
Members
144,795
Latest member
Penguinsam64
Top