MoveType

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
velocity
Senior Member
Posts: 220
Joined: Sat May 10, 2014 6:17 pm

MoveType

Postby velocity » Sun Jan 01, 2017 5:48 pm

How to set the movetype of a player

like in sourcemod:

Syntax: Select all

SetEntityMoveType(client, MOVETYPE_WALK);
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: MoveType

Postby Ayuto » Sun Jan 01, 2017 7:45 pm

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
User avatar
velocity
Senior Member
Posts: 220
Joined: Sat May 10, 2014 6:17 pm

Re: MoveType

Postby velocity » Sun Jan 01, 2017 11:43 pm

Ayuto wrote:

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


I dont see <Player>.move_type anywhere in the wiki?
User avatar
velocity
Senior Member
Posts: 220
Joined: Sat May 10, 2014 6:17 pm

Re: MoveType

Postby velocity » Sun Jan 01, 2017 11:50 pm

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?
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: MoveType

Postby L'In20Cible » Mon Jan 02, 2017 3:19 am

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)
User avatar
velocity
Senior Member
Posts: 220
Joined: Sat May 10, 2014 6:17 pm

Re: MoveType

Postby velocity » Mon Jan 02, 2017 10:54 pm

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.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: MoveType

Postby L'In20Cible » Tue Jan 03, 2017 12:35 am

The PlayerAnimation enumerator are the possible values for the following property:

Syntax: Select all

player.set_property_int('m_nSequence', PlayerAnimation.WALK)
User avatar
velocity
Senior Member
Posts: 220
Joined: Sat May 10, 2014 6:17 pm

Re: MoveType

Postby velocity » Sat Jan 07, 2017 7:10 am

Its not working:

TypeError: Property "m_nSequence" is of type ushort not int
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: MoveType

Postby Ayuto » Sat Jan 07, 2017 7:18 am

Then use set_property_ushort. However, I think there is more to do than just setting the property.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: MoveType

Postby L'In20Cible » Sat Jan 07, 2017 7:27 am

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.
User avatar
velocity
Senior Member
Posts: 220
Joined: Sat May 10, 2014 6:17 pm

Re: MoveType

Postby velocity » Sun Jan 08, 2017 7:55 am

Yeah it's not working, how you suggest I do with hooking Entity.post_think?
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: MoveType

Postby L'In20Cible » Sun Jan 08, 2017 11:42 am

Code? Game?

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 28 guests