Page 1 of 1

[CS GO] Make a prop copy an animation

Posted: Mon Feb 05, 2018 9:52 am
by Ehrmann
Hello there! I'm trying to spawn an entity with player's model and make it copy player's animation. I tried to do this by using entity.set_parent but in this case the entity follows the player.
1) Is there way to copy parent animation without follow the parent?
2) How to give this entity a weapon (or model of weapon)?

Syntax: Select all

from players.entity import Player      
from entities.constants import EntityEffects
from engines.precache import Model
from commands.client import ClientCommand
def get_player_model_prop(player):
skin = Entity.create('prop_dynamic_override')
skin.model = player.model
skin.spawn_flags = 256
skin.set_property_uchar('m_CollisionGroup', 11)
skin.spawn()
skin.effects = EntityEffects.BONEMERGE | EntityEffects.NOSHADOW | EntityEffects.NORECEIVESHADOW | EntityEffects.PARENT_ANIMATES
skin.set_parent(player, -1)
skin.set_parent_attachment('primary')
return skin


@ClientCommand('create')
def _create(command, index, team_only=None):
player = Player(index)
my_model = get_player_model_prop(player)
my_model.origin = player.view_coordinates

Re: [CS GO] Make a prop copy an animation

Posted: Mon Feb 05, 2018 6:56 pm
by Ayuto
Are you perhaps looking for something like this?
viewtopic.php?f=20&t=1658&p=11167#p11167

This snippet is for recording/playing player movement/actions, but this could be adapted to create a bot that mimics the player's movement immediately.

Re: [CS GO] Make a prop copy an animation

Posted: Mon Feb 05, 2018 8:59 pm
by Ehrmann
Ayuto wrote:Are you perhaps looking for something like this?
viewtopic.php?f=20&t=1658&p=11167#p11167

This snippet is for recording/playing player movement/actions, but this could be adapted to create a bot that mimics the player's movement immediately.

Wow. Sounds amazing! Unfortunately, I can't create bots on my server because I'm renting special game server on a cs go game hosting platform(

Re: [CS GO] Make a prop copy an animation

Posted: Wed Feb 07, 2018 4:50 pm
by Ayuto
I don't quite understand the reasoning. What exactly prevents you from creating bots on that special game server?

Re: [CS GO] Make a prop copy an animation

Posted: Wed Feb 07, 2018 10:15 pm
by Ehrmann
I'm renting a gameserver but not whole server machine and I bougth a rate without an oppotunity of bot creation (becouse it's cheapest one. I'll change it later, when I'll finish with the most part of work and let players play).

Re: [CS GO] Make a prop copy an animation

Posted: Wed Feb 07, 2018 10:22 pm
by Ayuto
If you plan to change it later anyway, I would rather suggest you to install a local dedicated server. Then you can develop your plugin without any restrictions and don't need to invent a workaround for a temporary problem.

Re: [CS GO] Make a prop copy an animation

Posted: Wed Feb 07, 2018 11:10 pm
by Ehrmann
Thanks a lot. I take your advise. Could you help me with the second part of my question (about give an weapon skin to entity)? I'm developing Warcrfat mode, so I need both of animation and non-animation entity. I tried use skin_weapon.set_parent_attachment('weapon_hand_R') , but point of join primary weapon on a real player and on a model don't match. Look:
Image
Is it possible to combine it without using entity.teleport and trying to choose teleport coordinates manually?

Re: [CS GO] Make a prop copy an animation

Posted: Thu Feb 08, 2018 3:01 am
by L'In20Cible
Ehrmann wrote:Is it possible to combine it without using entity.teleport and trying to choose teleport coordinates manually?

That attachment is the "flashlight" origin. From a server-side plugin, you will need to move the weapon entity to the bone and parent it there because the rendered placement is handled client-side. Example that cover the teleport part of it on CS:S: viewtopic.php?f=20&t=1638&p=10930#p10920 Though you will have to find the GetBoneTransform's offset for CS:GO and the actual bone name might be different as well.