Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: Blizzard on December 04, 2008, 10:32:05 am

Title: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on December 04, 2008, 10:32:05 am
Secondary Weapon for Blizz-ABS
Authors: Blizzard
Version: 1.0b
Type: Blizz-ABS plugin
Key Term: Blizz-ABS Plugin



Introduction

This script will add a button for a secondary weapon which is equipped in the place of the armor. This plugin only provides the control, not the equipping!

This script is to be distributed under the same terms and conditions like the script it was created for: Blizz-ABS.


Features




Screenshots

N/A


Demo

N/A


Script

Just make a new script above main and paste this code into it.
Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Secondary Weapon for Blizz-ABS by Blizzard
# Version: 1.0b
# Type: Blizz-ABS Add-on
# Date: 4.12.2008
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#  This script is to be distributed under the same terms and conditions like
#  the script it was created for: Blizz-ABS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
#   This script must be placed below Blizz-ABS and require Blizz-ABS v2.1 or
#   higher to work properly. It will add a button for a secondary weapon which
#   is equipped in the place of the armor. This plugin only provides the
#   control, not the equipping!
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

if !$BlizzABS || BlizzABS::VERSION < 2.1
  raise 'ERROR: The "Secondary Weapon" plugin requires Blizz-ABS 2.1 or higher.'
end

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# button for secondary weapon
SECONDARY_WEAPON_BUTTON = Input::Key['G']

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# BlizzABS::Controls
#==============================================================================

class BlizzABS::Controls
 
  alias update_attack_aqua_later update_attack
  def update_attack
    return true if update_attack_aqua_later
    if $game_system.attack_button && Input.trigger?(SECONDARY_WEAPON_BUTTON)
      $game_player.use_attack2
      return true
    end
    return false
  end
 
end

#==============================================================================
# Map_Actor
#==============================================================================

class Map_Actor
 
  def use_attack2
    self.battler.weapon_id, self.battler.armor1_id =
        self.battler.armor1_id, self.battler.weapon_id
    result = (self.battler.weapon_id != 0 && use_attack)
    self.battler.weapon_id, self.battler.armor1_id =
        self.battler.armor1_id, self.battler.weapon_id
    return result
  end
 
end

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor
 
  attr_accessor :weapon_id
  attr_accessor :armor1_id
 
end



Instructions

None required.


Compatibility

Requires Blizz-ABS to work.


Credits and Thanks




Author's Notes

Keep in mind that this plugin comes UNDER Blizz-ABS. This script was done on request quite some time ago and is not fully supported by me as my other scripts are.

If you find any bugs, please report them here:
http://forum.chaos-project.com

That's it! N-Joy! =D
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Punn on December 04, 2008, 03:54:02 pm
Not compatible with Guiluame's multi-equip?
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on December 04, 2008, 04:07:04 pm
I don't think so. Well, if you would change that armor1_id is substituted with the the weapon_id, it might work. I might fix this compatibility issue myself later, though.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Makasu on December 17, 2008, 09:43:11 am
I'm sorry to bring this topic back up but using this with BABS is there a way to make the second attack show? IE if I have two guns dual weilded? It'll show the character set accompanied with the bullet?
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on December 17, 2008, 10:11:29 am
Yes. This add-on swaps the secondary weapon with the real one to execute the attack so all of Blizz-ABS's configurations work normally. Then it swaps it back.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Makasu on December 17, 2008, 10:14:14 am
Argh well I can't get it to work. :( not at all. It won't use the attack or show the sprites associated...
Maybe it would be the script order? I'm not to sure though.

Help?
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on December 17, 2008, 10:28:10 am
Quote from: Blizzard on December 04, 2008, 10:32:05 am
Author's Notes

Keep in mind that this plugin comes UNDER Blizz-ABS.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Makasu on December 17, 2008, 10:32:54 am
Yes I have it under BABS but still nothing at all. :( I'm not to sure whats going on. But I get nothing. No second attack or anything. No damage pops or anything. I even tried it where I have a gun and a sword equipped and nothing at all! I would put together another demo for you but I'm more than certain you're tired of troubleshooting me. XD
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on December 17, 2008, 11:33:38 am
You do realize that the second weapon is equipped as shield (which has to have the same ID as the appropriate weapon) and that it doesn't work with custom equipment systems?
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Makasu on December 17, 2008, 11:40:22 am
I'm not aware of that. So there is no way to get it to work the way I want to have it? At all?

But see with Guille's it adds another weapon slot while keeping the original shields and such intact.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on December 17, 2008, 11:47:56 am
You can use a custom mod. Best you ask Aqua. She made a mod for herself.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Makasu on December 17, 2008, 11:51:10 am
Alrighty! :D will do. Thanks a lot Blizz greatly appreciated. But either ways so does this script work with BABS 2.x? Because either if I try to use a sword or shield or anything of that nature it get nothing for a second attack.

Oh wait nevermind. You just explained that. XD
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on December 17, 2008, 12:08:48 pm
Quote from: Blizzard on December 04, 2008, 10:32:05 am
#   This script must be placed below Blizz-ABS and require Blizz-ABS v2.1 or
#   higher to work properly. ...


Try using a shield that has the same ID as some weapon. i.e. a sword is ID 6, so equip a shield with armor ID 6.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Kagutsuchi on December 29, 2008, 06:55:38 pm
Could you make a two-handed weapon feature?
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on December 30, 2008, 07:58:31 am
No, this is not ABS specific.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: G_G on March 16, 2009, 10:10:21 pm
This is a cool plugin though I have one question. Is it possible to make it actor specific?
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on March 17, 2009, 02:26:38 am
Don't allow equipping another weapon, duh.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: RoseSkye on April 02, 2009, 06:43:51 pm
How would I make it  armor specific? Some Shields I want to shield.. others I want to attack.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on April 03, 2009, 05:58:04 am
You need to distiguish them. Find this line:

    if $game_system.attack_button && Input.trigger?(SECONDARY_WEAPON_BUTTON)


Change it to this:

    if $game_system.attack_button && Input.trigger?(SECONDARY_WEAPON_BUTTON) && [X, Y, Z].include?($game_player.battler.armor1_id)


Replace X, Y, Z and add/remove armor IDs that can attack.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Aqua on April 04, 2009, 12:46:42 am
*whistles*
I found the mod I use for double weapons... XD

http://www.creationasylum.net/index.php?showtopic=1604 (http://www.creationasylum.net/index.php?showtopic=1604)
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: RoseSkye on August 06, 2009, 07:16:16 am
Necro (for good reason)

I noticed that the secondary button is nothing but a .. secondary button.

Example:
The first weapon is a arm bow with X range
the second weapon would be that as well as opposed to  feet or something thats not a arm bow.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on August 06, 2009, 12:00:48 pm
Quote from: RoseSkye on August 06, 2009, 07:16:16 am
I noticed that the secondary button is nothing but a .. secondary button.


Well noticed.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: RoseSkye on August 06, 2009, 12:29:17 pm
>.> *re-reads first post* Ooooh.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Feildmaster on March 22, 2010, 07:04:11 pm
I have found a minor ... quirk in the script.
I was just being stupid. =)
Me being stupid: ShowHide

Quoteif !$BlizzABS || BlizzABS::VERSION < 2.7
 raise 'ERROR: The "Blizz-ABS Controller" requires Blizz-ABS 2.7 or higher.'
elsif !defined?(RMXOS) || RMXOS::VERSION < 1.09
 raise 'ERROR: The "Blizz-ABS Controller" requires RMX-OS 1.09 or higher.'
end


First: Its elseif

it should be like so:
Quoteif !$BlizzABS || BlizzABS::VERSION < 2.7
 raise 'ERROR: The "Blizz-ABS Controller" requires Blizz-ABS 2.7 or higher.'
elseif !defined?(RMXOS) || RMXOS::VERSION < 1.09
 raise 'ERROR: The "Blizz-ABS Controller" requires RMX-OS 1.09 or higher.'
end
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Aqua on March 22, 2010, 07:06:22 pm
Um...
It's elsif...
o.o
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Feildmaster on March 22, 2010, 07:59:40 pm
it is? Well sorry for being wrong. O.o I've never seen it done that way. xd

Oh i didn't have my ruby head on when i read that... >.>
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: The Niche on January 01, 2011, 10:13:13 pm
*Necroecho*

I've looked at trying to make this Guillame compatible, and of course, I'm stumped. Could anyone point me in the right direction?
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Aqua on January 01, 2011, 10:50:20 pm
class Map_Actor
 
  def use_attack2
    self.battler.weapon_id, self.battler.armor1_id =
        self.battler.armor1_id, self.battler.weapon_id
    result = (self.battler.weapon_id != 0 && use_attack)
    self.battler.weapon_id, self.battler.armor1_id =
        self.battler.armor1_id, self.battler.weapon_id
    return result
  end
 
end

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor
 
  attr_accessor :weapon_id
  attr_accessor :armor1_id
 
end


Change all instances of armor1_id to the name of the variable holding the secondary weapon
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: The Niche on January 01, 2011, 10:55:19 pm
That was what I figured I should do, having looked at Blizz's answer to the last time this question was asked. But I can't figure out just what that variable is.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on January 02, 2011, 05:23:53 am
It might be "weapon_ids[1]". And the base weapon could be "weapon_ids[0]" instead of "weapon_id".
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: The Niche on January 02, 2011, 08:06:46 am
Thanks, I'll go ahead and try that.

Nope, not working.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: The Niche on January 06, 2011, 02:37:38 am
Gah...any ideas? Anyone? :???:

I noticed, for instance, that Guillame used the word slot, so I tried that instead of id, no joy.

More importantly, when I tried what you guys suggested, I get this:

undefined method '[]' for :weapon_ids:Symbol

The code, in case I misinterpreted or other such silly thing:

Spoiler: ShowHide
if !$BlizzABS || BlizzABS::VERSION < 2.1
  raise 'ERROR: The "Secondary Weapon" plugin requires Blizz-ABS 2.1 or higher.'
end

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# button for secondary weapon
SECONDARY_WEAPON_BUTTON = Input::Key['L']

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# BlizzABS::Controls
#==============================================================================

class BlizzABS::Controls
 
  alias update_attack_aqua_later update_attack
  def update_attack
    return true if update_attack_aqua_later
    if $game_system.attack_button && Input.trigger?(SECONDARY_WEAPON_BUTTON)
      $game_player.use_attack2
      return true
    end
    return false
  end
 
end

#==============================================================================
# Map_Actor
#==============================================================================

class Map_Actor
 
  def use_attack2
    self.battler.weapon_ids[1], self.battler.weapon_ids[1] =
        self.battler.weapon_ids[0], self.battler.weapon_ids[1]
    result = (self.battler.weapon_ids[0] != 0 && use_attack)
    self.battler.weapon_ids[1], self.battler.weapon_ids[0] =
        self.battler.weapon_ids[0], self.battler.weapon_ids[1]
    return result
  end
 
end

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor
 
  attr_accessor :weapon_ids[0]
  attr_accessor :weapon_ids[1]
 
end

Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: Blizzard on January 06, 2011, 04:00:41 am
It's not called weapon_ids but something else. Just look it up in Guillaume's script. Also, you don't need that last part of the script.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: The Niche on January 06, 2011, 07:58:18 am
Quote from: Blizzard on January 06, 2011, 04:00:41 am
It's not called weapon_ids but something else. Just look it up in Guillaume's script. Also, you don't need that last part of the script.


Dude what? Defile Blizzard's scriOh no, I already did that by changing it. I'll have another look at the script, but if I end up in an asylum and I start writing it out on the walls, I'm blaming you.
Title: Re: [XP] Secondary Weapon for Blizz-ABS
Post by: chaucer on March 11, 2011, 11:27:54 pm
is there anyway to set this so only 1 character could use this button O_o or 1 class lol. Im not good with scripting i dont know much about it but im tryin to learn. sorry any help?  :naughty: