How to check the weapon iD?

Normally for this script I use switches, like so:

if $game_switches[346] == true
lantern = "002LanternB"
end
if $game_switches[346] == false
lantern = "002LanternA"
end

This works out well, usually, assuming I don't make a mistake like leaving off end or whatever.
(I do that a lot). Anyway, a game switch check isn't very helpful when you want to check to see which weapon is equipped.
Now then, there are only 3 weapon types, but I have no idea what type of lingo to use to check for them.
I've searched online but this may be ruby script. Well I need help with it, because it's not working.
Here is what I have so far:

if $game_party.members[1].equips[0].id == 1
wand = "001WandA"
end
if $game_party.members[1].equips[0].id == 2
wand = "001WandB"
end
if $game_party.members[1].equips[0].id == 3
wand = "001WandC"
end
if $game_party.members[1].equips[0].id == nil
wand = "blank"
end
If you're wondering about the 2nd line, the ' wand = "something" ' is displaying an image in a custom script.
It's a necessary part and works fine if I only have that line.

Please help me out if you can. Thanks!
If you want to check for a weapon id you would use:
Code:
$data_weapons[weapon_id]
If you want to check if a specific actor has a weapon you would use:
Code:
$game_party.members[actor_id].weapons.include?($data_weapons[weapon_id])

Edit: Almost forgot, if you need to also check if they have it in equipment do this:
Code:
$game_party.members[member_id].weapons.include?($data_weapons[weapon_id, include_equip?]

member_id would be the party member you're checking
weapon_id would be the weapon you are checking from the database
include_equip? would be for the code to also check if it's equipped as well. (true/false)

When checking the weapon id it must match the exact id in the database. Unlike the party member array, $data_weapons does not start at 0 but rather 1. 0 would be nil and would throw an error.
Thanks so much! That has fixed the problem. I also appreciate the mention of 0 being the nil value, as this was needed as well to
display a "blank" empty picture. Here's the repaired script thanks to your help. 🙂

if $game_party.members[0].weapons.include?($data_weapons[1])
wand = "001WandA"
end
if $game_party.members[0].weapons.include?($data_weapons[2])
wand = "001WandB"
end
if $game_party.members[0].weapons.include?($data_weapons[3])
wand = "001WandC"
end
if $game_party.members[0].weapons.include?($data_weapons[0])
wand = "blank"
end

I believe it might work the same if I removed the "if" and "end" statements, but it works so I'll just leave it in there.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-check-the-weapon-id.77014/