LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



Go to page : Previous  1, 2, 3, 4, 5

View previous topic View next topic Go down Message [Page 5 of 5]

The only one
The only one
#41 Lumberjack script. In progress again... - Page 5 Empty Re: Lumberjack script. In progress again...
Loading

NuKa_BuBble

NuKa_BuBble
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.

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
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
||||||||||
||||||||||
#42 Lumberjack script. In progress again... - Page 5 Empty Re: Lumberjack script. In progress again...
Loading

supercow

supercow
||||||||||
||||||||||
profile
wish i can help but im clueless Embarassed
||||||||||
Show Signature
||||||||||
The only one
The only one
#43 Lumberjack script. In progress again... - Page 5 Empty Re: Lumberjack script. In progress again...
Loading

NuKa_BuBble

NuKa_BuBble
The only one
The only one
profile
Yeah, me too. It's very hard this step.Cool

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
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
EVENTALIST
EVENTALIST
#44 Lumberjack script. In progress again... - Page 5 Empty Re: Lumberjack script. In progress again...
Loading

mr_wiggles

mr_wiggles
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?
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
#45 Lumberjack script. In progress again... - Page 5 Empty Re: Lumberjack script. In progress again...
Loading

NuKa_BuBble

NuKa_BuBble
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. Very Happy
The only one
Show Signature
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
EVENTALIST
EVENTALIST
#46 Lumberjack script. In progress again... - Page 5 Empty Re: Lumberjack script. In progress again...
Loading

mr_wiggles

mr_wiggles
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.
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
#47 Lumberjack script. In progress again... - Page 5 Empty Re: Lumberjack script. In progress again...
Loading

NuKa_BuBble

NuKa_BuBble
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?
The only one
Show Signature
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee
EVENTALIST
EVENTALIST
#48 Lumberjack script. In progress again... - Page 5 Empty Re: Lumberjack script. In progress again...
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
well i have an msn account, xxmrwiggglezxx@hotmail.com , 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.
EVENTALIST
Show Signature
EVENTALIST
The only one
The only one
#49 Lumberjack script. In progress again... - Page 5 Empty Re: Lumberjack script. In progress again...
Loading

NuKa_BuBble

NuKa_BuBble
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 poulet.3000@hotmail.fr Laughing poulet = chicken in french
nuka_bubble@hotmail.fr 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 variables are a lot shorter eh? gameface

My trees are now edited. They are not cut exactly at the same position. But, this is just from 1 or 2 pixels.

Spoiler:
The only one
Show Signature
The only one
http://nukabubble.deviantart.com/ http://soundcloud.com/nuka_bubble https://www.youtube.com/user/NuKaBuBble?feature=mhee

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 5 of 5]

Go to page : Previous  1, 2, 3, 4, 5

 

Chatbox system disabled
Personal messaging disabled