Ok my problem with this script is that I just can't seem to figure out why its giving me two of every item. Here is the script and the example:
Here is where the problem is at:
and here is the example, where $game_party.gain_item(2,1) is at, if i were to put 'print "Hello", I would get:
Hello
Hello
and im getting two items of item number 2 even though it clearly shows one, like it is being called twice, don't know why .
calling it like this if it helps:
Code:
#===============================================================================
#
# Mining exp conversion to lvl is taken place and stored here.
# * Purpose of this class is to convert the number(exp) stored in Variable 1,
# ** into a 'Level' system, for example, '5 exp = Level 1'. '10 exp = Level 2'.
# ** Also, this 'Level' will be stored in a instance variable, and will be
# ** called in other scripts using @mining = Mining_Level_Storage.new().
# ** then the level will be called by saying @mining.level .
#===============================================================================
class Mining_Level_Storage
def initialize
mining
end
def mining
if $game_variables[1] <= 5
@gvml = 1
elsif $game_variables[1] <= 10
@gvml = 2
elsif $game_variables[1] <= 15
@gvml = 3
elsif $game_variables[1] <= 20
@gvml = 4
elsif $game_variables[1] <= 25
@gvml = 5
elsif $game_variables[1] <= 30
@gvml = 6
elsif $game_variables[1] <= 35
@gvml = 7
elsif $game_variables[1] <= 40
@gvml = 8
elsif $game_variables[1] <= 45
@gvml = 9
elsif $game_variables[1] <= 50
@gvml = 10
elsif $game_variables[1] <= 55
@gvml = 11
end
@level = @gvml
level
end
def level
return @level
end
end
#===============================================================================
#
# Mining Process and Chance will be Stored Here.
# * Purpose of this class is to store 'Chance' into my 'Mining' Process. By
# ** that I mean: Checking by your current Variable => Level, you have a certain
# ** chance that you will recieve an 'Ore'.
# ** Also, it will soon start checking which 'Pik Axe' the user holds, better
# ** 'Pik Axe' the better the chance.
#===============================================================================
class Event_Mining_Tools
def initialize
level_check
end
# Mining Level will be checked here for validation and location.
def level_check
@mining = Mining_Level_Storage.new
if @mining.level <= 5
$game_party.gain_item(2,1)
else @mining.level <= 10
print "2"
end
end
end
#===============================================================================
#
# Mining Ore Event Starts Here
# * This is what the 'In-Game Event' will call, considering which 'Vein' is
# ** being mined.
#===============================================================================
class Event_Mining_Ore
def initialize
stage_one
end
def stage_one
if $game_party.item_number(1) >= 1
@level = Event_Mining_Tools.new()
@level.level_check
else
#$game_temp.message_text = "You need a pick" #<- Not Stopping.
print "you need a pik"
end
end
end
Here is where the problem is at:
Code:
def level_check
@mining = Mining_Level_Storage.new
if @mining.level <= 5
$game_party.gain_item(2,1) # Here
else @mining.level <= 10
print "2"
end
end
and here is the example, where $game_party.gain_item(2,1) is at, if i were to put 'print "Hello", I would get:
Hello
Hello
and im getting two items of item number 2 even though it clearly shows one, like it is being called twice, don't know why .
calling it like this if it helps:
Code:
Event_Mining_Ore.new