Property 'm_Effects' not found for entity type 'player'

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

Property 'm_Effects' not found for entity type 'player'

Postby Mahi » Sun May 24, 2015 4:36 pm

Title says it all:

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
File '../addons/source-python/packages/source-python/events/listener.py', line 93, in fire_game_event
callback(game_event)
File '../addons/source-python/plugins/hw/hw.py', line 221, in player_spawn
hero.execute_skills('player_spawn', player=player)
File '../addons/source-python/plugins/hw/entities.py', line 284, in execute_skills
passive.execute_method(method_name, **eargs)
File '../addons/source-python/plugins/hw/entities.py', line 355, in execute_method
method(self, **eargs)
File '../addons/source-python/plugins/hw/heroes/default.py', line 45, in player_spawn
effects = player.get_property_int('m_Effects')
File '../addons/source-python/packages/source-python/entities/entity.py', line 360, in get_property_int
return self._get_property(name, 'int')
File '../addons/source-python/packages/source-python/entities/entity.py', line 419, in _get_property
name, self.classname))

ValueError: Property 'm_Effects' not found for entity type 'player'

When trying to use this code:

Syntax: Select all

# Invisible
effects = player.get_property_int('m_Effects')
if not effects & EntityEffects.NODRAW:
player.set_property_int('m_Effects', effects | EntityEffects.eff)
else:
player.set_property_int('m_Effects', effects & ~EntityEffects.NODRAW)
User avatar
satoon101
Project Leader
Posts: 2698
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun May 24, 2015 4:45 pm

Image
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

Postby Mahi » Sun May 24, 2015 4:47 pm

Ah, thanks :) I should've checked the closed issues, it's fixed but not yet in the latest release :P

Edit: Nope, it is already updated in my SP files but the error stays.
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Sun May 24, 2015 6:10 pm

Do you perhaps mean "m_fEffects"? Though, that is accessible through <Entity object>.effects.
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

Postby Mahi » Sun May 24, 2015 7:11 pm

Ayuto wrote:Do you perhaps mean "m_fEffects"? Though, that is accessible through <Entity object>.effects.

Well. Dammit. Google even gave me results on "m_Effects" :D Thanks Ayuto, works fine now :)
User avatar
L'In20Cible
Project Leader
Posts: 1534
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sun May 24, 2015 7:29 pm

Why are you using google? You can do for cls in player.server_classes: for name in cls.properties: print(name) sane thing for keyvalues, inputs, etc. Sorry for the raw text, I'm on my phone.
User avatar
L'In20Cible
Project Leader
Posts: 1534
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sun May 24, 2015 7:31 pm

Also, as a side note, m_fEffects value are wrapped into entities.constants.EntityEffects (they are bit fields).

EDIT: Forget this post, I think I'm blind. :D
User avatar
satoon101
Project Leader
Posts: 2698
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Mon May 25, 2015 1:04 pm

L'In20Cible wrote:Why are you using google? You can do for cls in player.server_classes: for name in cls.properties: print(name) sane thing for keyvalues, inputs, etc. Sorry for the raw text, I'm on my phone.

That code is already implemented in Entity.properties, same with keyvalues and inputs:

Syntax: Select all

print('Player Properties:')
for name in player.properties:
print('\t{0}'.format(name))

print('Player KeyValues')
for name in player.keyvalues:
print('\t{0}'.format(name))

print('Player Inputs:')
for name in player.inputs:
print('\t{0}'.format(name))


You can do that with any entity.
Image
User avatar
L'In20Cible
Project Leader
Posts: 1534
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Tue May 26, 2015 2:03 am

Oh, didn't realize those were wrapped, I got used to loop through all classes ^^

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 19 guests