RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[XP] Tidloc's header

Started by tidloc, July 25, 2010, 01:31:07 PM

0 Members and 1 Guest are viewing this topic.

tidloc

Hi!

After having many troubles with 'stack going to deep' I decided to put all my scripts together within one header. Not all scripts are allready open for public for various reasons. But once they're after beta they'll be up here  ;D

Simply insert it above any of my scripts and it'll work :)

[spoiler=Header]################################################################################
#  Tidloc's Header  v.1.2                                                      #
#                   by Tidloc                                                  #
#==============================================================================#
#  Feel free to use it in your own RPG-Maker game.                             #
#  But please give me credits for this hell of work ^_^                        #
#------------------------------------------------------------------------------#
#  the Versions may differ from script to script you use of me, but be assured #
#  to always use the highest version available, so that no incompatibility may #
#  occur.                                                                      #
#  I've decided to use this header instead of implementing everything inside   #
#  my scripts as I first encountered the error of the stack going to deep by   #
#  aliasing.                                                                   #
#==============================================================================#
#  Now supported scripts by this header:                                       #
#          Blacksmith script *                                                 #
#          Alchemy script *                                                    #
#          Dismantle script *                                                  #
#          Questlog *                                                          #
#          Timephase script *                                                  #
#          Town script *                                                       #
#          Item classes script                                                 #
#          Runes script *                                                      #
#          Dynamic Shop *                                                      #
#------------------------------------------------------------------------------#
#  scripts with a '*' behind their names need this header to work correctly    #
#------------------------------------------------------------------------------#
#  Some of my Scripts use vocabulary, I entered the standard phrases in german #
#  and english. to change this write "ger" or "eng" into the constant Language #
################################################################################

module Tidloc
  Language  = "ger"
 
  Alchemy   = nil
  Smith     = nil
  Dismantle = nil
 
  Questlog  = nil
  D_Shop    = nil
  Phases    = nil
  Town      = nil
  Classes   = nil
  Runes     = nil
end


class Scene_Title
  alias wo_tidloc_command_new_game command_new_game
  def command_new_game
    $game_temp_tidloc_smith     = Game_Temp_Tidloc_Smith.new     if Tidloc::Smith
    $game_temp_tidloc_alch      = Game_Temp_Tidloc_Alch.new      if Tidloc::Alchemy
    $game_temp_tidloc_town      = Game_Temp_Tidloc_Town.new      if Tidloc::Town
   wo_tidloc_command_new_game
  end
end


class Scene_Save < Scene_File
  alias wo_tidloc_write_save_data write_save_data
  def write_save_data(file)
    wo_tidloc_write_save_data(file)

    Marshal.dump($game_temp_tidloc_smith, file) if Tidloc::Smith
    Marshal.dump($game_temp_tidloc_alch, file)  if Tidloc::Alchemy
    Marshal.dump($game_temp_tidloc_town, file)  if Tidloc::Town
   
  end
end


class Scene_Load < Scene_File
  alias wo_tidloc_read_save_data read_save_data
  def read_save_data(file)
    wo_tidloc_read_save_data(file)
   
    $game_temp_tidloc_smith = Marshal.load(file) if Tidloc::Smith
    $game_temp_tidloc_alch = Marshal.load(file)  if Tidloc::Alchemy
    $game_temp_tidloc_town = Marshal.load(file)  if Tidloc::Town
   
    $game_system.tidloc_dshop       = [] if $game_system.tidloc_dshop.nil? && Tidloc::D_Shop
    $game_system.tidloc_dshop_count = 0  if $game_system.tidloc_dshop_count.nil? && Tidloc::D_Shop
    $game_system.questlog = Questlog.new if $game_system.questlog.nil? && Tidloc::Questlog
  end
end


class Scene_Map
  alias wo_tidloc_main main
  def main
    @neuemap = false if Tidloc::Town
    @tidloc_dshop_time  = Graphics.frame_count / Graphics.frame_rate if Tidloc::D_Shop
    wo_tidloc_main
  end
 
  alias wo_tidloc_map_update update
  def update
    if Tidloc::D_Shop
      if ((@tidloc_dshop_time/60)+Tidloc::DSHOP_TIMESTEP) < ((Graphics.frame_count / Graphics.frame_rate) / 60)
        @tidloc_dshop_time  = Graphics.frame_count / Graphics.frame_rate
        for i in 0...$game_system.tidloc_dshop_count
          for j in 0...$game_system.tidloc_dshop[i].count
            if !($game_system.tidloc_dshop[i].bonus[j] || $game_system.tidloc_dshop[i].epic[j])
              if $game_system.tidloc_dshop[i].empty[j]
                $game_system.tidloc_dshop[i].stock[j] += rand(Tidloc::DSHOP_MAXGAIN[$game_system.tidloc_dshop[i].items[j][0]])
                $game_system.tidloc_dshop[i].empty[j] = false if $game_system.tidloc_dshop[i].stock[j] > 0
              else
                $game_system.tidloc_dshop[i].stock[j] += rand(2*Tidloc::DSHOP_MAXGAIN[$game_system.tidloc_dshop[i].items[j][0]])-Tidloc::DSHOP_MAXGAIN[$game_system.tidloc_dshop[i].items[j][0]]
                if $game_system.tidloc_dshop[i].stock[j] < 1
                  $game_system.tidloc_dshop[i].stock[j] = 0
                  $game_system.tidloc_dshop[i].empty[j] = true
                end
              end
            end
          end
          if Tidloc::DSHOP_CALCTIME
            if rand(10000) < TIDLOC_DSHOP_PROP
              temp = []
              a=0
              for x in Tidloc::DSHOP_SPECIALS
                for y in x[2]
                  if y == $game_system.tidloc_dshop[i]._id
                    temp.push [x[0],x[1]]
                  end
                end
              end
              if temp.size > 0
                t = rand(temp.length)
                $game_system.tidloc_dshop_add_bonus($game_system.tidloc_dshop[i]._id,temp[t])
              end
            end
          end
        end
      end
    end
    wo_tidloc_map_update
    if (Graphics.frame_count * 3 / Graphics.frame_rate) != @total_seconds
      @total_seconds = Graphics.frame_count * 3 / Graphics.frame_rate
      if Tidloc::Smith
        for i in 0...$game_temp_tidloc_smith.smith_busy.length
          if $game_temp_tidloc_smith.smith_busy[i] && $game_temp_tidloc_smith.smith_time[i] > 0
            $game_temp_tidloc_smith.smith_time[i] -= 1
          end
        end
      end
      if Tidloc::Alchemy
        for i in 0...$game_temp_tidloc_alch.alch_busy.length
          if $game_temp_tidloc_alch.alch_busy[i] && $game_temp_tidloc_alch.alch_time[i] > 0
            $game_temp_tidloc_alch.alch_time[i] -= 1
          end
        end
      end
     
    end
    if Tidloc::Phases
      if (Graphics.frame_count * 1 / Graphics.frame_rate) != @total_sec
        if $game_switches.[](Tidloc::Phases_sw3) == false
          @total_sec = Graphics.frame_count * 1  / Graphics.frame_rate
          $game_variables.[]=(Tidloc::Phases_var2, $game_variables.[](Tidloc::Phases_var2)+1)
        end
        if $game_switches.[](Tidloc::Phases_sw2) == true
          if $game_variables.[](Tidloc::Phases_var2) < 10
            $game_screen.pictures[5].show("Balken/SP_0" + $game_variables.[](Tidloc::Phases_var2).to_s + ".bmp", 0, 535, 85, 100, 100, 255, 0)
          else
            $game_screen.pictures[5].show("Balken/SP_" + $game_variables.[](Tidloc::Phases_var2).to_s + ".bmp", 0, 535, 85, 100, 100, 255, 0)
          end
          $game_screen.pictures[4].show("phase_" + $game_variables.[](Tidloc::Phases_var1).to_s + ".png", 0, 0, 0, 100, 100, 255, 0)
        else
          $game_screen.pictures[5].erase
          $game_screen.pictures[4].erase
        end
        if $game_variables.[](Tidloc::Phases_var2) == 64
          if $game_temp.smith_script
            for i in 0...$game_temp.smith_busy.length
              if $game_temp.smith_busy[i] && $game_temp.smith_time[i]
                if $game_temp.smith_time[i] < 0
                  $game_temp.smith_time[i] += 1
                end
              end
            end
          end
          if $game_temp.alch_script
            for i in 0...$game_temp.alch_busy.length
              if $game_temp.alch_busy[i] && $game_temp.alch_time[i]
                if $game_temp.alch_time[i] < 0
                  $game_temp.alch_time[i] += 1
                end
              end
            end
          end
          $game_variables.[]=(Tidloc::Phases_var2, -1)
          if $game_switches.[](Tidloc::Phases_sw1) == true
            $game_variables.[]=(Tidloc::Phases_var1, $game_variables.[](Tidloc::Phases_var1) + 1)
          else
            $game_variables.[]=(Tidloc::Phases_var1, $game_variables.[](Tidloc::Phases_var1) - 1)
          end
          if $game_variables.[](Tidloc::Phases_var1) == 0
            $game_switches.[]=(Tidloc::Phases_sw1, true)
          elsif $game_variables.[](Tidloc::Phases_var1) == 8
            $game_switches.[]=(Tidloc::Phases_sw1, false)
          end
        end
      end
    end
    if Tidloc::Town
      if $game_switches.[](TIDLOC_TOWN_NEW_AREA) && !@neuemap
        @neuemap_seconds = Graphics.frame_count * 3 / Graphics.frame_rate
        @neuemap = true
      elsif @neuemap
        if (Graphics.frame_count * 3 / Graphics.frame_rate) != @neuemap_seconds
          @neuemap = false
          $game_switches.[]=(TIDLOC_TOWN_NEW_AREA,false)
        end
      end
      if (Graphics.frame_count * 3 / Graphics.frame_rate) != @total_seconds3
        @total_seconds3 = Graphics.frame_count * 3 / Graphics.frame_rate
        if $game_temp_tidloc_town._town_busy && $game_temp_tidloc_town._town_time > 0
          $game_temp_tidloc_town._town_time -= 1
        end
      end
    end
   
  end
end
[/spoiler]

Links to my affected scripts in this Forum:
Blacksmith-/Alchemy-Script
Dismantling script
Enhanced Queslog
Dynamic Shop System
When using a new of my scripts, you should always look if there is a new version of my header ;-)

Have fun! :)

edit 151210: New Scripts supported and english/german standard vocabulary inserted into all scripts.
[...]And they feared him.
He understands that cruelty arises from opportunity![...]