Armor Variable increase

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
I have multiple common events being called for certain functions in my game. One which checks the player's given dexterity that I want to be able to add to with equip-able armor etc.
The trouble is instead of adding it just once every time it is checked it adds 2, I wanted to know if there is a way to fix this?
Code:
◆If:player has equipped Thief Gloves
  ◆Control Variables:#0043 Dex += 2
  ◆Control Switches:#0013 ThiefGloves = ON
  ◆
:Else
  ◆If:ThiefGloves is OFF
    ◆Jump to Label:Scan
    ◆
  :End
  ◆Control Switches:#0013 ThiefGloves = OFF
  ◆Control Variables:#0043 Dex -= 2
  ◆
:End
◆Label:Scan
 

Frogboy

I'm not weak to fire
Veteran
Joined
Apr 19, 2016
Messages
1,704
Reaction score
2,208
First Language
English
Primarily Uses
RMMV
As far as I can tell, you must be calling it more than once. I don't see any way that this could be looping back to the top (unless it's an Auto-run or parallel event). And if it is a parallel event, your character's Dex looks like it'll keep growing ever higher. Would need more context to help you any further.
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
It is a common event that is often called I will copy in the full event here.
Code:
◆If:player has equipped Thief Gloves
  ◆Control Variables:#0043 Dex += 2
  ◆Control Switches:#0013 ThiefGloves = ON
  ◆
:Else
  ◆If:ThiefGloves is OFF
    ◆Jump to Label:Scan
    ◆
  :End
  ◆Control Switches:#0013 ThiefGloves = OFF
  ◆Control Variables:#0043 Dex -= 2
  ◆
:End
◆Label:Scan
◆If:Dex ≥ 22
  ◆Control Variables:#0051 DEX+- = 6
  ◆Jump to Label:Break
  ◆
:Else
  ◆If:Dex ≥ 20
    ◆Control Variables:#0051 DEX+- = 5
    ◆Jump to Label:Break
    ◆
  :Else
    ◆If:Dex ≥ 18
      ◆Control Variables:#0051 DEX+- = 4
      ◆Jump to Label:Break
      ◆
    :Else
      ◆If:Dex ≥ 16
        ◆Control Variables:#0051 DEX+- = 3
        ◆Jump to Label:Break
        ◆
      :Else
        ◆If:Dex ≥ 14
          ◆Control Variables:#0051 DEX+- = 2
          ◆Jump to Label:Break
          ◆
        :Else
          ◆If:Dex ≥ 12
            ◆Control Variables:#0051 DEX+- = 1
            ◆Jump to Label:Break
            ◆
          :Else
            ◆If:Dex ≥ 10
              ◆Control Variables:#0051 DEX+- = 0
              ◆Jump to Label:Break
              ◆
            :Else
              ◆If:Dex ≥ 5
                ◆Control Variables:#0051 DEX+- = -2
                ◆Jump to Label:Break
                ◆
              :Else
                ◆Control Variables:#0051 DEX+- = -1
                ◆Jump to Label:Break
                ◆
              :End
              ◆
            :End
            ◆
          :End
          ◆
        :End
        ◆
      :End
      ◆
    :End
    ◆
  :End
  ◆
:End
The problem is every time this event is called which is anytime it is checked the Dex keeps getting a two plus boost while the armor is equipped.
Here is a sample of it being called.
Code:
  ◆Control Variables:#0001 d20 = Random 1..20
  ◆Common Event:Dex_check
  ◆Control Variables:#0001 d20 += DEX+-
    ◆If:d20 > 16
      ◆Comment://Lock picked
      ◆Control Variables:#0003 True = 1
      ◆Play SE:Open1 (90, 100, 0)
      ◆Control Variables:#0001 d20 -= DEX+-
      ◆If:Level ≥ 4
        ◆Control Variables:#0001 d20 -= 2
        ◆If:d20 = 20
          ◆Control Variables:#0008 Exp = Random 200..300
          ◆Change EXP:Entire Party, + {Exp} (Show Level Up)
          ◆Text:None, Transparent, Bottom
          :    :You gained \V[8]EXP! LUCKY!
          ◆
        :Else
          ◆Text:None, Window, Bottom
          :    :\V[1] +\V[51]
          ◆Change EXP:Entire Party, + 90 (Show Level Up)
          ◆Text:None, Transparent, Bottom
          :    :You gained 90 EXP!
          ◆Exit Event Processing
          ◆
        :End
        ◆
      :Else
        ◆If:d20 = 20
          ◆Control Variables:#0008 Exp = Random 200..300
          ◆Change EXP:Entire Party, + {Exp} (Show Level Up)
          ◆Text:None, Transparent, Bottom
          :    :You gained \V[8]EXP! LUCKY!
          ◆
        :Else
          ◆Text:None, Window, Bottom
          :    :\V[1] +\V[51]
          ◆Change EXP:Entire Party, + 90 (Show Level Up)
          ◆Text:None, Transparent, Bottom
          :    :You gained 90 EXP!
          ◆Exit Event Processing
          ◆
        :End
        ◆
      :End
      ◆
    :Else
      ◆If:d20 = 1
        ◆Comment://Chest won't open
        ◆Control Variables:#0004 False = 0
        ◆Control Variables:#0001 d20 -= DEX+-
        ◆Text:None, Window, Bottom
        :    :\V[1]
        ◆Exit Event Processing
        ◆
      :End
      ◆Comment://Lock pick failed
      ◆Control Variables:#0004 False = 2
      ◆Control Variables:#0001 d20 -= DEX+-
      ◆Text:None, Window, Bottom
      :    :\V[1] +\V[51]
      ◆Exit Event Processing
      ◆
    :End
Edit:
Why don't you just add 2dex to the armor's traits in database?
Is there a way to have an armor add to a variable as a trait?
 
Last edited:

Llareian

Jack of All Trades, Master of None
Veteran
Joined
Jan 26, 2017
Messages
604
Reaction score
1,421
First Language
English
Primarily Uses
RMMV
@Midnight Kitty Is the problem that the DEX+- goes from -2 to 0? Because you have an error in your processing for that, where Dex of 10 or 11 will give 0 DEX+-, Dex of 5 through 9 will give a -2 DEX+-, and Dex of 4 or lower will give a -1 DEX+-.
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
Thank you so much this plugin did exactly what I wanted it to do.
@Midnight Kitty Is the problem that the DEX+- goes from -2 to 0? Because you have an error in your processing for that, where Dex of 10 or 11 will give 0 DEX+-, Dex of 5 through 9 will give a -2 DEX+-, and Dex of 4 or lower will give a -1 DEX+-.
Where is the error in the code that does that? Also no it was the Dex itself that kept rising by two each time the command was called. I just saw it, thanks for pointing that out.
 
Last edited:

Frogboy

I'm not weak to fire
Veteran
Joined
Apr 19, 2016
Messages
1,704
Reaction score
2,208
First Language
English
Primarily Uses
RMMV
The first branch that increases the Dex needs a jump to scan label when switch 13 is on. You're doing it in the else to prevent it from decreasing but you're not doing the same in the if to stop it from increasing more than once.
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
Thank you I guess I overlooked that, the problem has now been fixed through the plugin so I have removed that section of the code anyway.
 

Frogboy

I'm not weak to fire
Veteran
Joined
Apr 19, 2016
Messages
1,704
Reaction score
2,208
First Language
English
Primarily Uses
RMMV
No problem. Plugin is probably the better way to go. I actually have one in the latter stages of development right now that covers this too so I definitely agree with the switch. It'll make your life easier.
 

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

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,990
Members
137,562
Latest member
tamedeathman
Top