Chaosforge Forum

DoomRL => Modding => Topic started by: SPTX on April 28, 2013, 06:38

Title: How to check for a weapon's group?
Post by: SPTX on April 28, 2013, 06:38
I tried using
Code: [Select]
if player.eq.weapon.group == "weapon-melee"But does the following error
Code: [Select]
Unknown property "group" requested on object of type TItem!
Why is that so? the property works when creating a new weapon, it's also there using the table logger from there (http://forum.chaosforge.org/index.php/topic,6233.msg54120.html#msg54120), so it definitely exists. I am really confused.
Title: Re: How to check for a weapon's group?
Post by: yaflhdztioxo on April 28, 2013, 07:39
That's on prototypes, not items themselves.  The way to access it is items[item_id].group

I don't know why it isn't be exposed as a read-only item property but it's not. I just mod here.
Title: Re: How to check for a weapon's group?
Post by: SPTX on April 28, 2013, 15:58
I don't understand what you mean by "items[item_id].group".
Not to mention that I need to compare my equipped item to a particular group. ie : if the player has a shotgun or a melee weapon equipped, function doesn't happen.
I really need to do it from the equipped weapon.
Title: Re: How to check for a weapon's group?
Post by: yaflhdztioxo on April 28, 2013, 16:42
The weapon will have an item ID.

items[ self.eq.weapon.id ].group
Title: Re: How to check for a weapon's group?
Post by: SPTX on April 29, 2013, 13:30
And and I was going to use variables... stupid me.