IceDragon200

[VXA][EDIT]Armor2Variable

Apr 8th, 2012
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.23 KB | None | 0 0
  1. =begin
  2. Armor Changes Variable v0.5
  3. by kirinelf
  4. Requested by: chigoo
  5.  
  6. Instructions:
  7. You can adjust the variable to change by modifying:
  8.  
  9. VARIABLE = 1
  10.  
  11. Change 1 to the new variable ID.
  12.  
  13. Copy and paste the following in the module:
  14.  
  15. ARMOR_TYPE_ID[n] = m
  16.  
  17. where n is the armor type ID and m is the value to change the variable to.
  18. For example, ARMOR_TYPE_ID[1] = 1 will make all General Armor change the variable
  19. to 1.  
  20.  
  21. =end
  22. module ARMOR_VARIABLE
  23.   VARIABLE = 1 # Variable to change.
  24.   ARMOR_TYPE_ID = {}
  25.   ARMOR_TYPE_ID[3] = 1 # ARMOR_TYPE_ID[Armor Type ID] = Value to set Variable to.
  26.   ARMOR_TYPE_ID[4] = 2
  27. #========================================================================
  28. # Do not edit anything under this line unless you know what you're doing!
  29. #========================================================================
  30. end
  31. class Game_Actor < Game_Battler
  32.   alias armor_change_equip change_equip
  33.   def change_equip(slot_id, item)
  34.     ans = armor_change_equip(slot_id, item)
  35.     update_equip_var if(slot_id == 3)
  36.     return ans # // For whatever reason
  37.   end    
  38.   def update_equip_var()
  39.     eq = equips[3]
  40.     $game_variables[ARMOR_VARIABLE::VARIABLE] = eq ? ARMOR_VARIABLE::ARMOR_TYPE_ID[eq.atype_id] : 0
  41.   end  
  42. end
Advertisement
Add Comment
Please, Sign In to add comment