RMVX VARIABLE NIGHTMARE SOLUTION!!!!

Posts

Pages: 1
Max McGee
with sorrow down past the fence
9159
So basically I thought something was wrong with my RMVX variable calculations for Mage Duel. Somehow the game was multiplying 12 x 100 and getting 100 instead of 1200. I double checked my eventing and yes, that's what was happening.

So I rembered something Karsuman said a while ago, namely this:

author=Karsuman link=topic=1655.msg29915#msg29915 date=1220801188
Fix for RMVX Variables

This fixes the annoying VX variable problem that is a bane to any that try to be a little creative with RMVX eventing, particularly as related to battles. Go into Game_Interpreter and search for Control Variables. The code present is shitty and doesn't work properly. Copy-paste this over all of it.

#--------------------------------------------------------------------------
# * Control Variables
#--------------------------------------------------------------------------
def command_122
value = 0
case @params # Operand
when 0 # Constant
value = @params
when 1 # Variable
value = $game_variables[@params]
when 2 # Random
value = @params + rand(@params - @params + 1)
when 3 # Item
value = $game_party.item_number($data_items[@params])
when 4 # Actor
actor = $game_actors[@params]
if actor != nil
case @params
when 0 # Level
value = actor.level
when 1 # Experience
value = actor.exp
when 2 # HP
value = actor.hp
when 3 # MP
value = actor.mp
when 4 # Maximum HP
value = actor.maxhp
when 5 # Maximum MP
value = actor.maxmp
when 6 # Attack
value = actor.atk
when 7 # Defense
value = actor.def
when 8 # Spirit
value = actor.spi
when 9 # Agility
value = actor.agi
end
end
when 5 # Enemy
enemy = $game_troop.members[@params]
if enemy != nil
case @params
when 0 # HP
value = enemy.hp
when 1 # MP
value = enemy.mp
when 2 # Maximum HP
value = enemy.maxhp
when 3 # Maximum MP
value = enemy.maxmp
when 4 # Attack
value = enemy.atk
when 5 # Defense
value = enemy.def
when 6 # Spirit
value = enemy.spi
when 7 # Agility
value = enemy.agi
end
end
when 6 # Character
character = get_character(@params)
if character != nil
case @params
when 0 # x-coordinate
value = character.x
when 1 # y-coordinate
value = character.y
when 2 # direction
value = character.direction
when 3 # screen x-coordinate
value = character.screen_x
when 4 # screen y-coordinate
value = character.screen_y
end
end
when 7 # Other
case @params
when 0 # map ID
value = $game_map.map_id
when 1 # number of party members
value = $game_party.members.size
when 2 # gold
value = $game_party.gold
when 3 # steps
value = $game_party.steps
when 4 # play time
value = Graphics.frame_count / Graphics.frame_rate
when 5 # timer
value = $game_system.timer / Graphics.frame_rate
when 6 # save count
value = $game_system.save_count
end
end
for i in @params .. @params # Batch control
case @params # Operation
when 0 # Set
$game_variables = value
when 1 # Add
$game_variables += value
when 2 # Sub
$game_variables -= value
when 3 # Mul
$game_variables *= value
when 4 # Div
$game_variables /= value if value != 0
when 5 # Mod
$game_variables %= value if value != 0
end
if $game_variables > 99999999 # Maximum limit check
$game_variables = 99999999
end
if $game_variables < -99999999 # Minimum limit check
$game_variables = -99999999
end
end
$game_map.need_refresh = true
return true
end


I figured that was the problem and I did exactly that. And it somehow broke my RMVX MUCH MUCH WORSE. I loaded up my save game and now it was multiplying 12 x 100 and getting 0. I popped up my debug menu to check and my variables were all fucked up. They were all mostly set to 1 or 0. When I tried to manually change them, the game crashed from test play with some kind of a math error. It said something about scene_debug being fucked.

WHAT IS GOING ON HERE? SOMEBODY HELLLPPP!!!

The error only seems to hit after I talk to the guy (the event) that was multiplying the variables in the first place.

I am going to try and replace the entire game_interpreter section with the default one because maybe that will at least get me back to where I was?


SOLUTION:

author=GreatRedSpirit link=topic=2577.msg49178#msg49178 date=1228431600
I missed that too. I was wondering why there was no "case 4". Guess I should've looked harder.

Fix: Copy/Paste this over the last fix.

# This is stupid. Fuck you Enterbrain.

class Game_Interpreter

alias command_122_bug command_122
def command_122

value = 0
case @params[3] # Operand
when 0 # Constant
value = @params[4]
when 1 # Variable
value = $game_variables[@params[4]]
when 2 # Random
value = @params[4] + rand(@params[5] - @params[4] + 1)
when 3 # Item
value = $game_party.item_number($data_items[@params[4]])
when 4 # Actor
actor = $game_actors[@params[4]]
if actor != nil
case @params[5]
when 0 # Level
value = actor.level
when 1 # Experience
value = actor.exp
when 2 # HP
value = actor.hp
when 3 # MP
value = actor.mp
when 4 # Maximum HP
value = actor.maxhp
when 5 # Maximum MP
value = actor.maxmp
when 6 # Attack
value = actor.atk
when 7 # Defense
value = actor.def
when 8 # Spirit
value = actor.spi
when 9 # Agility
value = actor.agi
end
end
when 5 # Enemy
enemy = $game_troop.members[@params[4]]
if enemy != nil
case @params[5]
when 0 # HP
value = enemy.hp
when 1 # MP
value = enemy.mp
when 2 # Maximum HP
value = enemy.maxhp
when 3 # Maximum MP
value = enemy.maxmp
when 4 # Attack
value = enemy.atk
when 5 # Defense
value = enemy.def
when 6 # Spirit
value = enemy.spi
when 7 # Agility
value = enemy.agi
end
end
when 6 # Character
character = get_character(@params[4])
if character != nil
case @params[5]
when 0 # x-coordinate
value = character.x
when 1 # y-coordinate
value = character.y
when 2 # direction
value = character.direction
when 3 # screen x-coordinate
value = character.screen_x
when 4 # screen y-coordinate
value = character.screen_y
end
end
when 7 # Other
case @params[4]
when 0 # map ID
value = $game_map.map_id
when 1 # number of party members
value = $game_party.members.size
when 2 # gold
value = $game_party.gold
when 3 # steps
value = $game_party.steps
when 4 # play time
value = Graphics.frame_count / Graphics.frame_rate
when 5 # timer
value = $game_system.timer / Graphics.frame_rate
when 6 # save count
value = $game_system.save_count
end
end
for i in @params[0] .. @params[1] # Batch control
case @params[2] # Operation
when 0 # Set
$game_variables[i] = value
when 1 # Add
$game_variables[i] += value
when 2 # Sub
$game_variables[i] -= value
when 3 # Mul
$game_variables[i] *= value
when 4 # Div
$game_variables[i] /= value if value != 0
when 5 # Mod
$game_variables[i] %= value if value != 0
end
if $game_variables[i] > 99999999 # Maximum limit check
$game_variables[i] = 99999999
end
if $game_variables[i] < -99999999 # Minimum limit check
$game_variables[i] = -99999999
end
end
$game_map.need_refresh = true
return true
end
end

LouisCyphre
can't make a bad game if you don't finish any games
4523
I know this probably isn't it, but... was the x100 set to "Set variable at..." instead of "Multiply variable by..." ?
Max McGee
with sorrow down past the fence
9159
No, it was set to multiply by.

First it sets Variable 14 to be equal to Variable 7 and then it multiplies Variable 14 by 100. (This is supposed to set the cost of a hint the information dealer sets equal to a hundred gold times the number of opponents the player has already defeated. So 1200 gold for the thirteenth duel.)

Of course I can think of a workaround (calculating cost manually for each page of the information dueler event) but like...why can't this program that I paid $60 for FUCKING PERFORM BASIC CALCULATIONS?

Anyway, I managed to get it back to its less broken (pre-script tampering) state but it still says 12 x 100 = 100. At least my debug is now working okay.
LouisCyphre
can't make a bad game if you don't finish any games
4523
Hrmm...

EDIT: Try setting Var 14 at 100 and then multiplying by Var 7.
harmonic
It's like toothpicks against a tank
4142
http://www.mediafire.com/?mbnmbqfzxc4

Download that for Game_interpreter. I had the exact same problem pre-fix.
Max McGee
with sorrow down past the fence
9159
I really hope that's not a virus :P

Seriously though, thanks but... uh, is that Game_Interpreter different from the one that Karsuman posted here?
harmonic
It's like toothpicks against a tank
4142
No, it's actually a virus. ::)
Max McGee
with sorrow down past the fence
9159
Much to my chagrin, I am STILL having this problem. Harmonic's fix did nothing. I have quintuple checked and the problem is NOT in my eventing.

So....wtf?

EDIT:


author=GreatRedSpirit link=topic=2577.msg49178#msg49178 date=1228431600
I missed that too. I was wondering why there was no "case 4". Guess I should've looked harder.

Fix: Copy/Paste this over the last fix.

# This is stupid. Fuck you Enterbrain.

class Game_Interpreter

alias command_122_bug command_122
def command_122

value = 0
case @params[3] # Operand
when 0 # Constant
value = @params[4]
when 1 # Variable
value = $game_variables[@params[4]]
when 2 # Random
value = @params[4] + rand(@params[5] - @params[4] + 1)
when 3 # Item
value = $game_party.item_number($data_items[@params[4]])
when 4 # Actor
actor = $game_actors[@params[4]]
if actor != nil
case @params[5]
when 0 # Level
value = actor.level
when 1 # Experience
value = actor.exp
when 2 # HP
value = actor.hp
when 3 # MP
value = actor.mp
when 4 # Maximum HP
value = actor.maxhp
when 5 # Maximum MP
value = actor.maxmp
when 6 # Attack
value = actor.atk
when 7 # Defense
value = actor.def
when 8 # Spirit
value = actor.spi
when 9 # Agility
value = actor.agi
end
end
when 5 # Enemy
enemy = $game_troop.members[@params[4]]
if enemy != nil
case @params[5]
when 0 # HP
value = enemy.hp
when 1 # MP
value = enemy.mp
when 2 # Maximum HP
value = enemy.maxhp
when 3 # Maximum MP
value = enemy.maxmp
when 4 # Attack
value = enemy.atk
when 5 # Defense
value = enemy.def
when 6 # Spirit
value = enemy.spi
when 7 # Agility
value = enemy.agi
end
end
when 6 # Character
character = get_character(@params[4])
if character != nil
case @params[5]
when 0 # x-coordinate
value = character.x
when 1 # y-coordinate
value = character.y
when 2 # direction
value = character.direction
when 3 # screen x-coordinate
value = character.screen_x
when 4 # screen y-coordinate
value = character.screen_y
end
end
when 7 # Other
case @params[4]
when 0 # map ID
value = $game_map.map_id
when 1 # number of party members
value = $game_party.members.size
when 2 # gold
value = $game_party.gold
when 3 # steps
value = $game_party.steps
when 4 # play time
value = Graphics.frame_count / Graphics.frame_rate
when 5 # timer
value = $game_system.timer / Graphics.frame_rate
when 6 # save count
value = $game_system.save_count
end
end
for i in @params[0] .. @params[1] # Batch control
case @params[2] # Operation
when 0 # Set
$game_variables[i] = value
when 1 # Add
$game_variables[i] += value
when 2 # Sub
$game_variables[i] -= value
when 3 # Mul
$game_variables[i] *= value
when 4 # Div
$game_variables[i] /= value if value != 0
when 5 # Mod
$game_variables[i] %= value if value != 0
end
if $game_variables[i] > 99999999 # Maximum limit check
$game_variables[i] = 99999999
end
if $game_variables[i] < -99999999 # Minimum limit check
$game_variables[i] = -99999999
end
end
$game_map.need_refresh = true
return true
end
end

I'm having the same issue, but to a much more ridiculous extent.

I'm trying to set a variable equal to character MP available.

Seems to constantly set equal to zero. >:(
Pages: 1