Raised This Month: $ Target: $400
 0% 

Getting Obsolete Entities' Properties


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cheddar
Member
Join Date: Sep 2015
Old 04-23-2016 , 02:59   Getting Obsolete Entities' Properties
Reply With Quote #1

I'm attempting to replace all info_player_terrorist entities with info_player_teamspawn. To use CS:S maps in TF2

I've already done this with info_player_start. However info_player_terrorist seems to be much more difficult because the tf2 CBaseEntity makes no mention of info_player_terrorist. Thus in hammer it shows as "obsolete" and thus fails the IsValidEntity() test.

I've tried the following:
PHP Code:
public Action find_terrorists1(clientargs)
{
    new 
ent = -1;
    while((
ent FindEntityByClassname(ent"info_player_terrorist")) != -1)
    {
        
PrintToChatAll("I found a terrorist");
    }
}
public 
Action find_terrorists2(clientargs)
{
    new 
String:buffer[512];
    new 
realMaxEntities GetMaxEntities() * 2
    for (new 
entity=0entity realMaxEntitiesentity++) 
    {
        if (!
IsValidEntity(entity)) 
        continue;
        
        
GetEntPropString(entityProp_Data"m_iClassname"buffersizeof(buffer));
        if(
StrEqual(buffer"info_player_terrorist"))
        
PrintToChatAll("I found a terrorist");
    }
}
public 
Action find_terrorists3(clientargs)
{
    new 
String:buffer[512];
    new 
realMaxEntities GetMaxEntities() * 2
    for (new 
entity=0entity realMaxEntitiesentity++) 
    {
        if (!
IsValidEntity(entity)) 
        continue;        
        
        
GetEntityClassname(entitybuffersizeof(buffer));
        if(
StrEqual(buffer"info_player_terrorist"))
        
PrintToChatAll("I found a terrorist");
    }

//note some of the methods are from here//

None of the above attempts work. If I disable the IsValidEntity(entity) test, the plugin throws invalid entity errors. If I enable the IsValidEntity(entity) test it doesn't throw errors, but it still doesn't find the info_player_terrorist. I know they're still in the map, I just don't know WHERE they are or how to retrieve their origins using SM.

Last edited by cheddar; 04-23-2016 at 03:00.
cheddar is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 04-23-2016 , 06:54   Re: Getting Obsolete Entities' Properties
Reply With Quote #2

Couldn't you do this with stripper;source?
__________________
Chdata is offline
cheddar
Member
Join Date: Sep 2015
Old 04-23-2016 , 14:44   Re: Getting Obsolete Entities' Properties
Reply With Quote #3

Yes! Stripper:Source does this flawlessly. However Stripper:Source will not work for my purposes for a few reasons.

1. Z Offset - I need to offset the origins of the info_player_terrorist on the "Z" axis. (Without this, players sometimes spawn in the ground because they're like 0.25 hammer units too "low")
2. Case Detection - I need to implement this as part of my plugin so I can manage WHEN or IF this process even takes place by scanning the map and detecting what's needed. (Case 0 -- Don't swap spans, Case 1 -- Swap spawns, Case 3 -- Swap only info_player_start with..... etc.)
cheddar is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 04-24-2016 , 13:17   Re: Getting Obsolete Entities' Properties
Reply With Quote #4

SDKHooks LevelInit forward provides the raw entity lump, but it's a massive string and you'll have a hard time working with it - probably slightly better now SM can load KV from a string.
__________________
asherkin is offline
cheddar
Member
Join Date: Sep 2015
Old 04-25-2016 , 17:51   Re: Getting Obsolete Entities' Properties
Reply With Quote #5

Quote:
Originally Posted by asherkin View Post
SDKHooks LevelInit forward provides the raw entity lump, but it's a massive string and you'll have a hard time working with it - probably slightly better now SM can load KV from a string.
Thank you! This sounds challenging but at least I know what direction to head in. I'll be working on this, and post what I learn here.
cheddar is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 04-26-2016 , 11:17   Re: Getting Obsolete Entities' Properties
Reply With Quote #6

edit stripper ;3
__________________
Chdata 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 01:57.


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