[CS GO] Make a prop copy an animation

Please post any questions about developing your plugin here. Please use the search function before posting!
Ehrmann
Junior Member
Posts: 10
Joined: Fri Apr 14, 2017 12:18 pm
Location: Moscow

[CS GO] Make a prop copy an animation

Postby Ehrmann » Mon Feb 05, 2018 9:52 am

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
Last edited by Ayuto on Mon Feb 05, 2018 6:56 pm, edited 1 time in total.
Reason: Changed code to python
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

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

Postby Ayuto » Mon Feb 05, 2018 6:56 pm

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.
Ehrmann
Junior Member
Posts: 10
Joined: Fri Apr 14, 2017 12:18 pm
Location: Moscow

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

Postby Ehrmann » Mon Feb 05, 2018 8:59 pm

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(
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

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

Postby Ayuto » Wed Feb 07, 2018 4:50 pm

I don't quite understand the reasoning. What exactly prevents you from creating bots on that special game server?
Ehrmann
Junior Member
Posts: 10
Joined: Fri Apr 14, 2017 12:18 pm
Location: Moscow

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

Postby Ehrmann » Wed Feb 07, 2018 10:15 pm

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).
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

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

Postby Ayuto » Wed Feb 07, 2018 10:22 pm

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.
Ehrmann
Junior Member
Posts: 10
Joined: Fri Apr 14, 2017 12:18 pm
Location: Moscow

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

Postby Ehrmann » Wed Feb 07, 2018 11:10 pm

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

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

Postby L'In20Cible » Thu Feb 08, 2018 3:01 am

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 37 guests