[RGSS3] Specific Item Removal

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I know how to detect if any of the party members is wearing or equipping a certain armor or weapon, but I just want to ask how exactly would you unequip that weapon or armor specifically?

For example, Eric and Natalie is wearing a Bronze Cap. I want to detect if any of my members is wearing the bronze cap. Suddenly, Eric and Natalie does have the bronze cap, but I specifically want to remove Eric's cap only, leaving Natalie still equipping the bronze cap. Is this possible? if so, how?
 
Last edited by a moderator:

Susan

Veteran
Veteran
Joined
Sep 1, 2014
Messages
2,748
Reaction score
8,346
First Language
No idea...
Primarily Uses
RMMV
You can use the "Change Equipment" command to equip or remove equipment from specific actors.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
In Scene_Battle or Battle Processing?
 
Last edited by a moderator:

Susan

Veteran
Veteran
Joined
Sep 1, 2014
Messages
2,748
Reaction score
8,346
First Language
No idea...
Primarily Uses
RMMV
The "Change Equipment" command is located in the first tab of the "Event Commands" window.

It can be done from the map or in battle.

If you are looking for the actual script call for the "Change Equipment" command, it is located in lines 1244-1246 in "Game_Interpreter" :

    actor = $game_actors[@params[0]]

    actor.change_equip_by_id(@params[1], @params[2]) if actor

  end
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
So you mean i have to make an event that checks each actor of their equipment and put it inside a common event? That would be tiresome considering I have 45 characters....
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
If in battle, you'd either do it via troop events, or via a skill that runs a common event...


Do you need to check them all? Or only the battle members?


You could possibly set up a loop to go thru all of them.
 
Last edited by a moderator:

Susan

Veteran
Veteran
Joined
Sep 1, 2014
Messages
2,748
Reaction score
8,346
First Language
No idea...
Primarily Uses
RMMV
If you want specific actors to remove their equipment, you would have to make individual checks.

Considering that you have 45 characters and that you want to remove equipment from certain characters only, what are the conditions for keeping or removing equipment?

For example, a boss event or cutscene that requires certain characters to remove certain equipments. I'm sure that you don't intend to check every single character.
 

Balrogic

Veteran
Veteran
Joined
Dec 19, 2014
Messages
40
Reaction score
17
First Language
English
Primarily Uses
Anything events do can be replicated with scripts, it's just that people aren't used to bothering with making scripts for that kind of thing. Try going after the equips array in Game_Actor. Check out line 198, I'd start by trying to get that to work in a script call off $game_actors[id].force_change_equip(slot, item) (or whatever call would appropriately target it. I'm just starting testing.) then elaborate into a convention based method to automate all the tedious configuration.

Edit: Yeah, I'm having trouble with this. May take me a bit, I'm still pretty new. I haven't messed with Game_Actors and equips just yet.

Edit, again: Got it. The proper target is change_equip_by_id. Here's a simple mod of the event command in Game_Interpreter (duh, I should have realized from the start) that can unequip items by a script call. A little more adaptation and you could easily iterate over every actor and check for specific equipment.

Code:
module Unequip    #Works with Unequip::unequip(actor, slot, new_id)    def self.unequip(actor, slot, new_id)    actor = $game_actors[actor]    actor.change_equip_by_id(slot, new_id) if actor  end  end
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Anything events do can be replicated with scripts, it's just that people aren't used to bothering with making scripts for that kind of thing. Try going after the equips array in Game_Actor. Check out line 198, I'd start by trying to get that to work in a script call off $game_actors[id].force_change_equip(slot, item) then elaborate into a convention based method to automate all the tedious configuration.
Thanks. I'll look up to this. And yes, the reason I want to ask the SCRIPT is I want the script of this. Making events for a lot of things would be as tiresome when making those events.
 

Susan

Veteran
Veteran
Joined
Sep 1, 2014
Messages
2,748
Reaction score
8,346
First Language
No idea...
Primarily Uses
RMMV
Not to argue, but you did not specify that you wanted a script in your original post or any after until this final post.

You may have realized that I was mentioning event commands found in the RM editor and not scripts from the script editor from the beginning because I was not sure what it you wanted.

Yes, you did post in the scripting section, but a lot of people start threads in the wrong place many times.

Please mention that you needed a script in your original post from the beginning next time so that people like me won't end up wasting your time.

Glad someone managed to help you sort it out in the end. ^^
 

Balrogic

Veteran
Veteran
Joined
Dec 19, 2014
Messages
40
Reaction score
17
First Language
English
Primarily Uses
Well, this is kinda in the learn Ruby and RGSS3 section so I just assumed. I'm kinda embarassed because I jumped the gun and posted before I actually isolated a fully working mechanism to do what needs to be done. :unsure:

At least I managed to edit it in there.
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Not to argue, but you did not specify that you wanted a script in your original post or any after until this final post.

You may have realized that I was mentioning event commands found in the RM editor and not scripts from the script editor from the beginning because I was not sure what it you wanted.

Yes, you did post in the scripting section, but a lot of people start threads in the wrong place many times.

Please mention that you needed a script in your original post from the beginning next time so that people like me won't end up wasting your time.

Glad someone managed to help you sort it out in the end. ^^
I have been posting like this all the time though, that's the reason I added the tag [RGSS3] on it. I always put the right topics at the right corner :)
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I would go with Susan's suggestion. The script call doesn't seem to make it any easier than the "Change Equipment" command unless you're going to use loops and conditional checking over a collection of actor ID's.


It would be somewhat easier to just copy and paste the line and modify a few numbers.
 
Last edited by a moderator:

Balrogic

Veteran
Veteran
Joined
Dec 19, 2014
Messages
40
Reaction score
17
First Language
English
Primarily Uses
I would go with Susan's suggestion. The script call doesn't seem to make it any easier than the "Change Equipment" command unless you're going to use loops and conditional checking over a collection of actor ID's.

It would be somewhat easier to just copy and paste the line and modify a few numbers.
It wasn't meant to do all the work for her, I have my own project to work on and won't go out of my way to write someone a complete script unsolicited. It just demonstrates a working example of a script mechanism that can be utilized in a more specialized method. I'm in a mood to complain, so I'm going to outright state that I'm horrified at how the learn how to program in Ruby/RGSS sub-forum focuses on event condition based solutions to questions. If that's what people were after in here then they should be referred to the eventing tutorials in another section. I haven't even gotten an answer to a very basic Ruby question posted more than a week ago in a pinned thread that would sit on www.reddit.com/r/learnprogramming for less than 5 minutes before getting an answer and probably several additional opinions to help clarify and give an idea of consensus.

Milena tagged this for RGSS3, has asked questions about which RM class is a likely candidate for a workaround and even stated in the thread that it would be bothersome to have to set individual conditions for each actor. That's a really strong indicator that Milena intends to make a more complicated script and just hit a roadblock on the way. I don't want to assume someone doing all of that has no interest in learning how to make more advanced RM scripts. I'll probably have some question threads of my own at some point and I'd rather not waste my time writing them to get rebuffed with advice to just event it. That's why I'm complaining. If that's what we can expect here then I'll just ensure my problem can run in a default Ruby interpreter with non-RM code and ask /r/Ruby or something if I really can't solve the problem on my own with language documentation and extensive search of the RM scripts/RPG:: modules.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top