Help - Search - Members - Calendar
Full Version: (RGSS) [REQ] Equip when added
RPG RPG Revolution Forums > Scripting > Script Development and Support > Script Requests
Redd
So, I am in need of a script. Is it possible to make it so that when you use the "Add Equipment" command, it automatically equips it to the character and removes what they are currently wearing and puts that into oblivion somewhere? xD Like, they could only have the one thing equipped, so if you tried to change it you couldn't because you wouldn't have the right stuff. It would be nice if it removed EVERYTHING that the actor was wearing with a separate call script as well, because I have an accessory for one outfit and not for the other.
If anyone could do this for me, that'd be awesome happy.gif full credits will be given.
Night_Runner
Ummmm, I'm confused.

The 'Add Equipment' command, do you mean the evented command 'Change Equipment' (Page 1), which adds a weapon to the party, or the evented command 'Change Equipment' (Page 3) which forcefully equips armours?
And by putting the old equipment into oblivion, you mean the list of items that aren't equipped, or did you want to remove that equipment from the party (i.e. use the 'lose equipment' command)?

By 1 thing equipped, you mean 1 thing equipped in that slot, so only 1 type of shield, as opposed to only 1 type of equipment (shield, helmet, armour, accessory) could be equipped at a time?

I' suppose I'm trying to get an example of how to use this potential script, so I can get a better idea of how these features work.
Redd
QUOTE (Night_Runner @ Jun 20 2012, 07:14 AM) *
Ummmm, I'm confused.

The 'Add Equipment' command, do you mean the evented command 'Change Equipment' (Page 1), which adds a weapon to the party, or the evented command 'Change Equipment' (Page 3) which forcefully equips armours?
And by putting the old equipment into oblivion, you mean the list of items that aren't equipped, or did you want to remove that equipment from the party (i.e. use the 'lose equipment' command)?

By 1 thing equipped, you mean 1 thing equipped in that slot, so only 1 type of shield, as opposed to only 1 type of equipment (shield, helmet, armour, accessory) could be equipped at a time?

I' suppose I'm trying to get an example of how to use this potential script, so I can get a better idea of how these features work.


Ohhh I didn't realize that the Change Equipment was every there o.0 but yeah... Change Equipment haha. And I want to completely remove it from the party... but there isn't a lose equipment command, is there? And yes, that is what I mean by 1 thing equipped. 1 type of shield, 1 type of helmet... like it's locked in there and you can't take it off.
Night_Runner
1 script command to remove it from the party, coming up!

CODE
#==============================================================================
# ** XP: NR's Lose Equipment Script
#------------------------------------------------------------------------------
# History:
#  Date Created: 4/July/2012
#  Created for: Redd
#   @> http://www.rpgrevolution.com/forums/index.php?showtopic=56973
#
# Description:
#  Have a event run the scripted command:
#       $game_party.actors[123].lose_equip(0)
#  to have the 123rd member of the party enequip their weapon (
#     0 => Weapon
#     1 => Shield
#     2 => Head
#     3 => Body
#     4 => Accessory
#  ), and to have that weapon removed from the party.
#
#==============================================================================


#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  Edited to lose their equipment.
#==============================================================================

class Game_Actor
  #--------------------------------------------------------------------------
  # * Lose Equipment
  #     equip_type : type of equipment
  #--------------------------------------------------------------------------
  def lose_equip(equip_type)
    when 0 # Weapon
      # Backup the id
      last_weapon_id = @weapon_id
      # Unequip
      equip(equip_type, 0)
      # Remove from the party
      $game_party.lose_weapon(last_weapon_id, 1)
      return
    when 1, 2, 3, 4 # Shield, Head, Body, Accessory
      # Backup the id
      last_equipment_id = eval("@armor#{equip_type}_id")
      # Unequip
      equip(equip_type, 0)
      # Remove from the party
      $game_party.lose_armor(last_equipment_id, 1)
    else
      # If its invalid, raise an alert
      raise("#{equip_type} is not a valid equipment type ID")
    end
  end
end


#==============================================================================
# ** End of Script
#==============================================================================
Redd
Thanks biggrin.gif biggrin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.