I don't think it'd be necessary for items, since they won't be equipped 😛
Scratch that, I get what you mean @__@
Also, working on a way to get the items removed from their given slots, but I'd rather not have to check every single actor individually (as in, $game_actor[1], $game_actor[2], and so on). Is it possible to just check all of them at once?
Finally, do I have to do all of this for the "items_all" call as well? And how would that happen?
I have a vague idea but still not completely sure it'd work.
Sorry, I meant the "regain_items_all" parts of the script. And that answered my question o.o;;
Also, FYI, I have no idea what I'm doing XD
The closest to unequipping stuff I can find is: "$game_actors[x].change_equip_by_id(y, z)", but I don't know if that'll work inside this script at all.
it might work, better try it out... XD
Asfasjdknj;akngvjkadf
Keeps throwing an exception.
[IMG]http://i.xomf.com/fwynh.png[/IMG]
Current code:
def clear_items_all(save) $game_party.members_id.each do |act| $game_actors[act].change_equip_by_id(0, nil) $game_actors[act].change_equip_by_id(1, nil) $game_actors[act].change_equip_by_id(2, nil) $game_actors[act].change_equip_by_id(3, nil) $game_actors[act].change_equip_by_id(4, nil) end if save @items_old = @items @weapons_old = @weapons @armors_old = @armors end @items = {} @weapons = {} @armors = {} endAlso tried it with "@members_id.each" but it throws the same/similar thing. (I think...)
EDIT: Derp. "members_id" isn't a class or anything. Tried "$game_party.members.each" and got "cannot convert Game_Actor into Integer" error :\
Removing ".each" from "$game_party.members" and it ignores everything but still removes items.
So I'm guessing the problem is that the "$game_actors[ ]" arrays aren't taking kindly to having a variable stuck in them? Not sure how to fix that :\
So very close, dammit! ">.<;
uhm, you do it like this:
def clear_items_all(save) $game_party.members.each do |act| act.change_equip_by_id(0, nil) act.change_equip_by_id(1, nil) act.change_equip_by_id(2, nil) act.change_equip_by_id(3, nil) act.change_equip_by_id(4, nil) end if save @items_old = @items @weapons_old = @weapons @armors_old = @armors end @items = {} @weapons = {} @armors = {} endI believe I told you that act is the actor object itself... XDif you want to use it for $game_actors, you'd need to do it like $game_actors[act.id]
but then again, since act is already an actor object, you don't really need to do it...
PS: In advance, thanks so much for putting up with my ignorance in Ruby <3
Well I dunno. Like I've said, I'm not good at this stuff XD
TESTING: Get error after stepping onto "remove" instance: "no implicit conversion from nil to integer" ( in "Game_Interpreter line 1411", which probably doesn't help one bit ofc ). Maybe change "nil" to an empty weapon/armor slot would work? Have to look into how normal unequipping works @__@
EDIT #1: Sonuva-- It doesn't even work! Why is it throwing a bloody exception if it doesn't even frakkin' change/remove equipment?! ARGH!!1one! =__=
</end-rant>
EDIT #2: After a quick self-deliberation, I think it'd be best to dump the working bits of code out as well to show what is there at the moment. Perhaps something is missing? (obviously, but I mean beyond the fact that that part doesn't work) Maybe need to "get" or "set" 'act' from the Actors list? I dunno, because blank fields didn't do diddly-squat, although at least it didn't throw an error.
Gawd, how I just want a straight "remove all equipment" button @__@ Maybe this should be moved to RGSS 3 Script Requests, given how it's turned into one XD
class Game_Party#~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-## Defines call for vacating inventory ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-# def clear_items_all(save) $game_party.members.each do |act| act.change_equip_by_id(0, nil) act.change_equip_by_id(1, nil) act.change_equip_by_id(2, nil) act.change_equip_by_id(3, nil) act.change_equip_by_id(4, nil) 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_by_id(0, 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_by_id(1, nil) act.change_equip_by_id(2, nil) act.change_equip_by_id(3, nil) act.change_equip_by_id(4, nil) end if save @arms_old = @armors end @armors = {} end #~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~## Defines call for restoring all items previously taken ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~# def regain_items_all_lost @items = @items_old @weapons = @weapons_old @armors = @armors_old end#~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-## Defines recall for restoring ONLY items previously taken ##~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-# def regain_items_lost @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 @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_lost @weaps_old.each do |weap| #Repeating 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_lost @arms_old.each do |arm| #Repeating above @armors[arm[0]].nil? ? @armors[arm[0]] = arm[1] : @armors[arm[0]] += arm[1] end endendAs well, although I don't know how useful this is, I have the following scripts added into the test program:
Galv's Region EffectsKhas's Awesome Lighting Effects (KALE) << NOT CONFIGURED >>Basic Option Menu (by Vlue) Custom SaveFile Names (also by Vlue)The following Yanfly Engine Ace scripts:Core EngineParty ModEquip EngineSkill MenuStatus MenuEnemy LevelsBattle Engine-- Free Turn Battle-- Ele Pop-ups-- Enemy Target Info-- Enemy HP BarsThe only one I'd really would think might impact this at all would be the YEA Equip Engine, though with scripting who knows?
I can attach the current test program if need-be - not because I'm lazy but so you can see what's going on without having to make one as well <3 All settings are currently mirrored from my main game-in-progress.
use 0 I think... I believe that method uses the number you give to fetch an item from the $data_xxx arrays, so you need to give it an integer... so use 0 instead of nil
Moving this to script requests.
Uhm, what error are you having now? and did you try changing the nil to 0?
also better put this below all other scripts just in case...
Thanks, Celianna ~
OT: I tried '0' previously and it returned errors.
Forget what they were, but I think it had to do with the fact that there is no '#0' equipment XD
I'll try it again just in case.
Also, it is below everything else.
TESTING: And now it works... Kinda. @__@
1) It won't unequip / remove accessories. Though I'm sure it's just a matter of placing the right numbers under the "Remove Armor" clause.
2) If I visit the guard AFTER touching the "remove" event, then no more items show up after running over the "restore" event :<
Since I've got fraps I'll see if I can record an instance. Might help to show what's going on rather than just talk about it.
EDIT: Fraps is not recording video action. I don't know why. Looking into it :\
you would need to remove then based on the IDs used by Yanfly's equip engine
if you remove items (calling clear_items_all(true)) twice without restoring, then the no item inventory will be the one to get saved... so when you restore, you won't get anymore items
PS: this method for the actor does remove all equipment: clear_equipments and it uses nil for the item btw...
def clear_equipments equip_slots.size.times do |i| change_equip(i, nil) if equip_change_ok?(i) end endso I guess your error was because you were using the by change_equip_by_id method which takes the index and passes it to the $data_weapons array, so using nil there won't work... but using the change_equip method directly, you can pass nil to remove itemsso you could just do this for the clear all:
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 = {} endthen for the other ones, just use change_equip instead of change_equip_by_idchange_equip(slot_id,nil)
PS 2: YT videos don't load here in the office
Testing now.
PS: Well crap. It's already loading on YT and I don't want to stop it now, so... ehh :/
Maybe the problem will fix itself before the upload finishes? XD
POST-TEST: Weird...
The changes you suggested did work, btw XD
Upon normal test (talk to guard to get items, step on "purge" event, step on "restore" event) it returns everything.
However, when doing an abnormal test (step on "purge event before talking to guard), when I step onto the "restore" event it REPLACES the items I got from the guard with those that were already present - in this case, the items that the second actor has.
Ack. :stare:
See my edit to last post.
Each instance runs exactly once (with a kill-switch page after executing). Also, the guard is the one that gives the party leader her items; there are also items left over on the second actor (an artifact from the main game).
Basically, as far as I can tell, the "restore" event REPLACES any and all items currently in the inventory with those taken from the "purge" event, overriding the memory of any items, weapons, and such that the character might have picked up after the "purge" event was triggered. That's what seems to be happening anyhow :\
I can grasp the logic - it's the syntax (Ruby's language + RGSS 3) that isn't familiar to me XD
EDIT: Nevermind on the vid. It's taking too long to upload for what is essentially a 2-minute demo of what I just described, and when I checked the file it was like 150MB @_@ I'll see if I can show off a completed demo eventually that isn't nearly so big.