Page 1 of 1
MoveType
Posted: Sun Jan 01, 2017 5:48 pm
by velocity
How to set the movetype of a player
like in sourcemod:
Syntax: Select all
SetEntityMoveType(client, MOVETYPE_WALK);
Re: MoveType
Posted: Sun Jan 01, 2017 7:45 pm
by Ayuto
Syntax: Select all
from players.entity import Player
from entities.constants import MoveType
player = Player(1)
player.move_type = MoveType.WALK
Available move types:
http://wiki.sourcepython.com/developing ... s.MoveType
Re: MoveType
Posted: Sun Jan 01, 2017 11:43 pm
by velocity
I dont see <Player>.move_type anywhere in the wiki?
Re: MoveType
Posted: Sun Jan 01, 2017 11:50 pm
by velocity
For example if I wanted to change player animation to WALK, how would I do that? WALK = _players._constants.PlayerAnimation.WALK
I know its PlayerAnimation.WALK, but how I connect the dots?
Re: MoveType
Posted: Mon Jan 02, 2017 3:19 am
by L'In20Cible
velocity wrote:I dont see <Player>.move_type anywhere in the wiki?
This attribute is generated dynamically via
the data files. Each entity has specific attributes depending of their inheritance hierarchy. Adding them on the wiki is difficult since they are known at run-time depending of the entity type you get an instance of. However, you can use the following to dump all the properties of the instance itself:
Syntax: Select all
for attribute in dir(player):
print(attribute)
Re: MoveType
Posted: Mon Jan 02, 2017 10:54 pm
by velocity
L'In20Cible wrote:velocity wrote:I dont see <Player>.move_type anywhere in the wiki?
This attribute is generated dynamically via
the data files. Each entity has specific attributes depending of their inheritance hierarchy. Adding them on the wiki is difficult since they are known at run-time depending of the entity type you get an instance of. However, you can use the following to dump all the properties of the instance itself:
Syntax: Select all
for attribute in dir(player):
print(attribute)
Alright thank you, but hey, I'm curious about what this do WALK = _players._constants.PlayerAnimation.WALK? My main issue was when teleporting a player every frame the walking animation isn't showing. The player is just frozen. Do you know how I can fix that and can it be somehow related to PlayerAnimation.WALK? I tried changing the move_type, but no luck there.
Re: MoveType
Posted: Tue Jan 03, 2017 12:35 am
by L'In20Cible
The PlayerAnimation enumerator are the possible values for the following property:
Syntax: Select all
player.set_property_int('m_nSequence', PlayerAnimation.WALK)
Re: MoveType
Posted: Sat Jan 07, 2017 7:10 am
by velocity
Its not working:
TypeError: Property "m_nSequence" is of type ushort not int
Re: MoveType
Posted: Sat Jan 07, 2017 7:18 am
by Ayuto
Then use set_property_ushort. However, I think there is more to do than just setting the property.
Re: MoveType
Posted: Sat Jan 07, 2017 7:27 am
by L'In20Cible
Ayuto wrote:However, I think there is more to do than just setting the property.
Being networked, setting that property alone is enough to tell clients to play the animation. But I do see where you are coming from. The movement engine is most likely going to reset its value on the next frame. Hooking Entity.post_think might suffice to ensure the value is correctly overridden. But since velocity will be playing the animation every frame, I don't think it really matters.
Re: MoveType
Posted: Sun Jan 08, 2017 7:55 am
by velocity
Yeah it's not working, how you suggest I do with hooking Entity.post_think?
Re: MoveType
Posted: Sun Jan 08, 2017 11:42 am
by L'In20Cible
Code? Game?