DoomRL > Modding
How to check for a weapon's group?
(1/1)
SPTX:
I tried using
--- Code: ---if player.eq.weapon.group == "weapon-melee"
--- End code ---
But does the following error
--- Code: ---Unknown property "group" requested on object of type TItem!
--- End code ---
Why is that so? the property works when creating a new weapon, it's also there using the table logger from there, so it definitely exists. I am really confused.
yaflhdztioxo:
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.
SPTX:
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.
yaflhdztioxo:
The weapon will have an item ID.
items[ self.eq.weapon.id ].group
SPTX:
And and I was going to use variables... stupid me.
Navigation
[0] Message Index
Go to full version