Raised This Month: $51 Target: $400
 12% 

[SOLVED][AlienSwarm]Problem while trying to create entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Matt91111
Junior Member
Join Date: Jul 2016
Old 07-08-2016 , 05:11   [SOLVED][AlienSwarm]Problem while trying to create entity
Reply With Quote #1

Here's the command registration:
Code:
RegConsoleCmd("sm_spawn", Clnt_sm_spawn, "desc", 0);
My function looks like:
Code:
public Action Clnt_sm_spawn(int client, int args) {
    char arg1[32];//, arg2[32];
    
    GetCmdArg(1, arg1, sizeof(arg1));
    //GetCmdArg(2, arg2, sizeof(arg2));
    
    downloadClientVector(client); // save to (float playerPosition[3])
    
    int entindex = CreateEntityByName(arg1);

    SetEntPropVector(entindex, Prop_Send, "m_vecOrigin", playerPosition);
    
    DispatchSpawn(entindex);
    ActivateEntity(entindex);
}
Here's the list of ents: https://developer.valvesoftware.com/...Swarm_entities

Example use (from client console) :
sm_spawn asm_pickup_sentry

When i type some of non-existing ent's the SetEntPropVector throw me error about createing non-existing ent, but when i use correctly class name nothing happend. What am i doing wrong?

Last edited by Matt91111; 07-08-2016 at 15:50. Reason: Problem solved
Matt91111 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-08-2016 , 05:46   Re: [AlienSwarm]Problem while trying to create entity
Reply With Quote #2

I would say you need to DispatchSpawn before setting m_vecOrigin
__________________
Neuro Toxin is offline
Matt91111
Junior Member
Join Date: Jul 2016
Old 07-08-2016 , 06:02   Re: [AlienSwarm]Problem while trying to create entity
Reply With Quote #3

So i changed it to:
Code:
public Action Clnt_sm_spawn(int client, int args) {
    char arg1[32];//, arg2[32];
    
    GetCmdArg(1, arg1, sizeof(arg1));
    //GetCmdArg(2, arg2, sizeof(arg2));
    
    downloadClientVector(client);
    
    int entindex = CreateEntityByName(arg1);
    
    DispatchSpawn(entindex);
    
    SetEntPropVector(entindex, Prop_Send, "m_vecOrigin", playerPosition);
    ActivateEntity(entindex);
}
And still nothing happends.
Matt91111 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-08-2016 , 16:06   Re: [SOLVED][AlienSwarm]Problem while trying to create entity
Reply With Quote #4

I don't know a lot about Alien Swarm, but as I recall, the character on the screen is actually a separate entity from the client entity.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-08-2016 , 21:51   Re: [SOLVED][AlienSwarm]Problem while trying to create entity
Reply With Quote #5

Mind sharing how you solved your question for future readers?
__________________
Neuro Toxin is offline
psychonic

BAFFLED
Join Date: May 2008
Old 07-09-2016 , 07:23   Re: [SOLVED][AlienSwarm]Problem while trying to create entity
Reply With Quote #6

Quote:
Originally Posted by Powerlord View Post
I don't know a lot about Alien Swarm, but as I recall, the character on the screen is actually a separate entity from the client entity.
That's correct. The player/client is attached to the camera up above. The marine position is likely desired instead.

The helpers here probably still work, https://forums.alliedmods.net/showthread.php?p=1361373
psychonic is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode