Guest Access
Go to page : 1, 2, 3, 4, 5
The only one
The only one
The only one
profile
NuKa_BuBble
profile
Hey hey hey mr_wiggles, the script 'll work soon! There's the project, can you look it and say me what's wrong? Now, I can start the game but get error when I cut.
EDIT:
Look the tree, I forgot to change the call method. But gave the same problem anyway.
www.megaupload.com/?d=RYYB41KD
(19.54 Mb compress with winRAR)
EDIT:
Look the tree, I forgot to change the call method. But gave the same problem anyway.
www.megaupload.com/?d=RYYB41KD
(19.54 Mb compress with winRAR)
The only one
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
profile
Look at this example again. See that the variables match names.
mr_wiggles
profile
mr_wiggles wrote:no you need to create the variable.
- Code:
class Game_Party
attr_accessor :woodlvl # <-----
alias :wood_init :initialize
def initialize
wood_init
@woodlvl = 0 # <-----
end
end
something like that.
Look at this example again. See that the variables match names.
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
NuKa_BuBble
profile
Yeah, but the class it's Woodcutting and the variable it's woodcutting_lvl, so the variable need to be the same.
EDIT 2s later:
Yeah I see why you said that. lumbering need to be call woodcutting!
EDIT 2:
So if I want to call it lumbering, I need to do:
EDIT 3:
But the problem in my script stay. Line 67: no method item_id for game_party class. But it's already initialize in the script Game_Party!!!
EDIT 2s later:
Yeah I see why you said that. lumbering need to be call woodcutting!
EDIT 2:
So if I want to call it lumbering, I need to do:
- Code:
class Game_Party
attr_accessor :woodcutting_lvl
alias :lumbering_init :initialize
def initialize
lumbering_init
@lumbering = 0
end
end
EDIT 3:
But the problem in my script stay. Line 67: no method item_id for game_party class. But it's already initialize in the script Game_Party!!!
www.megaupload.com/?d=RYYB41KD
(19.54 Mb compress with winRAR)
The only one
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
profile
mr_wiggles
profile
.... see thats a tricky error..
$game_party is being called and its not created yet. You need to make sure that when the game starts it doesn't change how the scenes are loaded into the game.
You dont need to have woodcutting in its own class, you can build it into Game_party without messing it up, and it would be easier that way.
$game_party is being called and its not created yet. You need to make sure that when the game starts it doesn't change how the scenes are loaded into the game.
- Code:
class Woodcutting < Game_Party
@logs_ID = $game_party.item_id
You dont need to have woodcutting in its own class, you can build it into Game_party without messing it up, and it would be easier that way.
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
NuKa_BuBble
profile
I had think that was:
But I don't understand. Woodcutting is already in Game_Party class.
EDIT:
I'll be back in 12m see if I got an answer else, tomorrow.
EDIT 2:
I think I understand te problem, I want to check if the variable logs_ID is equal to the ID of the log in the database but, I check if the party poceed the item ID. So that 'll give nil cause the party don't have any logs! What do you think about that mr_wiggles?
So I'll need to do something like that:
- Code:
@logs_ID = $game_party.actors[0].item_id
But I don't understand. Woodcutting is already in Game_Party class.
- Code:
#------------------------------------------------------------------------------#
#-------------------------- Class Woodcutting ---------------------------------#
#------------------------------------------------------------------------------#
class Woodcutting < Game_Party
#------------------------------------------------------------------------------#
# Initialize #
#------------------------------------------------------------------------------#
def initialize
@logs_number = 0
@logs_ID = $game_party.item_id
EDIT:
I'll be back in 12m see if I got an answer else, tomorrow.
EDIT 2:
I think I understand te problem, I want to check if the variable logs_ID is equal to the ID of the log in the database but, I check if the party poceed the item ID. So that 'll give nil cause the party don't have any logs! What do you think about that mr_wiggles?
So I'll need to do something like that:
- Code:
@logs_ID = []
@logs_ID = $data_items[item_id].id[100..109] #I ty to check if logs_ID is equal to the ID 100 to 109 in the item database. I know the code is wrong but I don't know how to do that.
The only one
Show Signature
The only one
The only one
The only one
profile
NuKa_BuBble
profile
I've send on Xas wordpress my karma points script. I'll do the same with my woodcutting script when it'll be finish. I look forward to finish it.
The only one
Show Signature
The only one
The only one
The only one
profile
NuKa_BuBble
profile
It's done, I try to resolve another error but that's look simple. I'll edit if I need help.
EDIT:
Yep, I'll need help. When I try to cut the tree, nothing appens
BUT I DON'T GET ANY ERROR NOW!
Here's the new version
EDIT:
Yep, I'll need help. When I try to cut the tree, nothing appens
BUT I DON'T GET ANY ERROR NOW!
Here's the new version
- Spoiler:
- Code:
################################################################################
# Wood cutting system #
# #
# By: NuKa_BuBble #
# Version: 1.0 #
# Started: 29/08/2011 #
# #
# You can find me on these websites: #
# http://gameface101.playogame.com/ #
# #
# Special thank: #
# mr_wiggles #
# G@MeF@Ce #
# #
# #
################################################################################
# #
# No Graphics needed #
# #
################################################################################
# #
# Instructions #
# #
# In an event, add this part of script #
# if the player learned the job #
# $wc_job_learn = true #
# #
# #
################################################################################
#------------------------------------------------------------------------------#
#------------------------------- NUKA module ----------------------------------#
#------------------------------------------------------------------------------#
module NUKA
#-------------Self Switch------------------------------------------------------#
SELF_SWITCH = $game_self_switches
#-------------Woodcutting Stats------------------------------------------------#
woodcutting_exp = 0
woodcutting_level = 1
energie_rem = 100
#-------------Other------------------------------------------------------------#
can_gain_wc_exp = true
$wc_job_learn = false
end
#------------------------------------------------------------------------------#
#---------------------------- End of the module -------------------------------#
#------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
#-------------------------- Class Woodcutting ---------------------------------#
#------------------------------------------------------------------------------#
class Woodcutting < Game_Party
#------------------------------------------------------------------------------#
# Initialize #
#------------------------------------------------------------------------------#
def initialize
@logs_number = 0
@logs_ID = [0]
@logs_ID = $data_items[100..109].id
@old_wc_lvl = 1
@wc_xp_gain
@wc_next_lvl
@i = 15
@random = false
# If the logs type = to "A",
#the amount of gain xp is multiplied by the logs number and divided by 2.
@logs_type = {10, 5, 4, 3, 2, 1.5}
@logs_type = 0
logs_type_random = @logs_type
# cctt means "Can cut tree type"
# DO NOT TOUCH THIS PART OF CODE!
# Set the tree type that can be cut in the "CASE BLOCK"
@cctt = 1
tree_type = {
#(Value = tree_type) => item_ID
#The value is use for the xp multiplication
#Here, you add different type of tree for different logs.
1 => 100,
2 => 101,
3 => 102,
4 => 103,
5 => 104,
6 => 105,
7 => 106,
8 => 107,
9 => 108,
10 => 109
}
a = 10
b = 5
@can_cut = nil
#-------------The tools for woodcutting----------------------------------------#
woodcutting_weapon_id = {6, 7}
end #end of define "initialize"
#------------------------------------------------------------------------------#
#------Define woodcutting stats------------------------------------------------#
#------------------------------------------------------------------------------#
#define the tree type
def tree_type
v = tree_type[@logs_ID]
n = v != nil ? v : 0
return n
end
#define the woodcutting lvl
def woodcutting_lvl
NUKA::woodcutting_level = woodcutting_lvl
woodcutting_lvl = 1
end
#define the woodcutting xp
def woodcutting_exp
NUKA::woodcutting_exp = woodcutting_xp
woodcutting_xp = 0
end
#define the woodcutting energie
def energie_rem
NUKA::energie_rem = energie_rem
energie_rem = 100
end
def energie
if woodcutting_lvl > 1
if energie_rem > 100 + a
energie_rem = 100 + a
elsif energie_rem < 0
energie_rem = 0
end
if woodcutting_lvl >= 50
energie_rem = (100 - b) + a
elsif woodcutting_lvl > 70
energie_rem = a
end
elsif woodcutting_lvl == 1
energie_rem = 100
if energie_rem < 0
energie_rem = 0
end
end
end
#------------------------------------------------------------------------------#
#-----Define if the player can cut---------------------------------------------#
#------------------------------------------------------------------------------#
def can_cut
# returns the result of the weapon equal to the correct id AND job_learn
# AND energie_rem greater than 0 AND cctt is greater or equal to tree_type
# if ALL of these are TRUE, the result is TRUE, and therefore the player can_cut
return ($game_party.actors[0].weapon_id == woodcutting_weapon_id && $wc_job_learn && energie_rem > 0 && @cctt >= tree_type)
end #end of define "can_cut"
def help
if @can_cut == false
if ($game_party.actors[0].weapon_id == woodcutting_weapon_id) == false
print "You need to be equip with a woodcutting weapon."
elsif $wc_job_learn == false
print "You've not learned the job."
elsif energie_rem == 0
print "You don't have enought energie."
elsif (@cctt >= tree_type) == false
print "You don't have the woodcutting level."
else
end
end
end
#------------------------------------------------------------------------------#
#-----Define what appens if the player perform an action-----------------------#
#------------------------------------------------------------------------------#
def cut_tree
if cut_tree == true
if NUKA::SELF_SWITCH["C"] != true
NUKA::SELF_SWITCH[key] = "C"
$game_party.actors[0].item_id = @logs_ID
cut_tree = false
end
end
end
#------------------------------------------------------------------------------#
#----Define the woodcutting lvl------------------------------------------------#
#------------------------------------------------------------------------------#
#----Compute the XP gain-------------------------------------------------------#
def compute_wc_xp
((@logs_number * @logs_type_random)/2) * tree_type = @wc_xp_gain
woodcutting_xp += @wc_xp_gain
@wc_xp_gain = 0
@logs_type = 0
@logs_number = 0
end
#----Compute the next lvl------------------------------------------------------#
def wc_next_lvl
if @old_wc_lvl != woodcutting_lvl
@i * 1.75
woodcutting_lvl + @i = @wc_next_lvl.integer
end
end
#----Compute the user lvl------------------------------------------------------#
def comp_woodcutting_lvl
if woodcutting_xp >= @wc_next_level
woodcutting_lvl += 1
a += 10
if woodcutting_lvl >= 50 && woodcutting_lvl <= 71
b += 5
end
end
if @old_wc_lvl != woodcutting_lvl
@old_wc_lvl = woodcutting_lvl
end
end # end of define comp_woodcutting_lvl
def conditions
#---If the woodcutting lvl is between 1 and 100, ------------------------------#
#---you can gain woodcutting experience----------------------------------------#
if woodcutting_lvl < 100 && woodcutting_lvl >= 1
can_gain_wc_exp = true
else
return false
end
#----If the woodcutting lvl is less or equal 0, set it to 1--------------------#
#----Else if the woodcutting lvl is more than to 100, set it to 100------------#
if woodcutting_lvl <= 0
woodcutting_lvl = 1
elsif woodcutting_lvl > 100
woodcutting_lvl = 100
end
end # end of define conditions method
#------------------------------------------------------------------------------#
#----Define what appens if the player lvl is equal to X------------------------#
#------------------------------------------------------------------------------#
def weighted_random(array)
sum = array.inject {|sum, n| sum + n}
n = rand(sum)
array.each_with_index do |i, index|
return index if n < i
n -= i
end
if @random == true
def gain
if woodcutting_lvl >= 1 && woodcutting_lvl < 20
@logs_number + (rand(10) + 1)
$game_party.gain_item(tree_type, @log_number)
elsif woodcutting_lvl >= 20 && woodcutting_lvl < 40
@logs_number + (rand(10) + 2)
$game_party.gain_item(tree_type, @log_number)
elsif woodcutting_lvl >= 40 && woodcutting_lvl < 60
@logs_number + (rand(10) + 3)
$game_party.gain_item(tree_type, @log_number)
elsif woodcutting_lvl >= 60 && woodcutting_lvl < 80
@logs_number + (rand(10) + 4)
$game_party.gain_item(tree_type, @log_number)
elsif woodcutting_lvl >= 80 && woodcutting_lvl <= 100
@logs_number + (rand(10) + 5)
$game_party.gain_item(tree_type, @log_number)
end
end # end of method gain
def logs_type_random
i = weighted_random([6, 12, 15, 20, 30, 517])
case i
when 0
return 10
when 1
return 5
when 2
return 4
when 3
return 3
when 4
return 2
when 5
return 1.5
end
end
end # end of method logs_type
@random = false
end # end of if @random
#-----------------------------CASE BLOCK---------------------------------------#
def loop
if @can_cut = true
@cctt = (woodcutting_lvl / 10).ceil
cut_tree = true
@random = true
end
end
#------------------------------------------------------------------------------#
#-----------------------End of the block and class-----------------------------#
#------------------------------------------------------------------------------#
end #class woodcutting end
class Game_Party
attr_accessor :woodcutting_lvl
alias :woodcutting_init :initialize
def initialize
woodcutting_init
@woodcutting = 0
end
end
The only one
Show Signature
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
hey nuka - glad to see you are still at it,
finish what you start (it's what I always say, but not always do)
I'll offer what I can when I get back into playing with code. right now I'm behind on things for this site, real life busy.
finish what you start (it's what I always say, but not always do)
I'll offer what I can when I get back into playing with code. right now I'm behind on things for this site, real life busy.
Administrator
Show Signature
The only one
The only one
The only one
profile
NuKa_BuBble
profile
Hey hey, I know, finish what you started. You had learned me that. I remember our conversation in the chat.
The only one
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
profile
mr_wiggles
profile
@nuka-
what i mean by in the game party class is that the wood cutting script is writin out of game party. So "class Woddcutting < Game_Party" change it to just "class Game_Party".
what i mean by in the game party class is that the wood cutting script is writin out of game party. So "class Woddcutting < Game_Party" change it to just "class Game_Party".
EVENTALIST
Show Signature
EVENTALIST
Go to page : 1, 2, 3, 4, 5