Shenti 1 Posted January 28, 2013 Okay, first of all, this is SUPER embarrassing being back here so soon--I apologize sincerely. I recently asked a very similar question to which I was met with a hasty response that was precisely what I was looking for. Thank you DP3! It was a script that could be used in a conditional branch that checked if an actor had nothing equipped. Works great!However, I had forgotten that I also need a check for when it's JUST a weapon that isn't equipped, and unfortunately the script does not account for that. I am not being ungrateful, mind; on the contrary, in fact, for I am quite thankful, but I still need some form of a weapon check.Since most of my questions on this site have been script-related (as in they almost always require a script of some form) I decided that it would only be fair if I finally make some attempt to learn how to script for myself. I won't lie, I didn't learn much, as it's all quite new and foreign to me, but I did learn enough to not be freaked out when looking at the text.I found, by looking at the game code, that the weapon slot is 0 (even in case of dual wield), so I imagine I would simply need some sort of check to see if slot 0 is occupied or not.This is the wonderful script DP3 made for me: # Use the Following in a Conditional Branch Script Call # check_if_nothing_equipped( actor_id ) # Replacing Actor_ID with the actor you want to use this check on. # Actor 1 would be Eric and Actor 2 would be Natalie, etc. class Game_Interpreter def check_if_nothing_equipped( actor_id ) return false unless actor_id.is_a?(Integer) actor = $game_actors[actor_id] return false unless actor has_equipped = false for i in 0..(actor.equip_slots.size - 1) has_equipped = true if actor.equips end return !has_equipped end end This checks to see if the actor has nothing equipped, and despite my best efforts I was unable to really figure out how to edit it to my needs without breaking it. Is there a way to alter it into checking ONLY if the weapon slot(s) "0" are occupied or not (for different actors, of course)?Again, I am SOOOO sorry for these silly questions, but I am almost positive this will be the last one for a while! In my current project, the equipment thing was the last big hurdle. I've accomplished every other task so far and plan to continue doing it, but seeing as I use separate variables for actor's equipment for a custom battle system, I needed a couple of scripts to help make the process simpler. Both Tsukihime and DP3 were there for that, and I cannot thank them enough.Now, if I can get a weapon check conditional branch or something, I think I'll be okay! For real, this time.Any assistance is appreciated and once more I assure you that I will [most likely] not need to ask any more dumb questions here for a while. Thank you! Share this post Link to post Share on other sites
Galv 1,386 Posted January 28, 2013 Are you doing this in an event? You could use the conditional branch: Actor > Weapon is equipped and make sure "set handling when conditions do not apply" is ticked and put what you want to do in that part. Share this post Link to post Share on other sites
Shenti 1 Posted January 28, 2013 Are you doing this in an event?You could use the conditional branch: Actor > Weapon is equipped and make sure "set handling when conditions do not apply" is ticked and put what you want to do in that part. Yes, well, I'm doing all of this in common events. I'm afraid that won't work because unfortunately you cannot simply set it to "if weapon equipped," it has to be a specific weapon. While it is quite possible using this method, it's not logical, because for each weapon I would have to make a conditional branch for all four party members--and seeing as I do intend tech for four more members, this would be an insane amount of work, heh. But yes, if the conditional branch simply had the ability to check if nothing is equipped at all, I would not have this problem. Share this post Link to post Share on other sites
Galv 1,386 Posted January 28, 2013 Ahh sorry, I read that wrong. In a conditional branch you could use a script condition: (1 being the actor id in this example) $game_actors[1].equips[0].nil? This will check "If actor 1 doesn't have a weapon equipped" Share this post Link to post Share on other sites
Shenti 1 Posted January 28, 2013 Ahh sorry, I read that wrong. In a conditional branch you could use a script condition: (1 being the actor id in this example) $game_actors[1].equips[0].nil? This will check "If actor 1 doesn't have a weapon equipped" PERFECT! Thank you! Share this post Link to post Share on other sites
DP3 188 Posted January 28, 2013 (edited) # Use the Following in a Conditional Branch Script Call # check_if_nothing_equipped( actor_id ) # check_if_no_weapon_equipped( actor_id ) # Replacing Actor_ID with the actor you want to use this check on. # Actor 1 would be Eric and Actor 2 would be Natalie, etc. class Game_Interpreter def check_if_nothing_equipped( actor_id ) return false unless actor_id.is_a?(Integer) actor = $game_actors[actor_id] return false unless actor has_equipped = false for i in 0..(actor.equip_slots.size - 1) has_equipped = true if actor.equips[i] end return !has_equipped end def check_if_no_weapon_equipped( actor_id ) return false unless actor_id.is_a?(Integer) return false if $game_actors[actor_id].equips[0] return false if $game_actors[actor_id].equips[1] && $game_actors[actor_id].equips[1].is_a?(RPG::Weapon) return true end end Can do the same now. Checks Both Weapon Slots, in case you might be dual wielding. Edited January 28, 2013 by DP3 Share this post Link to post Share on other sites
Shenti 1 Posted January 28, 2013 # Use the Following in a Conditional Branch Script Call # check_if_nothing_equipped( actor_id ) # check_if_no_weapon_equipped( actor_id ) # Replacing Actor_ID with the actor you want to use this check on. # Actor 1 would be Eric and Actor 2 would be Natalie, etc. class Game_Interpreter def check_if_nothing_equipped( actor_id ) return false unless actor_id.is_a?(Integer) actor = $game_actors[actor_id] return false unless actor has_equipped = false for i in 0..(actor.equip_slots.size - 1) has_equipped = true if actor.equips[i] end return !has_equipped end def check_if_no_weapon_equipped( actor_id ) return false unless actor_id.is_a?(Integer) return false if $game_actors[actor_id].equips[0] return false if $game_actors[actor_id].equips[1] && $game_actors[actor_id].equips[1].is_a?(RPG::Weapon) return true end end Can do the same now. Checks Both Weapon Slots, in case you might be dual wielding. AWESOME! Big, big thanks to you as well! Thank you so much for your time and assistance, you guys! Always so helpful! Share this post Link to post Share on other sites