Caustic

Hopped Up on Goofballs
Member
Joined
Jan 6, 2014
Messages
182
Reaction score
39
First Language
Engrish
Primarily Uses
Well gee, thanks for changing it immediately after I posted XD 
And whaddya mean "why is it using @'x'_old?!" ? They all use the "@'x'_old" in their respected places =__= 
 

TESTING: And now it appears simply to not function. Ack

Take 1: Touching the "purge" event removes everything (including the extra set of armor for the 2nd actor), but after talking to the guard and running over the "restore" event, nothing happens.

Take 2: And after doing everything in the proper order (guard, "purge", "restore"), only the ITEMS show back up. The weapons & armors disappear, despite them all having the same process @__@

Also, I'm not seeing any variable mismatches. But w/e - here it is again.
 

Code:
class Game_Party#~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-## Defines call for vacating inventory    ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-#def clear_items_all(save)    $game_party.members.each do |act|      act.clear_equipments    end    if save      @items_old = @items      @weapons_old = @weapons      @armors_old = @armors    end    @items = {}    @weapons = {}    @armors = {}  end#~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~~## Defines call for vacating ONLY items ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-#  def clear_items(save)    if save      @items_old = @items    end    @items = {}  end  #~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-## Defines call for vacating ONLY weapons ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-#  def clear_weaps(save)    $game_party.members.each do |act|      act.change_equip(0, nil)	  act.change_equip(7, nil)    end    if save      @weaps_old = @weapons    end    @weapons = {}  end#~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~~~## Defines call for vacating ONLY armors ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~#  def clear_arms(save)    $game_party.members.each do |act|      act.change_equip(1, nil)      act.change_equip(2, nil)      act.change_equip(3, nil)      act.change_equip(4, nil)      act.change_equip(5, nil)      act.change_equip(6, nil)    end    if save      @arms_old = @armors    end    @armors = {}  end  #~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~## Defines call for restoring all items previously taken ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~#  def regain_items_all    regain_items    regain_weaps    regain_arms  end#~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-## Defines recall for restoring ONLY items previously taken ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-#  def regain_items    if @items_old.nil?      @items_old = {}      return    end    @items_old.each do |item|      #basically we iterate each of the old weapons      #then check if that weapon exists right now      #if yes, we add the amounts, else we set the amount      # ~Engr Shana      @items[item[0]].nil? ? @items[item[0]] = item[1] :       @items[item[0]] += item[1]    end  end  #~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-## Defines recall for restoring ONLY weapons previously taken ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-# def regain_weaps     if @weaps_old.nil?      @weaps_old = {}      return    end    @weaps_old.each do |weap|      #Repeat of above~      @weapons[weap[0]].nil? ? @weapons[weap[0]] = weap[1] :       @weapons[weap[0]] += weap[1]    end  end  #~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--~-~-~-~-~-~-~-~-## Defines recall for restoring ONLY armors previously taken ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--~-~-~-~-~-~-~-~-#  def regain_arms      if @arms_old.nil?      @arms_old = {}      return    end    @arms_old.each do |arm|      #Repeat of above~      @armors[arm[0]].nil? ? @armors[arm[0]] = arm[1] :       @armors[arm[0]] += arm[1]    end  endend
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
And whaddya mean "why is it using @'x'_old?!" ? They all use the "@'x'_old" in their respected places =__=
--> If you read the script you posted above, you'll see that the original method I have you, the clear_items_all, uses @weapons_old, while your new methods use @weaps_old... see the difference???

Take a look at this excerpt:

def clear_items_all(save) $game_party.members.each do |act| act.clear_equipments end if save @items_old = @items @weapons_old = @weapons @armors_old = @armors end @items = {} @weapons = {} @armors = {} end def clear_weaps(save) $game_party.members.each do |act| act.change_equip(0, nil) act.change_equip(7, nil) end if save @weaps_old = @weapons end @weapons = {} end def regain_weaps if @weaps_old.nil? @weaps_old = {} return end @weaps_old.each do |weap| #Repeat of above~ @weapons[weap[0]].nil? ? @weapons[weap[0]] = weap[1] : @weapons[weap[0]] += weap[1] end endSee? clear_items_all uses @weapons_old, while clear_weap and regain_weap uses @weaps_old... so now if you use clear_items_all, then use regain, you won't really have anything since they used different arrays... so you see, you DO HAVE a variable mismatch here...PS: what does the guard do?
 
Last edited by a moderator:

Caustic

Hopped Up on Goofballs
Member
Joined
Jan 6, 2014
Messages
182
Reaction score
39
First Language
Engrish
Primarily Uses
...

Well, ****.  :distrust:

TESTING: And that change did it.

Tested both ways (touch "purge" before and after talking to guard) and they both work. Wewt.

Feel silly for not noticing that little hiccup before.

Then again my eyes were hurting and maybe my brain was too tired to think straight. Figures.

And I swear I mentioned the guard's purpose before... he exists to dump basic equips and items onto the main actor ( second actor has her own armor, while main has nothing to start ). Sort of made sense at the time, but ended up being useful in testing whether the 2nd actor's equips ( and those of any additional party members as well, I would assume ) were returned or not.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
Maybe I forgot... hahahaha... my eyes hurt a bit right now... and oh well, it's nearly lunch, and I'm hungry... XD
 

Caustic

Hopped Up on Goofballs
Member
Joined
Jan 6, 2014
Messages
182
Reaction score
39
First Language
Engrish
Primarily Uses
Sorry for the late reply XD
 
Anyhow, many thanks for the assist and patience! Even if it's just a little part of the game this will help quite a bit :3
Can close this request now <3


FYI, here's the complete code, comments and all (because for once I'm being ridiculously neurotic about keeping notes and such @_@):

Code:
=beginSimple Remove/Restore Inventory Script v1.0~|| CREDITS TO:~ Engr. Shana: script coding & debugging guidance <33~ Caustic: original idea & testingThis script will allow you to, via script calls in events, vacate aplayer's inventory of either ALL items (items, weapons, and armors) orone (or several) of them at a time. As well, if you want, you can savethe equipment's variables and recall them via another Event script.Useful for events such as when the party is thrown in jail or when acharacter/the party is on a "death walk", so as having theiritems/weapons/ armors removed would make sense, but you can stillreturn them after the character/party escapes, returns to live, etc.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~LICENSE:Requested by Caustic, built by Engr. Shana of the RPGMakerWeb.comforums. Contact E.S. for permission before using in any project otherthan one made by Caustic (as it's basically theirs and I only stumbledthru testing it).Script is provided as-is. While the script can be modified, allrights in this license are retained (you still have to credit the originalauthors), and no further support will be given, so don't ask. <3~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~COMPATABILITY:~- Script is known to work in conjunction with Yanfly's Engine Ace scripts, specifically the Equip Engine script. Has not been tested on any other equipment-modifying engine or script besides that, so useat your own risk.~~ Script can be edited for use with Yanfly's Equip Engine (known), orpossibly other equipment modifications. If you wish to use with theregular equip engine or your own equipment variables, please edit theareas indicated under "Removes ONLY weapons" and "Removes ONLY armors"in the following format:act.change_equip(x, nil)where "x" is the equipment variable being used. These script calls areused to remove equipment from all actors currently in the party, andassist in making the scripts work properly. Without the proper entries,the script may not work properly.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[[ USE IN EVENTS ONLY!! ]]Using this in ANY comment box will not work.~~ To install:1) Copy this script in full, COMMENTS AND ALL!       Failure to copy script header comments will be seen as a    breech of the license. In short, please don't do it~2) Open the Script Editor (press F11 / Tools > Script Editor).3) Paste in a blank line under ▼ Materials, preferably below any   equipment-editing scripts (such as Yanfly's Equip Engine).4) Press 'OK'!_____________________________~~ To remove ('purge') inventory items: 1) Create a new Event or open an existing Event 2) Add a script with "$game_party.clear_'XX'('Y')", where 'XX' is the   desired items to remove/return:    - 'items_all' : Removes ALL inventory items    - 'items'     : Removes ONLY consumables/battle-only items    - 'weaps'     : Removes ONLY weapons    - 'arms'      : Removes ONLY armor pieces/accessories      and 'Y' is 'true' or 'false' (whether you wish to save the inventory   (true) or remove all items permanently (false)).3) Press 'OK'!_____________________________~~ To restore previously-removed items:(!)NOTE: It is ill-advised to use this operation if you have not         previously removed any equipment, and mishandling of         this operation may return unknown results!1) Create a new Event or open an existing Event 2) Add a script with "$game_party.regain_'XX'", where 'XX'   is the desired items to return:      - 'items_all' : Restores ALL inventory items, on top of those acquired    - 'items'     : Restores ONLY consumables/battle-only items    - 'weaps'     : Restores ONLY weapons    - 'arms'      : Restores ONLY armor pieces/accessories   3) Press 'OK'!_____________________________If the above directions are confusing, then please make sure youknow what Events, and the Script Command in general, are beforecontinuing. Otherwise you could cause problems. And we don't likeproblems, because they are... problematic. Yeah...=end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~## ACHTUNG!: Changes made past this point (other than those prescribed above) ## could cause harm to your game, your computer, or possibly your sanity.     ## Obviously we don't want that, so take care when editing! Thankies <3       ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#class Game_Party#~-~-~-~-~-~-~-~-~-~-~-~-~-~-~## Removes all inventory items ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~#def clear_items_all(save)    $game_party.members.each do |act|      act.clear_equipments    end    if save      @items_old = @items      @weaps_old = @weapons      @arms_old = @armors    end    @items = {}    @weapons = {}    @armors = {}  end#~-~-~-~-~-~-~-~-~-~~## Removes ONLY items ##~-~-~-~-~-~-~-~-~-~-#  def clear_items(save)    if save      @items_old = @items    end    @items = {}  end #~-~-~-~-~-~-~-~-~-~-~-## Removes ONLY weapons ##~-~-~-~-~-~-~-~-~-~-~-#  def clear_weaps(save)    $game_party.members.each do |act|      act.change_equip(0, nil)   # DO NOT CHANGE ABOVE THIS POINT!   # Add additional weapon slots here ~   # DO NOT CHANGE BELOW THIS POINT!    end    if save      @weaps_old = @weapons    end    @weapons = {}  end#~-~-~-~-~-~-~-~-~-~~~## Removes ONLY armors ##~-~-~-~-~-~-~-~-~-~-~#  def clear_arms(save)    $game_party.members.each do |act|      act.change_equip(1, nil)      act.change_equip(2, nil)      act.change_equip(3, nil)      act.change_equip(4, nil)   # DO NOT CHANGE ABOVE THIS POINT!   # Add additional equipment slots here ~   # DO NOT CHANGE BELOW THIS POINT!    end    if save      @arms_old = @armors    end    @armors = {}  end #~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~## Restores all items previously taken ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~#  def regain_items_all    regain_itemsregain_weapsregain_arms  end#~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-## Restores ONLY items previously taken ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-#  def regain_items    if @items_old.nil?      @items_old = {}      return    end    @items_old.each do |item|      # basically we iterate each of the old weapons      # then check if that weapon exists right now      # if yes, we add the amounts, else we set the amount   # ~Engr Shana      @items[item[0]].nil? ? @items[item[0]] = item[1] :   @items[item[0]] += item[1]    end  end #~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-## Restores ONLY weapons previously taken ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-#def regain_weaps    if @weaps_old.nil?      @weaps_old = {}      return    end@weaps_old.each do |weap|      #Repeat of above~      @weapons[weap[0]].nil? ? @weapons[weap[0]] = weap[1] :   @weapons[weap[0]] += weap[1]    end  end #~-~-~-~-~-~-~-~-~-~-~--~-~-~-~-~-~-~-~-## Restores ONLY armors previously taken ##~-~-~-~-~-~-~-~-~-~-~--~-~-~-~-~-~-~-~-#  def regain_arms     if @arms_old.nil?      @arms_old = {}      return    end    @arms_old.each do |arm|      #Repeat of above~      @armors[arm[0]].nil? ? @armors[arm[0]] = arm[1] :   @armors[arm[0]] += arm[1]    end  endend
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

just destroyed hours of work again. i don't know why I bother.
World Map for the inside of my main character's head. Every spot is an area that either occupies his thoughts or staples of everyone's "headspace"
How can I look up the components for a medieval bomb for my game without the FBI showing up at my door?
I don't think I can handle using the real SNES resolution of 512x448 because resizing absolutely every interface element I had on hand by painstaking trial & error/guess and check (is there any other way?) is KILLING me.

Forum statistics

Threads
108,992
Messages
1,041,105
Members
141,458
Latest member
EvieOverwrite
Top