Guest Access
The only one
The only one
The only one
profile
Welcome in my first real script post!
Last edit: 11/10/11 at 19:27
Reason: Polish & fix bug
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

- Spoiler:
Description:
This script will allow players to cut tree. The self-switch C of the event is turn on when an action is perform. After, the player gain logs and xp at random.
NOTE:
If you find an error, let me know where. I'll fix it.
It's the first script made by myself.
Version 0.9
Special thank:
From [You must be registered and logged in to see this link.]
Special thank to G@MeF@Ce & mr_wiggles.
From [You must be registered and logged in to see this link.]
Special thank to kellessdee and Zeriab.
To add: I'll probably make more jobs and put them in a super jobs suite script with a place in the menu where you can check you're stats.
Graphics:
You don't need graphics but, it's more beautiful if you put one like this:
[You must be registered and logged in to see this link.]
Put it in the character folder.
***The graphics are not placed equal. You'll need to do that.***
Last edit: 11/10/11 at 19:27
Reason: Polish & fix bug
- 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/ #
# http://www.rmxpunlimited.net #
# #
# #
################################################################################
# #
# No Graphics needed #
# #
################################################################################
# #
# Instructions #
# #
# In an event, add this part of script #
# if the player learned the job #
# $wc_job_learn = true #
# #
# Call the script with #
# $Woodcutting.new #
# #
################################################################################
#------------------------------------------------------------------------------#
#------------------------------- 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 = $game_party.item_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_WPN_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_WPN_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_WPN_ID) == false
print "You need to be equip with a woodcutting weapon."
end
if $wc_job_learn == false
print "You've not learned the job."
end
if energie_rem == 0
print "You don't have enought energie."
end
if (@cctt >= tree_type) == false
print "You don't have the woodcutting level."
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---------------------------------------#
if @can_cut
@cctt = (woodcutting_lvl / 10).ceil
cut_tree = true
@random = true
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
@lumbering = 0
@lumbering = woodcutting_lvl
end
end
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
Good start but i noticed a few errors.
You have a nice base, you should go back and revise.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

- Too many global variables
- Misuse of the Hash class
- You wont be able to save your wood level when loading a game.
You have a nice base, you should go back and revise.
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
It's why I wrote: "I need to polish my script."
Maybe that will take more time than I said. I have 9 hours at school. I'm back at 6h, I can have the computer at max 9h pm...
And,
how I can save when I load?
how to use correctly the hash class? What's wrong with?
OH! and I need to learn more about complex randomization and I can't find any good tutorials about that!
I need a short tutorial about randomization in RGSS. I know only rand(value).
Someone can say me:
-how to make a variable is choose randomly between six.
-if the player lvl is between 1 or 9, give an item with a random quantity between 1 to 5
-put a random in a if statement. Like: you have 6 possibilities, you have 1 chance on 100 than the first accomplished. You have 1 chance on 50 than the second accomplished... If the first or the second or the third or... Do that. Else, do this:...
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

Maybe that will take more time than I said. I have 9 hours at school. I'm back at 6h, I can have the computer at max 9h pm...
And,
how I can save when I load?
how to use correctly the hash class? What's wrong with?
OH! and I need to learn more about complex randomization and I can't find any good tutorials about that!
I need a short tutorial about randomization in RGSS. I know only rand(value).
Someone can say me:
-how to make a variable is choose randomly between six.
-if the player lvl is between 1 or 9, give an item with a random quantity between 1 to 5
-put a random in a if statement. Like: you have 6 possibilities, you have 1 chance on 100 than the first accomplished. You have 1 chance on 50 than the second accomplished... If the first or the second or the third or... Do that. Else, do this:...
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
part of learning is trial and error, there is an example of the built in rand() function, just apply it to what you need to get the job done.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
@mr_wiggles: I found how for the rand
For a number between 1 and 6:
For Character between level 1-9 :
And for chances, you can do this:
But the hash, I did'nt understand!
EDIT: Like that, that 'll be ok?
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

For a number between 1 and 6:
- Code:
rand(6) + 1 # 1 - 6 inclusive
rand(6) # 0 - 6 exclusive
rand(7) # 0 - 6 inclusive
For Character between level 1-9 :
- Code:
if woodcutting_lvl >= 1 && woodcutting_lvl <= 9
#give character ( rand(4) + 1 ) for the number of items
end
And for chances, you can do this:
- Code:
if rand(100) == 0 # 1 in 100 chance
#code
end
if rand(50) == 0 # 1 in 50 chance
#code
end
But the hash, I did'nt understand!
EDIT: Like that, that 'll be ok?
- Spoiler:
- ################################################################################
# Wood cutting system #
# #
# By: NuKa_BuBble #
# Version: 1.0 #
# Started: 29/08/2011 # #
# [You must be registered and logged in to see this link.] #
# # #
# #
################################################################################
# #
# No Graphics needed #
# #
################################################################################
# # #
# Instructions #
# # #
# In an event, add this part of script #
# if the player learned the job #
# $job_learn = true #
# #
# Call the script with #
# $Woodcutting.new #
# #
################################################################################
#------------------------------------------------------------------------------#
#------------------------------- NUKA module ----------------------------------#
#------------------------------------------------------------------------------#
module NUKA
#-------------Self Switch C is activated when a tree is cut--------------------#
SELF_SWITCH = $game_self_switches
SELF_SWITCH[key] = "C"
#-------------Woodcutting Stats------------------------------------------------#
woodcutting_exp = 0
woodcutting_lvl = 1
energie_rem = 100
#-------------The tools for woodcutting----------------------------------------#
WOODCUTTING_WPN_ID
{
6, 7
}
#-------------Other------------------------------------------------------------#
can_gain_wc_exp = true
LOGS_ID =
{
#Here, you can add logs ID in the item database for defferent logs type.
100, #It's a normal log
101,
102,
103,
104,
105,
106,
107,
108,
109
}
$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
}
$job_learn = false
end
#------------------------------------------------------------------------------#
#---------------------------- End of the module -------------------------------#
#------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
#-------------------------- Class Woodcutting ---------------------------------#
#------------------------------------------------------------------------------#
class Woodcutting
#------------------------------------------------------------------------------#
# Initialize #
#------------------------------------------------------------------------------#
def initialize
@logs_gain = false
@logs_number
NUKA::LOGS_ID = $data[item_id]
@logs_ID = NUKA::LOGS_ID
@old_wc_lvl = 1
@wc_xp_gain
@wc_next_lvl
@i = 15
# If the logs type = to "A",
#the amount of gain xp is multiplied by the logs number and divided by 2.
@logs_type = {
A = 10,
B = 5,
C = 4,
D = 3,
E = 2,
F = 1.5
}
# (Can cut tree type)
# DO NOT TOUCH THIS PART OF CODE!
# Set the tree type that can be cut in the "CASE BLOCK"
@cctt = {}
end # end of initialize method
#--------------------------------------------------------------------------#
#------Define the tree type------------------------------------------------#
#--------------------------------------------------------------------------#
alias Woodcutting_logs_initialize initialize
def initialize(item_id)
Woodcutting_logs_initialize(item_id)
tree_type = 0
end
def tree_type
v = NUKA::$tree_type[@item_id]
n = v != nil ? v : v == nil ? 0 : 0
return n
end
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
What i ment with the hash is that its used to tie tow things together.
See here where you just have one thing, you should change it to an array.
Hash is used when you want to do something like:
cat => feline, dog => canine
dirt => earth, rain => water
its sorta used as a definition of what something is. This is useful for stuff like keyboard character mapping.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

- Code:
{
#Here, you can add logs ID in the item database for defferent logs type.
100, #It's a normal log
101,
102,
103,
104,
105,
106,
107,
108,
109
}
See here where you just have one thing, you should change it to an array.
Hash is used when you want to do something like:
cat => feline, dog => canine
dirt => earth, rain => water
its sorta used as a definition of what something is. This is useful for stuff like keyboard character mapping.
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
Can I do something shorter than that?
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

- Code:
# 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
}
def logs_type_value
if @logs_type = 10
@logs_type = A
else if @logs_type = 5
@logs_type = B
else if @logs_type = 4
@logs_type = C
else if @logs_type = 3
@logs_type = D
else if @logs_type = 2
@logs_type = E
else if @logs_type = 1.5
@logs_type = F
end
end
- Code:
#----If the player cctt variables is equal or greater to 1, -------------------#
#----player can cut tree type 1------------------------------------------------#
if $tree_type = 1
if @cctt >= 1
can_cut = true
end
else if $tree_type = 2
if @cctt >= 2
can_cut = true
end
else if $tree_type = 3
if @cctt >= 3
can_cut = true
end
else if $tree_type = 4
if @cctt >= 4
can_cut = true
end
else if $tree_type = 5
if @cctt >= 5
can_cut = true
end
else if $tree_type = 6
if @cctt >= 6
can_cut = true
end
else if $tree_type = 7
if @cctt >= 7
can_cut = true
end
else if $tree_type = 8
if @cctt >= 8
can_cut = true
end
else if $tree_type = 9
if @cctt >= 9
can_cut = true
end
else if $tree_type = 10
if @cctt = 10
can_cut = true
end
else
can_cut = false
end
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
SO you basically are checking to see if the players level is high enough to cut the tree?
why not something like this:
This way in an event for the tree you can just run a conditional branch command using the code feature and type can_cut?(wood_level) and then take it from there.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

why not something like this:
- Code:
class interpreter
def can_cut?(wood_level)
return ($game_party.wood_cut_level >= wood_level)
end
end
This way in an event for the tree you can just run a conditional branch command using the code feature and type can_cut?(wood_level) and then take it from there.
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
I've edited the script recently. I'll use your trick later. Can you look it? I have an error at the last line with or without the "Woodcutting.new".
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
Administrator
Administrator

Administrator
profile
wow Nuka - you pick up super quick!
at the rate you are learning, you'll be able to script on your own soon.
it's just a guess but try "$Woodcutting = true"
I'll make some time to actually test yours once I'm done with a few scripts that I'm currently working on...
keep up the great work!
I always say it
It's not what and how you start
it's when and the way you finish it ^,^
G@MeF@Ce
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

at the rate you are learning, you'll be able to script on your own soon.

it's just a guess but try "$Woodcutting = true"
I'll make some time to actually test yours once I'm done with a few scripts that I'm currently working on...
keep up the great work!
I always say it
It's not what and how you start
it's when and the way you finish it ^,^
Administrator
Show Signature
Hey Guest, check out my demos!
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
G101's theme colors
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this image.]
shhh.... [You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
G101's theme colors
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this image.]
shhh.... [You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
The only one
The only one
The only one
profile
I have 3 days now. Saturday, Sunday and Monday. That'll be done probably soon.
EDIT:
The script is edit.
EDIT 2:
When I'll have finish, I'll make a super big job suite with windows in the main menu and everything else...
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

EDIT:
The script is edit.
EDIT 2:
When I'll have finish, I'll make a super big job suite with windows in the main menu and everything else...
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
Sorry but i wont be able to until tuesday. :\
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
@mr_wiggles or Gameface
The script don't want to work. It's incomprehensible for me. Can you check for that? I don't know why...
The script is finish. Someone can help me to polish it and fix the bug?
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

The script don't want to work. It's incomprehensible for me. Can you check for that? I don't know why...
The script is finish. Someone can help me to polish it and fix the bug?
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
The only one
The only one
The only one
profile
I' m actually sleeping. I'll come back soon. And with the first fonctionnal version of this script. See you later.
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile


The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
Hope you get it figured out, i run into snags like this all the time but your determination will help you get over the bumps and it will make that feeling when you complete it all the more satisfying.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
I'll need help to fix the last bugs. I need a scripter. I searched around 2 weeks the problems, but, I didn't find all of them. Here's the mos recent error I get:
[You must be registered and logged in to see this image.]
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

[You must be registered and logged in to see this image.]
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
This is whats causing your error. Your trying to create the class before the global $game_party is created causing the NIL. You should try to get rid of the global variables, try building this script into the Game_Player class. You can do calls to it by using $game_party.what_ever and it will save the class variables as well so it will remember the cutting level.
Seems your learning a lot, keep studding and you'll get the hang of it.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

- Code:
$woodcutting = Woodcutting.new
This is whats causing your error. Your trying to create the class before the global $game_party is created causing the NIL. You should try to get rid of the global variables, try building this script into the Game_Player class. You can do calls to it by using $game_party.what_ever and it will save the class variables as well so it will remember the cutting level.
- Code:
if @can_cut == true
case woodcutting_lvl
when 1..9
@cctt = 1
cut_tree = true
@random = true
when 10..19
@cctt = 2
cut_tree = true
@random = true
when 20..29
@cctt = 3
cut_tree = true
@random = true
when 30..39
@cctt = 4
cut_tree = true
@random = true
when 40..49
@cctt = 5
cut_tree = true
@random = true
when 50..59
@cctt = 6
cut_tree = true
@random = true
when 60..69
@cctt = 7
cut_tree = true
@random = true
when 70..79
@cctt = 8
cut_tree = true
@random = true
when 80..89
@cctt = 9
cut_tree = true
@random = true
when 90..100
@cctt = 10
cut_tree = true
@random = true
end
end
- Code:
if @can_cut
@cctt = (woodcutting_lvl / 10).ceil
cut_tree = true
@random = true
end
Seems your learning a lot, keep studding and you'll get the hang of it.

EVENTALIST
Show Signature
EVENTALIST
Tutorial Wizardmaster
Tutorial Wizardmaster

Tutorial Wizardmaster
profile
Looking forward to seeing the finished product. Mr_Wiggles is the perfect guy to learn the tricks of the trade from.
calvin624
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

Tutorial Wizardmaster
Show Signature
The only one
The only one
The only one
profile
Thank you mr_wiggles but, i'm not sure about game_party.what_ever.
I do like that?
The class
The end
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

I do like that?
The class
- Code:
class Woodcutting < Game_Party
The end
- Code:
#-----------------------------CASE BLOCK---------------------------------------#
if @can_cut
@cctt = (woodcutting_lvl / 10).ceil
cut_tree = true
@random = true
end
$game_party.woodcutting ##### I need to put the game_party here? ######
#------------------------------------------------------------------------------#
#-----------------------End of the block and class-----------------------------#
#------------------------------------------------------------------------------#
end #class woodcutting end
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
no, sorry the .whatever was an expression.
like to change the what ever to "what ever".
like so:
what ever just meant some def or var in the party class. Like $game_party.items, or $game_party.gold
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

like to change the what ever to "what ever".
like so:
- Code:
class Game_Party
def wood_level
return level
end
end
what ever just meant some def or var in the party class. Like $game_party.items, or $game_party.gold
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
Ok! Like that?
or this?
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

- Code:
end #end of class woodcutting
class Game_Party < Woodcutting
def woodcutting
$game_party.woodcuttinglvl = woodcutting_lvl
end
end
or this?
- Code:
class Game_Party < Game_Party
def woodcutting
$game_party.woodcuttinglvl = woodcutting_lvl
end
end
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
neither, the first would error because game party would be using woodcutting class as a super, not what you want. the second would error because your using a child class as the adult class for the same class.
just a simple "class Game_Party" is all you need. and for the wood cutting level, you just need to make an attr_accessor for woodcutting level variable created in the "def initialize".
that way you can check or change the value of the variable by using $game_party.woodcutting_level.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

just a simple "class Game_Party" is all you need. and for the wood cutting level, you just need to make an attr_accessor for woodcutting level variable created in the "def initialize".
that way you can check or change the value of the variable by using $game_party.woodcutting_level.
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
I don't know why I did'nt think to that.
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile


- Code:
class Game_Party
def initialize
attr_accessor :woodcutting_lvl
lumbering = woodcutting_lvl
$game_party.lumbering
end
end
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
The only one
The only one
The only one
profile
I get "undefine method attr_accessor for Game_Party#(some number and letters)" when I press on New game.
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
the attr_accessor is defined in the class its self not the def.
instead you need to do it here, or any place in the class so long as its not located inside any def.
Also you need to create a class variable not an instance. (defined by a @ symbol.)
like this.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

- Code:
class Game_Party
def initialize
attr_accessor :woodcutting_lvl # <-----
lumbering = woodcutting_lvl
$game_party.lumbering
end
end
instead you need to do it here, or any place in the class so long as its not located inside any def.
- Code:
class Game_Party
attr_accessor :woodcutting_lvl # <-----
def initialize
lumbering = woodcutting_lvl
$game_party.lumbering
end
end
Also you need to create a class variable not an instance. (defined by a @ symbol.)
- Code:
class Game_Party
attr_accessor :woodcutting_lvl
def initialize
lumbering = woodcutting_lvl # <-----
$game_party.lumbering
end
end
like this.
- Code:
class Game_Party
attr_accessor :woodcutting_lvl
def initialize
@lumbering = woodcutting_lvl # <-----
$game_party.lumbering
end
end
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
I have a lot to learn.
But I get undefine method lumbering for game_party class. But, it's not a method. it's a variable. Do I need to define it like:
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile


But I get undefine method lumbering for game_party class. But, it's not a method. it's a variable. Do I need to define it like:
- Code:
def lumbering
@lumbering = woodcutting_lvl
end
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
no you need to create the variable.
something like that.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

- Code:
class Game_Party
attr_accessor :woodlvl
alias :wood_init :initialize
def initialize
wood_init
@woodlvl = 0
end
end
something like that.
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
I'll read about alias cause I didn't read something about that. If I understand the little part of code, it's this?
alias :wood_init :initialize
def initialize
wood_init
@woodlvl = 0
end
end
The yellow call the initialition method and the green, the define.
But I have a tutorial about alias.
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

alias :wood_init :initialize
def initialize
wood_init
@woodlvl = 0
end
end
The yellow call the initialition method and the green, the define.
But I have a tutorial about alias.
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
yea the alias is like a def that is called so say initialize, then like intercepted. So say something like this, you look for when initialize is called and then you tell it to use this method first then when you use the alias (your yellow word) it will call the original initialize.
make sense?
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

make sense?
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
Nice, I start to be good! I understand something that I did'nt read about. 
I'll need to do like that, no?
But I don't understand why you extend the woodcutting with "_init". That call the original woodcutting class when I define thw woodcutting_lvl variable. But why "_init"?
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile


I'll need to do like that, no?
- Code:
class Game_Party
attr_accessor :woodcutting_lvl
alias :woodcutting_init :initialize
def initialize
woodcutting_init
@lumbering = 0
@lumbering = woodcutting_lvl
end
end
But I don't understand why you extend the woodcutting with "_init". That call the original woodcutting class when I define thw woodcutting_lvl variable. But why "_init"?
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
The only one
The only one
The only one
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.
[You must be registered and logged in to see this link.]
(19.54 Mb compress with winRAR)
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

EDIT:
Look the tree, I forgot to change the call method. But gave the same problem anyway.
[You must be registered and logged in to see this link.]
(19.54 Mb compress with winRAR)
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
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
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!!!
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

EDIT 2s later:

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!!!
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
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.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

$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
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:
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

- 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
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
The only one
The only one
The only one
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.
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
The only one
The only one
The only one
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
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile


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
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
Administrator
Administrator

Administrator
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.
G@MeF@Ce
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

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
Hey Guest, check out my demos!
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
G101's theme colors
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this image.]
shhh.... [You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
G101's theme colors
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this image.]
shhh.... [You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
The only one
The only one
The only one
profile
Hey hey, I know, finish what you started. You had learned me that. I remember our conversation in the chat.
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile


The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
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".
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

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
The only one
The only one
The only one
profile
Ok. I added a new edit to my script but, I didn't find how to call it, again.
I call $game_party.loop? And it's normal if I get an incompatibility issus with XAS 3.91?
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

- 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 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
$game_variables[24] = woodcutting_lvl
end
#define the woodcutting xp
def woodcutting_exp
NUKA::woodcutting_exp = woodcutting_xp
woodcutting_xp = 0
$game_variables[23] = woodcutting_lvl
end
#define the woodcutting energie
def energie_rem
NUKA::energie_rem = energie_rem
energie_rem = 100
$game_variables[22] = woodcutting_lvl
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
$game_variables[21] = @wc_next_lvl
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
I call $game_party.loop? And it's normal if I get an incompatibility issus with XAS 3.91?
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
||||||||||
||||||||||
The only one
The only one
The only one
profile
Yeah, me too. It's very hard this step.
So I need a part of code to call the entire script when I cut the tree but, it need to remember the xp, lvl, next lvl and the energie.
I'll need the help of mr_wiggles or G@MeF@Ce, but both are busy. IO try to search my own solution, but I don't find anything who can help.
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile


So I need a part of code to call the entire script when I cut the tree but, it need to remember the xp, lvl, next lvl and the energie.
I'll need the help of mr_wiggles or G@MeF@Ce, but both are busy. IO try to search my own solution, but I don't find anything who can help.
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
.... I don't wanna say it but i think you should build it over again with the new knowledge you have. Thinking about it and looking over your code there is just a lot going on i feel the only way to make it work is if you rebuild it. But this way we can do it together and you wont run into as many problems.
What do you say?
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

What do you say?
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
Ok but, can you give me a method to contact you outside this site. You're not connected very often and somethimes that could be nice to send you a mail or something like that. You can answer by PM or reply.
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile


The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
I try to check the forums everyday but sometimes i have things that need to be done. To be honest im on this site more then my email or even facebook. Your best chance of reaching me would be on this site.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
You don't have skype or Xfire? Do you check your PM often? Or it's really by making a new topic my best chance? Anyway, I want to know how to start my remake of the woodcutting script?
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile

The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
EVENTALIST
EVENTALIST

EVENTALIST
profile
well i have an msn account, [You must be registered and logged in to see this link.] , if you have one you can add me and we can use that to discus the script, or we can set up a time to meet in the chat box.
For the time from now till then, to start the script just create the module with the features you want in it, like what you have before. You can also create the class player and the alias defs to initialize, and do the same to class interpreter.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

For the time from now till then, to start the script just create the module with the features you want in it, like what you have before. You can also create the class player and the alias defs to initialize, and do the same to class interpreter.
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
The only one
profile
I think you maked an error in your mail cus when I send a message, I get a "delivery notification failure" mail. Try me at [You must be registered and logged in to see this link.]
poulet = chicken in french
[You must be registered and logged in to see this link.] was deactivated...
I started with that:
My trees are now edited. They are not cut exactly at the same position. But, this is just from 1 or 2 pixels.
NuKa_BuBble
![]() | ![]() | |
![]() | ||
![]() | ![]() |
profile


[You must be registered and logged in to see this link.] was deactivated...
I started with that:
- Code:
################################################################################
# Lumberjack system #
# #
# By: NuKa_BuBble #
# Version: 1.0 #
# Started: 23/10/2011 #
# #
# You can find me on these websites: #
# http://gameface101.playogame.com/ #
# #
# Special thank: #
# mr_wiggles #
# G@MeF@Ce #
# #
# #
################################################################################
# #
# No Graphics needed #
# #
################################################################################
# #
# Instructions #
# #
# First, you need to learn the job. $ljob = true #
# #
# #
################################################################################
#------------------------------------------------------------------------------#
# #
# NUKA module #
# #
#------------------------------------------------------------------------------#
module NUKA
# Self-switch C
sswitch = $game_self_switches['C']
# Lumberjack level
llvl = 1
# Lumberjack experience ponts
lxp = 0
# Energie amount gave to player
ener = 100
# Check if the maximum of jobs is reach
maxjobs = 5
jobknow = 0
# Check if you can learn the job
canlearn = nil
# Check what's the tree type
ttype = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
end# End of the module
#------------------------------------------------------------------------------#
# #
# Class Game_Party #
# #
#------------------------------------------------------------------------------#
class Game_Party
def main
# Lumberjack job is learned
$ljob = false
# The old lumberjack level
@old_llvl = 1
# Amount of experience gain when you cut a tree
@lxp_gain = 0
# Experience require to reach the next lumbering level
@n_llvl = 0
# Used for some computation methods
@a = 10
@b = 5
@c = 15
# Differents types of logs
@ltype = [10, 5, 4, 3, 2, 1.5]
# Check if the player have the required level to cut the type of tree
@cctt = 0
# Check if the player can cut the tree
@cc = nil
# Check if the player is equip with a lumbering weapon
@lweapon_id = [6, 7]
# The number of logs gain when you cut a tree
@lnumber = nil
end # End of initialize method
# More instructions
end # End of the class

My trees are now edited. They are not cut exactly at the same position. But, this is just from 1 or 2 pixels.
- Spoiler:
- [You must be registered and logged in to see this image.]
The only one
Show Signature
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>
___________________________________________________________________________
Booyah!
...._
._|_|_
. ( ')>