Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Add Common Event to Weapon/Armor
lauruns
post Sep 24 2012, 08:02 AM
Post #1


Level 1
Group Icon

Group: Member
Posts: 5
Type: Writer
RM Skill: Undisclosed




I have a question about Weapon and Armor. Is there a way to activate a Common Event when the player equips or uses weapons or armor?
'Cause I want the game to know or the player is wearing light or heavy armor, and I want a Bow & Arrow system in which the player loses 1 arrow when he attacks.

Thank you
Go to the top of the page
 
+Quote Post
   
Shaddow
post Sep 24 2012, 09:58 AM
Post #2


The Eventer Inventor
Group Icon

Group: Local Mod
Posts: 1,250
Type: Event Designer
RM Skill: Masterful
Rev Points: 90




I am taking a look into this for you, it's a rather tricky problem, as there is not way that I've found to check when the player uses the 'attack' command vs anything else in battle with events. This may require scripting, but I will still look into a solution for you, until someone presents a script solution.

As far as the armor check goes, you can do that, but you will need to make a conditional branch for each potential armor the character can wear. On page two you can set that check. There is no way to set it on the armor itself. I'll keep looking for a cleaner and simpler solution, but this is probably another one where a script would be the simplest solution. You may go to script requests and post your request there as well.


__________________________




I support these projects! -------------





Go to the top of the page
 
+Quote Post
   
diamondandplatin...
post Sep 24 2012, 11:06 AM
Post #3


Level 5
Group Icon

Group: Member
Posts: 72
Type: Writer
RM Skill: Skilled
Rev Points: 45




code
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#             Run Common Event When Equipping an Item
#             Version: 1.0
#             Author: DiamondandPlatinum3
#             Date: September 25, 2012
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Description:
#
#    This script allows you to run a common event when you equip an item, be
#    it a weapon or a piece of armour.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#------------------------------------------------------------------------------
#  Instructions:
#    
#     ~  In your weapon and armour noteboxes, insert this line of code
#
#           ~E_COMMONEVENT_ID: ?
#
#        Replacing the ? with a number to represent which common event you
#        want to run when that specific item is equipped.
#
#
#     ~  You do not have to place this code on every weapon and armour you
#        have, just the ones you wish to use a common event on.
#
#
#     ~  There is a visual example that can be found
#        Here: http://img4host.net/upload/242103145060ae72be40a.png
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
#
#                  THERE IS NO EDITABLE REGION TO THIS SCRIPT
#
#==============================================================================












class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Change Equipment (designate object)
  #     equip_type : Equip region (0..4)
  #     item       : Weapon or armor (nil is used to unequip)
  #     test       : Test flag (for battle test or temporary equipment)
  #--------------------------------------------------------------------------
  alias dp3_equipcommonevent_9jsg4 change_equip
  def change_equip(equip_type, item, test = false)
  
    # Call Original Method
    dp3_equipcommonevent_9jsg4(equip_type, item, test)
    
    
    # Proceed
    item_id = item == nil ? 0 : item.id
    note = nil
    
    if item_id > 0
      if equip_type == 0
        note = $data_weapons[item_id].note
      elsif equip_type > 0
        note = $data_armors[item_id].note
      end
      
      note[/~E_COMMONEVENT_ID: ([-0-9]+)/]
      $game_temp.common_event_id = $1.to_i if $1
    end # If Statement
    
  end # Function
end # Class


That should do it smile.gif


__________________________
Go to the top of the page
 
+Quote Post
   
Shaddow
post Sep 24 2012, 11:24 AM
Post #4


The Eventer Inventor
Group Icon

Group: Local Mod
Posts: 1,250
Type: Event Designer
RM Skill: Masterful
Rev Points: 90




QUOTE (diamondandplatinum3 @ Sep 24 2012, 02:06 PM) *
code
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#             Run Common Event When Equipping an Item
#             Version: 1.0
#             Author: DiamondandPlatinum3
#             Date: September 25, 2012
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Description:
#
#    This script allows you to run a common event when you equip an item, be
#    it a weapon or a piece of armour.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#------------------------------------------------------------------------------
#  Instructions:
#    
#     ~  In your weapon and armour noteboxes, insert this line of code
#
#           ~E_COMMONEVENT_ID: ?
#
#        Replacing the ? with a number to represent which common event you
#        want to run when that specific item is equipped.
#
#
#     ~  You do not have to place this code on every weapon and armour you
#        have, just the ones you wish to use a common event on.
#
#
#     ~  There is a visual example that can be found
#        Here: http://img4host.net/upload/242103145060ae72be40a.png
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
#
#                  THERE IS NO EDITABLE REGION TO THIS SCRIPT
#
#==============================================================================












class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Change Equipment (designate object)
  #     equip_type : Equip region (0..4)
  #     item       : Weapon or armor (nil is used to unequip)
  #     test       : Test flag (for battle test or temporary equipment)
  #--------------------------------------------------------------------------
  alias dp3_equipcommonevent_9jsg4 change_equip
  def change_equip(equip_type, item, test = false)
  
    # Call Original Method
    dp3_equipcommonevent_9jsg4(equip_type, item, test)
    
    
    # Proceed
    item_id = item == nil ? 0 : item.id
    note = nil
    
    if item_id > 0
      if equip_type == 0
        note = $data_weapons[item_id].note
      elsif equip_type > 0
        note = $data_armors[item_id].note
      end
      
      note[/~E_COMMONEVENT_ID: ([-0-9]+)/]
      $game_temp.common_event_id = $1.to_i if $1
    end # If Statement
    
  end # Function
end # Class


That should do it smile.gif


Haha, I knew that a scripter could do this in no time!


__________________________




I support these projects! -------------





Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 20th May 2013 - 11:29 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker