Using RMVX
Is there a way to do it(ex. needing 5 potions instead of 1)?
I tried doing control variable and setting it equal to an item and then c. branch the variable to be >= 5 but I get a game interpreter error.
QuoteI tried doing control variable and setting it equal to an item and then c. branch the variable to be >= 5 but I get a game interpreter error.
That's not supposed to happen. It should work fine unless you did something else or used a script somewhere- Could you give more details?
Control Variable: [Variable] = 0
label: Item-check
Conditional Branch: if [ITEM] is in Inventory
Control Variable: [Variable] =+ 1
Remove item: [ITEM] - 1
Conditional Branch: if [ITEM] is in Inventory
Jump to Label: Item-check
Branch end
Branch end
Conditional Branch: if Variable [Variable] >= 5
Stuff you want to happen.
Branch end
Quote from: Welfare-Daddy Pacman on April 01, 2011, 10:39:17 AM
Control Variable: [Variable] = 0
label: Item-check
Conditional Branch: if [ITEM] is in Inventory
Control Variable: [Variable] =+ 1
Remove item: [ITEM] - 1
Conditional Branch: if [ITEM] is in Inventory
Jump to Label: Item-check
Branch end
Branch end
Conditional Branch: if Variable [Variable] >= 5
Stuff you want to happen.
Branch end
Thanks so much! It works.
However, the npc takes however many ITEM you have; you only need to collect 5 of ITEM but if you talk to the npc with < 5 she takes ITEM anyway and if you talk to her with >= 5 she takes all of them. Do you know how to fix that? I usually have no trouble with events and such but this is the first time I've tried this . :P
You should just get the Game Interpreter fix. RMVX was released with an error when it came to operating variables.
Add the following in its own slot just below Materials but above any other custom scripts you might have.
class Game_Interpreter
#--------------------------------------------------------------------------
# * Control Variables
#--------------------------------------------------------------------------
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
Once you do that, you will be able to use the Control Variable event to get exactly how many of the item you have.
Thanks yet again Modern Algebra! :)
It works perfectly!!
Try this out
1. Go grab the Game_Interpreter Fix script in text file
2. Create a new game. Go into the script editor (on the toolbar, it looks like a pencil and paper). On the left-hand side you will see Game_Interpreter in the list of scripts. Click it to bring it up.
3. In another window, open the file you downloaded. Choose Edit > Select all and Edit > Copy to select the whole 1660 lines in notepad. Then select the 1660 lines of text the script editor (CTRL+A works well). Then paste. Save your game.
4. Open the folder with the project (one you just created and added a script into), and find this: Scripts.rvdata in the Data folder
5. Copy Scripts.rvdata
6. Go to the RPGVX\Systems\Data
7. Paste Scripts.rvdata in here. It'll ask you if it should be overwritten. Say yes.
all copyright of this tutorial goes to rpgmakervx.net(didnt know if i had to say that or not better safe than sorry ;_;)
...He already solved it.
Over half a month ago.