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
> Equip Weapons Fix
kroTcHmasTeR2000
post Jan 15 2013, 05:49 AM
Post #1


Level 2
Group Icon

Group: Member
Posts: 15
Type: None
RM Skill: Advanced




Essentially, I am attempting to alter the behavior of the game's standard equipment procedure. I want to be able to equip and/or remove a weapon from a certain character, but not have the inventory count change. However, I only want this effect to take place for certain equipment types (i.e. weapon and shield). Other equipment types I want to have the same decrease/increase of inventory count behavior.

Thus, I will equip - as a weapon - an offensive magic, and have the same spell available for other characters to equip. I will then equip - as a 'shield' - a defensive magic, and also have that spell available for other characters. Finally, I will equip an accessory, but the count will decrease from my inventory like normal.

I already made the first step towards the end result, and changed the behavior for ALL equipment types by inserting comments into the trade_item_with_party method, like so:

CODE
  def trade_item_with_party(new_item, old_item)
    return false if new_item && !$game_party.has_item?(new_item)
    #$game_party.gain_item(old_item, 1)
    #$game_party.lose_item(new_item, 1)
    return true
  end


Any suggestions on how to achieve the rest?


__________________________
"A well-written story is ALWAYS based on a really good bad guy."
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Feb 11 2013, 05:30 AM
Post #2


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




Okay, let's try this:

CODE
  def trade_item_with_party(new_item, old_item)
    return false if new_item && !$game_party.has_item?(new_item)
       #insert here an array: insert here the names of the equipments you want not to trade, separated by commas
        no_count_items = [
            "Large Shield",
            "Sword",
        ]
      if !no_count_items.include?(old_item.name)
         $game_party.gain_item(old_item, 1)
      end
      if !no_count_items.include?(new_item.name)
         $game_party.lose_item(new_item, 1)
      end
    return true
  end


Just replace "Large Shield", "Sword", with the names of the items you are willing to make "untradable", and you should be done wink.gif
e.g.

no_count_items = [
"Large Shield",
"Sword",
"Red Magic",
"White Barrier",
"Explosive Enigma",
]

I hope this can help,

Jens


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

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: 24th May 2013 - 12:45 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker