[XP] Tons of Add-ons

Started by Blizzard, January 09, 2008, 08:50:47 am

Previous topic - Next topic

feandrad

June 04, 2009, 10:07:47 am #380 Last Edit: June 04, 2009, 10:19:28 am by feandrad
I have a problem with some add-ons. The EQUAP Skill crashes the game when the party is not empyt and the fullscreen doesn't work.

The EQUAP Error is: "undefined method 'equap_nonlearbable_skills' for BlizzCFG:Module".

When I start the game with no actors, it works normaly. The error appears when I add a actor to the party.

I use the Blizz-ABS 2.24. Please help me. ^^

Juan

The fullscreen add-on does work. It only works in normal play.
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

feandrad

June 04, 2009, 10:23:08 am #382 Last Edit: June 04, 2009, 10:25:16 am by feandrad
Oh f**k, that`s true. Sorry, I'm newbie.....  :wacko:

Thank you Juan.

And the problem with Equap Skills? Anyone can help??

Blizzard

Quote from: game_guy on May 16, 2009, 09:18:47 pm
Quote from: Youngster Gi Gi on May 04, 2009, 09:50:58 am
I didnt even configure it. I set it to true to test it out with Blizz ABS.

Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# EQUAP Skills by Blizzard
# Version: 4.2b
# Type: Skill System
# Date: 28.05.2006
# Date v2.0: 13.06.2006
# Date v2.02b: 16.1.2007
# Date v3.0b: 19.2.2007
# Date v3.02b: 7.3.2007
# Date v4.0b: 13.7.2008
# Date v4.1b: 19.10.2008
# Date v4.2b: 22.10.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Explanation:
#
#   This add-on will allow you to bound skills to equipment. Equip it and you
#   learn the skill, unequip it and you will forget it. The AP system allows to
#   gain AP for skills and learn the permanently if the max AP for the skill
#   are gathered. (This system is a very similar one to FF9's AP Skill System.)
#
#
# v2.0:
#   - fixed bug, that appeared, when more equipment parts had the same skill
#   - new multi-skill support
#
# v2.02b:
#   - improved coding a little bit
#
# v3.0b:
#   - completely overworked and added optional AP system (similar to FF9)
#     (I want to mention here I made this especially for blazinhandle =) )
#
# v3.02b:
#   - fixed bugs
#
# v4.0b:
#   - fixed a critical bug
#   - no more EQUAP element
#   - skills that have less than 0 max AP cannot be learned
#   - compatible with Guilamme777's Multi-Slot Equipment System
#   - works more convenient
#   - better coding
#
# v4.1b:
#   - fixed problems with gaining AP
#
# v4.2b:
#   - added functionality to prevent some characters from learning certain
#     skills
#
#
# Compatibility:
#
#   99% compatible with SDK v1.x. 60% compatible with SDK v2.x. WILL cause
#   incompatibility with custom equipment scripts but there are instructions
#   how to configure the script. Compatible with Guilamme777's Multi-Slot
#   Equipment System. Please note, that this script depends on the layout of
#   your Equip Screen and needs to be put UNDER a CMS script if you are using
#   one. WILL corrupt your old savegames. Might not work with some CMS-es.
#
#
# Instructions:
#
# - Configuration:
#
#   Press CRTL+SHIFT+F and type into the window one of the following:
#
#     Start EQ Database
#     Start MAXAP Database
#     Start GAINAP Database
#
#   You can jump now to the database directly. There are more instructions.
#
# - Merge with a Custom Equipment System:
#   
#   To make this system work with any custom equipment script, you need to
#   edit the method "prepare_equap" which fetches all current weapon IDs and
#   armor IDs.
#
#
# NOTE:
#
#   DO NOT USE EQUAP SKILLS AS NORMAL SKILLS! THE SYSTEM WORKS WITH TEMPORARY
#   LEARNING AND FORGETTING THE EQUAP SKILL. IF YOU LET YOUR CHARACTER LEARN AN
#   EQUAP SKILL BY NORMAL MEANS, HE WILL FORGET IT AFTER HE UNEQUIPS THE
#   APPROPRIATE EQUIPMENT!
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com/
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

if TONS_OF_ADDONS::EQUAP_SKILLS

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start EQUAP General Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

DISPLAY_AP_GAIN = true # uses a modified Battle Result to display gained AP
DISPLAY_AP_REQ = true # shows CURRENT_AP/NEEDED_AP in the skill's name
DISPLAY_AP_ZERO = true # shows 0/0 if the skill can't be learned
GAIN_DEAD = false # dead actor also gain AP, no matter what

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End EQUAP General Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# Game_System
#==============================================================================

class Game_System
 
  def maxap(id)
    case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start of MAXAP Database
#
#   Here you can define the APs needed to learn a skill. If you add no skills
#   here the AP system is automatically disabled. Configure it like this
#   template:
#
#     when SKILL_ID then return MAXAP
#
#   SKILL_ID - the ID of the skill that will be learned with AP
#   MAXAP    - how many AP are required to learn the skill
#
#   If you give a skill negative max AP, the skill will be completely bound to
#   the equipment part and will be forgotten when it is unequipped.
#
# Note:
#
#   Don't forget to assign your AP skills to equipment in the EQ Database
#   below. Every skill with 0 AP (default) is a normal skill.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then return -1
    when 2 then return 10
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of MAXAP Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 0
  end
 
  def gainap(id)
    case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start of GAINAP Database
#
#   Here you can define how many AP you will get from enemy troops. Configure
#   it like this template:
#
#     when TROOP_ID then return GAINAP
#
#   TROOP_ID - the ID of the enemy troop
#   GAINAP   - how many AP will the player get from this troop.
#
# Note:
#
#   This will automatically be disabled if there are no AP skills.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then return 2
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of MAXAP Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 0
  end
 
  def eq_database(id, weapon = true)
    skill_ids = []
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start of EQ Database
#
#   This is your equipment database. To add one or more new EQUAP skills to a
#   weapon is very simple. Add another "when"-branch in the script snipplet
#   below (they have comments next to it). Configure it like this template:
#
#     when WEAPON_ID
#       @skill_ids.push(EQUAP_SKILL_ID1)
#       @skill_ids.push(EQUAP_SKILL_ID2)
#
#   The same works for armors:
#
#     when ARMOR_ID
#       @skill_ids.push(EQUAP_SKILL_ID1)
#       @skill_ids.push(EQUAP_SKILL_ID2)
#
#   The lines are commented below so you should have no problems with the script.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    if weapon
      case id
      when 1 # weapon ID
        skill_ids.push(10) # EQUAP skill ID
        skill_ids.push(11) # EQUAP skill ID
      when 5
        skill_ids.push(8)
        skill_ids.push(12)
      when 9
        skill_ids.push(1)
        skill_ids.push(3)
      end
    else
      case id
      when 1 # armor ID
        skill_ids.push(1) # EQUAP skill ID
        skill_ids.push(25) # EQUAP skill ID
      when 3
        skill_ids.push(7)
        skill_ids.push(4)
      when 5
        skill_ids.push(15)
      when 8
        skill_ids.push(32)
        skill_ids.push(29)
      when 13
        skill_ids.push(2)
        skill_ids.push(25)
      when 18
        skill_ids.push(27)
      when 19
        skill_ids.push(25)
      when 29
        skill_ids.push(10)
      end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of EQ Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return skill_ids
  end
 
  def equap_nonlearnable_skills(id)
    case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start of NONLEARNABLE SKILLS Database
#
#   Here you can define skills that can't be learned by certain actors at all.
#   Configure it like this template:
#
#     when ACTOR_ID then return [SKILL_ID1, SKILL_ID2, ...]
#
#   ACTOR_ID - the ID of the enemy troop
#   SKILL_ID - the ID of the skill this actor can't learn through EQUAP
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then return [59, 60]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End of NONLEARNABLE SKILLS Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return []
  end
 
end
 
#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor
 
  alias setup_equap_later setup
  def setup(id)
    @ap = {}
    setup_equap_later(id)
    test_equap
  end
 
  alias equip_equap_later equip
  def equip(equip_type, id)
    equip_equap_later(equip_type, id)
    test_equap
  end
 
  def add_ap(val)
    @skills.each {|id| @ap[id] = 0 if @ap[id] == nil}
    @ap.each_key {|id|
        @ap[id] = self.ap(id) + val
        @ap[id] = 0 if self.ap(id) < 0
        maxap = $game_system.maxap(id)
        @ap[id] = maxap if self.ap(id) > maxap}
  end
 
  def ap(id)
    return (@ap[id] == nil ? 0 : @ap[id])
  end
 
  def prepare_equap ### edit this method for custom equipment support
    # Guilamme777 compatibility switch
    return self.weapon_ids, self.armor_ids if defined?(G7_MS_MOD)
    weapons = [@weapon_id]
    armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
    return weapons, armors
  end
 
  def test_equap
    non_learnable = BlizzCFG.equap_nonlearnable_skills(self.id)
    (@skills - non_learnable).each {|id|
        maxap = $game_system.maxap(id)
        forget_skill(id) if maxap < 0 || self.ap(id) < maxap}
    weapons, armors = prepare_equap
    skill_ids = []
    weapons.each {|id| skill_ids += $game_system.eq_database(id, true)}
    armors.each {|id| skill_ids += $game_system.eq_database(id, false)}
    (skill_ids - non_learnable).each {|id| learn_skill(id)}
  end
 
end

#==============================================================================
# Game_Troop
#==============================================================================

class Game_Troop
 
  attr_reader :id
 
  alias setup_equap_later setup
  def setup(troop_id)
    setup_equap_later(troop_id)
    @id = troop_id
  end
 
end

#==============================================================================
# Window_BattleResult
#==============================================================================

class Window_BattleResult
 
  def refresh_extra(aps)
    self.contents.fill_rect(0, 0, self.width, 32, Color.new(0, 0, 0, 0))
    x = 4
    self.contents.font.color = normal_color
    cx = contents.text_size(@exp.to_s).width
    self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
    x += cx + 4
    self.contents.font.color = system_color
    cx = contents.text_size('EXP').width
    self.contents.draw_text(x, 0, 64, 32, 'EXP')
    x += cx + 16
    self.contents.font.color = normal_color
    cx = contents.text_size(@gold.to_s).width
    self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
    x += cx + 4
    self.contents.font.color = system_color
    cx = contents.text_size($data_system.words.gold).width
    self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
    x += cx + 16
    self.contents.font.color = normal_color
    cx = contents.text_size(aps.to_s).width
    self.contents.draw_text(x, 0, cx, 32, aps.to_s)
    x += cx + 4
    self.contents.font.color = system_color
    self.contents.draw_text(x, 0, 128, 32, 'AP')
  end

end

#==============================================================================
# Window_Skill
#==============================================================================

class Window_Skill
 
  alias draw_item_equap_later draw_item
  def draw_item(index)
    skill = @data[index]
    aps = $game_system.maxap(skill.id)
    if DISPLAY_AP_REQ && !$scene.is_a?(Scene_Battle) &&
        (aps > 0 || aps != 0 && DISPLAY_AP_ZERO)
      if @actor.skill_can_use?(skill.id)
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      x, y = 4+index%2*320, index/2*32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(skill.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      text = skill.name
      if aps > 0
        text += " (#{@actor.ap(skill.id)}/#{aps})"
      elsif DISPLAY_AP_ZERO
        text += ' (0/0)'
      end
      self.contents.draw_text(x + 28, y, 204, 32, text, 0)
      self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
    else   
      draw_item_equap_later(index)
    end
  end
 
end

#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle
 
  alias start_phase5_equap_later start_phase5
  def start_phase5
    start_phase5_equap_later
    aps = $game_system.gainap($game_troop.id)
    @result_window.refresh_extra(aps) if DISPLAY_AP_GAIN
    $game_party.actors.each {|a| a.add_ap(aps) if !a.dead? || GAIN_DEAD}
  end
 
end

end


EDIT:
Umm I fixed it blizz. You musta not noticed but the non_learnable_skills is under $game_system not BlizzCFG.
line 1788 needs to be
non_learnable = $game_system.equap_nonlearnable_skills(self.id)



EDIT 2:
I'm not gettin AP when I kill enemies in babs



In case you didnt notice I posted the fix for it already...in fact awhile ago....
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

feandrad

Works!!! Thank you Blizz. Your ABS is awesome!

G_G

any way to modify your Custom Controls Add On to make it where each key adds to a variable? I'd make it myself but I dont want to have a bunch of if branches so I figured there might be a way to modify the script to make a certain input add to a variable.

Blizzard

Like, when you press a button on the map, it would add 1 to some variable? Something like a press counter?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

Yea but each letter adds a certain number according to the letter pressed. I just want it for letters.
a would add 1
b would add 2
c would add 3
d would add 4
etc.

Blizzard

June 18, 2009, 10:25:52 am #388 Last Edit: June 18, 2009, 10:28:24 am by Blizzard
Input::Key[LETTER] - 1000


This will give you the ASCII value of each key. i.e.

$game_variables[Input::Key['A'] - 1000] += 1


Even though I would rather suggest to use another hash somewhere like Game_Temp or Game_System because your lovely Game_Variables are horribly limited as you can see. :P

Input::Key.each_key {|key|
   if Input.trigger?(key)
     if $game_system.key_counters.has_key?(key)
       $game_system.key_counters[key] += 1
     else
       $game_system.key_counters[key] = 1
     end
   end
}
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

fugibo

Quote from: Blizzard on June 18, 2009, 10:25:52 am
Input::Key[LETTER] - 1000


This will give you the ASCII value of each key. i.e.

$game_variables[Input::Key['A'] - 1000] += 1


Even though I would rather suggest to use another hash somewhere like Game_Temp or Game_System because your lovely Game_Variables are horribly limited as you can see. :P

Input::Key.each_key {|key|
   if Input.trigger?(key)
     if $game_system.key_counters.has_key?(key)
       $game_system.key_counters[key] += 1
     else
       $game_system.key_counters[key] = 1
     end
   end
}



Why use a hash when you can just use an array?

Input::Keys.each do |key|
  key = key[0] # Gets number version of ASCII value
  $game_system.key_counters[key] = $game_system.key_counters[key] ? $game_system.key_counters[key] + 1 : 1
end


Blizzard

Processing redundancy and you can't iterate properly through it.

ary.each {|element|
   if element != nil
     do_stuff
   end
}

hash.each_value {|element|
   do_stuff
}


Also, easy access.

ary[Input::Key[LETTER] - 1000]

hash[LETTER]
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

Input::Key.each_key {|key|
    if Input.trigger?(key)
      if $game_system.key_counters.has_key?(key)
        $game_system.key_counters[key] += 1
      else
        $game_system.key_counters[key] = 1
      end
    end
}

So would I place this in a new script then or in your custom controls? I'll use the key counters thing

Blizzard

June 18, 2009, 11:22:08 am #392 Last Edit: June 18, 2009, 11:29:57 am by Blizzard
You could put it in Scene_Map for map logs only. Or if you put it in "def Input.update" in Tons, it would log everything. Just make sure that you check if $game_system isn't nil first before you execute this code. Best thing about this way:

$game_system.key_counters.each_key {|key|
   p key + ' was pressed ' + $game_system.key_counters[key] + ' times.'
}


Or:

$game_system.key_counters.each {|key, value|
   p key + ' was pressed ' + value + ' times.'
}


EDIT: Ah crap. I totally forgot to post that I put up v7.3. ;_;
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

fugibo

Blargh. Makes me miss C arrays somewhat X|

Blizzard

Still redundant memory usage. xD
When you're already wasting memory like that, you can simply use a hash, make your code look nice and make the job easier on yourself. xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

fugibo

Quote from: Blizzard on June 18, 2009, 01:00:38 pm
Still redundant memory usage. xD
When you're already wasting memory like that, you can simply use a hash, make your code look nice and make the job easier on yourself. xD


Really, though, how hard would it have been for Matz to just include some kind of static (or resizable, but only by called array.resize, similar to a C++ vectors) array, really?

Blizzard

You don't get what I mean at all.

a = []
a[1000000] = 0


This array will get filled with nils from index 0 to 999999. You are wasting loads of memory for nothing.
Ruby array IS like a vector in C++. It even resizes itself if necessary.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

fugibo

Yes, but you can set vectors to only resize when you want them to. Scrap that, though, I just want a static array >_<

eccomancer

hey,

im new here and a total noob to RPG Maker. First of all id like to say awesome script- its absolutely amazing and very user friendly.(even for a noob  :evil:).

I do have a problem however, If it is at all possible for anyone to address. im using the "Tons of Add-ons by Blizzard" script version 7.30b, "Stat Distribution System by Blizzard" script version 1.33b "StormTronics CMS by Blizzard" script version 5.38b.

My Problem seems to be that when i turn on the EQUAP_SKILLS part of the tons of add on script and i try and access skills from the menu i get an error: Script ' (*) STCMS - Hybrid Edition' line 1412: NoMethodError occured. undefined method 'maxap' for #<Game_System:0x3d34720>

This only seems to happen when i have EQUAP_SKILLS on and i use the CMS, maybe im missing something- i'd appreciate it if someone could provide a solution to my problem and sorry for the ignorance (still tryna learn  :P)

Also i wanted to find out if it is at all possible to have a CMS that shows the skills to be learned from equipining something (weapon or armour-using the EQUAP_SKILLS) i.e. under the equip tag of the menu, when u choose to equip your character with a weapon a little side window pops up showing what skills can be learned from that weapon and how much AP such skill costs. And further more is it also possible to display the icon of the weapon/armour from where that skill originates next to the AP amount. e.g. for "Cross Cut" skill: have the skill07 icon to the left, then the name of the skill (Cross Cut), then the AP count (0/10), then an icon of the weapon from which the skill originated on the right?

I know i am probably asking for a lot, but if anyone has the time to see to my problem i would really appreciate it  :) Thanx in advance (and for putting up with my ignorance :P)

Aqua