Zorothegallade

Untitled

Jun 3rd, 2023 (edited)
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. module MULTISLOT
  2. #####################################################################
  3. #For each item, put the ones it will morph into when put in the corresponding slots.
  4. #For instance, 1 => [1,1,2,3,4] means the armor number 1 will turn into the
  5. #weapon 1 in the weapon slot, armor 1 in the shield slot, armor 2 in the helmet
  6. #slot, armor 3 in the body slot, and armor 4 in the accessory slot.
  7. Item_Morph = { #do not delete
  8. 1=>[1,5,9,13,17],
  9. 2=>[2,6,10,14,18],
  10. 3=>[3,7,11,15,19],
  11. 4=>[4,8,12,16,20],
  12. } #do not delete
  13. end
  14.  
  15.  
  16. class Game_Actor < Game_Battler
  17.  
  18. def morph_item(item,slot_id)
  19. return nil unless item
  20. if slot_id == 0
  21. return $data_weapons[MULTISLOT::Item_Morph[item.id][slot_id]]
  22. elsif slot_id != nil
  23. return $data_armors[MULTISLOT::Item_Morph[item.id][slot_id]]
  24. end
  25. return item
  26. end
  27.  
  28. def unmorph_item(item)
  29. return nil unless item
  30. MULTISLOT::Item_Morph.each do |x|
  31. if item.is_a?(RPG::Weapon)
  32. return $data_armors[x[0]] if x[1][0] == item.id
  33. else
  34. y = x[1][1,x[1].size - 1]
  35. return $data_armors[x[0]] if y.include?(item.id)
  36. end
  37. end
  38. return item
  39. end
  40.  
  41. def trade_item_with_party(new_item, old_item)
  42. return false if new_item && !$game_party.has_item?(new_item)
  43. $game_party.gain_item(unmorph_item(old_item), 1)
  44. $game_party.lose_item(unmorph_item(new_item), 1)
  45. return true
  46. end
  47.  
  48. def change_equip(slot_id, item)
  49. return unless trade_item_with_party(item, equips[slot_id])
  50. #return if item && equip_slots[slot_id] != item.etype_id
  51. @equips[slot_id].object = morph_item(item, equip_slots[slot_id])
  52. refresh
  53. end
  54.  
  55.  
  56. end
  57.  
  58. class Window_EquipItem < Window_ItemList
  59. def include?(item)
  60. return true if item == nil
  61. return false unless item.is_a?(RPG::EquipItem)
  62. return false if @slot_id < 0
  63. return false unless MULTISLOT::Item_Morph[item.id] or item.etype_id == @actor.equip_slots[@slot_id]
  64. return @actor.equippable?(item)
  65. end
  66.  
  67.  
  68. def update_help
  69. super
  70. if @actor && @status_window
  71. temp_actor = Marshal.load(Marshal.dump(@actor))
  72. nu_item = morph_item(item,temp_actor.equip_slots[@slot_id])
  73. p nu_item
  74. temp_actor.force_change_equip(@slot_id, nu_item)
  75. @status_window.set_temp_actor(temp_actor)
  76. end
  77. end
  78.  
  79. def morph_item(item,slot_id)
  80. return nil unless item
  81. if slot_id == 0
  82. return $data_weapons[MULTISLOT::Item_Morph[item.id][slot_id]]
  83. elsif slot_id != nil
  84. return $data_armors[MULTISLOT::Item_Morph[item.id][slot_id]]
  85. end
  86. return item
  87. end
  88.  
  89. end
Add Comment
Please, Sign In to add comment