Detect whether a weapon is equipped <Solved>

RainbowGrenade

Paint Princess
Veteran
Joined
Jan 21, 2013
Messages
278
Reaction score
329
First Language
English
Primarily Uses
RMMV
So, I've got it set up when you die to restart you with a cleared inventory. The problem I've run into is that I'd like to trigger an event if you try and re-enter the dungeon before equipping a new one. I'm sure I'm just missing something, but I can't seem to find a way to check for what's equipped through switches or variables. Any suggestions would be appreciated.
 
Last edited by a moderator:

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
" The problem I've run into is that I'd like to trigger an event if you try and re-enter the dungeon before equipping a new one"

I might sound stupid, but it doesn't makes sense to me.

Can you tell us with a little more details what you mean?

[SIZE=14.4444446563721px]Edit:[/SIZE]

In any case I will do a guess:

Maybe you need a conditional Branch.

Page 2!

Select Actor (the player you wanna check)

Check if he/she  has an eqipped weapon.

;)
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
@Dreadshadow, when they die, they go back to the start and lose all their equipment/inventory. She wants to make sure they obtain and equip a weapon before going back into the dungeon.


You just want to know if they have a weapon equipped? Or if they have a particular weapon equipped?


All actors, or just one in particular?


Conditional Branch has an Actor [weapon] Equipped condition, but you have to state the actual weapon. That would be usable if you can only obtain one or two weapons before entering the dungeon. You'd then need to consider what happens if the player comes back to the same dungeon later in the game with weapons that are obtained after the initial trek through (you wouldn't want them to have to unequip a really good weapon and equip a basic one just to enter the dungeon).
 
Last edited by a moderator:

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
@Dreadshadow, when they die, they go back to the start and lose all their equipment/inventory. She wants to make sure they obtain and equip a weapon before going back into the dungeon.

You just want to know if they have a weapon equipped? Or if they have a particular weapon equipped?

All actors, or just one in particular?

Conditional Branch has an Actor [weapon] Equipped condition, but you have to state the actual weapon. That would be usable if you can only obtain one or two weapons before entering the dungeon. You'd then need to consider what happens if the player comes back to the same dungeon later in the game with weapons that are obtained after the initial trek through (you wouldn't want them to have to unequip a really good weapon and equip a basic one just to enter the dungeon).
Yeah figured that out and edited my reply too.

Technically you ninjaed me! :p
 

RainbowGrenade

Paint Princess
Veteran
Joined
Jan 21, 2013
Messages
278
Reaction score
329
First Language
English
Primarily Uses
RMMV
There will only be one playable character through the game, so it doesn't matter if it checks the party or just her. My problem has been what you stated, Shaz. I need to check to see if anything is equipped. There will be a bunch of weapons to check if I have to do it for every one individually. I suppose that is an option, though, if need be.
 
Last edited by a moderator:

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
There will only be one playable character through the game, so it doesn't matter if it checks the party or just her. My problem has been what you stated, Shaz. I need to check to see if anything is equipped. There will be a bunch of weapons to check if I have to do it for every one individually. I suppose that is an option, though, if need be.
You can make a weapon called bare hands, an armour called rags, and equip it on death on the player.

So you have to see if ALL these stuff are in the inventory instead (meaning the user removed them to hopefuly put on better).

Now t[SIZE=14.4444446563721px]he problem is, that the user can remove them without adding something.[/SIZE]

Now THAT is easier to be modified by a script I guess (switch equiopment instead of unequipping).

Any suggestions Shaz? :/

Variables and Conditional Branches can not check if a slot is empty I guess. :(
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
This (conditional branch - script command is at the bottom of the last tab) will be true if the actor has no weapon equipped:

Conditional Branch: Script: $game_party.leader.weapons.empty?Use it if you want to show a message saying they need to get some equipment first.This will be true if the actor does have a weapon equipped:

Conditional Branch: Script: !$game_party.leader.weapons.empty?Use it if you just want to do the transfer without worrying about a message.So something like this might be suitable:

Code:
Conditional Branch: Script: $game_party.leader.weapons.empty?  Show Text: You need to equip a weaponElse  Transfer Player ...Branch End
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
This (conditional branch - script command is at the bottom of the last tab) will be true if the actor has no weapon equipped:

Conditional Branch: Script: $game_party.leader.weapons.empty?Use it if you want to show a message saying they need to get some equipment first.This will be true if the actor does have a weapon equipped:

Conditional Branch: Script: !$game_party.leader.weapons.empty?Use it if you just want to do the transfer without worrying about a message.So something like this might be suitable:

Conditional Branch: Script: $game_party.leader.weapons.empty? Show Text: You need to equip a weaponElse Transfer Player ...Branch End

Would you mind tell us both, about all the slots? :)

I mean weapon slot is solved.

What is the appropeitae command for the rest?

 can we say for instance :  game_party.leader.armour.empty and be correct?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
There are 4 armor slots.


This gives you ALL armor currently equipped:

$game_party.leader.armorsso if you use ...armors.empty? and it returns true, that means they have NO armor equipped. If ...armors.empty? returns false it means they have at least one item of armor equipped.
actor.armors.size will tell you how many armor items are equipped, but not which slots.


Also, if your character has dual-wield enabled, actor.weapons could return an array with two items instead of one.


actor.equips gives you all the weapons AND armor currently equipped - the array is ordered the same way as the Starting Equipment panel in the Actor database tab.


If you want to know if a particular slot is filled, use this:

!$game_party.leader.equips[slot_id].nil?where slot_id is:
0 - weapon


1 - shield (or second weapon)


2 - head


3 - body


4 - accessory


This will return true if something is equipped in that slot, or false if it's empty.
 
Last edited by a moderator:

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
There are 4 armor slots.

This gives you ALL armor currently equipped:

$game_party.leader.armorsso if you use ...armors.empty? and it returns true, that means they have NO armor equipped. If ...armors.empty? returns false it means they have at least one item of armor equipped.actor.armors.size will tell you how many armor items are equipped, but not which slots.

Also, if your character has dual-wield enabled, actor.weapons could return an array with two items instead of one.

actor.equips gives you all the weapons AND armor currently equipped - the array is ordered the same way as the Starting Equipment panel in the Actor database tab.

If you want to know if a particular slot is filled, use this:

!$game_party.leader.equips[slot_id].nil?where slot_id is:0 - weapon

1 - shield (or second weapon)

2 - head

3 - body

4 - accessory

This will return true if something is equipped in that slot, or false if it's empty.
THANK YOU SO MUCH!!!!

So I can assign it to a Switch variable and do stuff that way. Correct? 

Or better yet put a Script into conditional branch instantly (no need for switch what was I thinking?)

Thank you Shaz! I really appreciate it!
 

RainbowGrenade

Paint Princess
Veteran
Joined
Jan 21, 2013
Messages
278
Reaction score
329
First Language
English
Primarily Uses
RMMV
Shaz, you are truly awesome. I've got it working just how I wanted it to. Thank you so much! :D
 

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

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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

Forum statistics

Threads
105,868
Messages
1,017,072
Members
137,578
Latest member
JamesLightning
Top