This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[CS:GO] Find target of trigger_teleport


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
infinite_
SourceMod Donor
Join Date: Mar 2015
Old 03-22-2015 , 19:58   [CS:GO] Find target of trigger_teleport
Reply With Quote #1

I'm trying to find the target entity of a trigger_teleport (the info_teleport_destination or info_target which players are teleported to). I searched around and found out the entity property for trigger_teleport targets is "m_target" so I set this up:

PHP Code:
public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    
HookEntityOutput("trigger_teleport""OnStartTouch"Output_TeleStartTouch);
}

public 
Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    
UnhookEntityOutput("trigger_teleport""OnStartTouch"Output_TeleStartTouch);
}

public 
Output_TeleStartTouch(const String:output[], calleractivatorFloat:delay)
{
    
decl String:teleTarget[32];
    
GetEntPropString(callerProp_Data"m_target"teleTargetsizeof(teleTarget));
    
    
PrintToChatAll("Teleport target: %s"teleTarget);

This gives me the error:

Code:
L 03/22/2015 - 19:55:47: [SM] Native "GetEntPropString" reported: Property "m_target" not found (entity 121/trigger_teleport)
L 03/22/2015 - 19:55:47: [SM] Displaying call stack trace for plugin "combatsurf.smx":
L 03/22/2015 - 19:55:47: [SM]   [0]  Line 106, C:\workspace-sourcemod\addons\sourcemod\scripting\combatsurf.sp::Output_TeleStartTouch()
I guess m_target isn't supported in GO. Has anyone worked with trigger_teleports in CS:GO and has a solution?
Thanks

Last edited by infinite_; 03-22-2015 at 22:36.
infinite_ is offline
infinite_
SourceMod Donor
Join Date: Mar 2015
Old 03-23-2015 , 01:47   Re: [CS:GO] Find target of trigger_teleport
Reply With Quote #2

So I found out that m_target is a DataMap property and edited my code.

PHP Code:
public Output_TeleStartTouch(const String:output[], calleractivatorFloat:delay)
{
    new 
offset FindDataMapOffs(caller"m_target");
    
PrintToChatAll("trigger_teleport offset: %d"offset);
    
// Printed 188
    
    
decl String:teleTarget[32];
    
GetEntDataString(calleroffsetteleTargetsizeof(teleTarget));
    
    
PrintToServer("Teleport target: %s"teleTarget);
    
// Printed K? where ? is a missing character
    
    
new target GetEntData(calleroffset);
    
    
PrintToServer("Teleport target: %d"target);
    
// Printed 175837672

The data should be a string but it never seems to return anything useful. I'm not sure what the integer data it returns represents. I also tried GetEntDataVector and GetEntDataEnt2 which returned nothing useful. Still looking for help.

From my DataMap dump:
Code:
CBaseTrigger - trigger_teleport
- m_iLandmark (Save|Key)(4 Bytes) - landmark
- m_bUseLandmarkAngles (Save|Key)(1 Bytes) - UseLandmarkAngles
...
- m_target (Save|Key)(4 Bytes) - target
EDIT: I am looking for the entity index of the teleport target entity.

Last edited by infinite_; 03-23-2015 at 03:53.
infinite_ is offline
m_bNightstalker
Senior Member
Join Date: Jan 2015
Location: JWD
Old 03-23-2015 , 11:25   Re: [CS:GO] Find target of trigger_teleport
Reply With Quote #3

PHP Code:
GetEntPropString(entityProp_Data"m_target"targetnamesizeof(targetname)); 
PHP Code:
    while ((destination_entity FindEntityByClassname(destination_entity"info_teleport_destination")) != -&& !found)
    {
        
GetEntPropString(destination_entityProp_Data"m_iName"destination_namesizeof(destination_name));
        
        if (
StrEqual(destination_nametargetname))
        {
            
found true;
        }
    } 
m_bNightstalker is offline
infinite_
SourceMod Donor
Join Date: Mar 2015
Old 03-23-2015 , 14:07   Re: [CS:GO] Find target of trigger_teleport
Reply With Quote #4

Quote:
Originally Posted by m_bNightstalker View Post
PHP Code:
GetEntPropString(entityProp_Data"m_target"targetnamesizeof(targetname)); 
PHP Code:
    while ((destination_entity FindEntityByClassname(destination_entity"info_teleport_destination")) != -&& !found)
    {
        
GetEntPropString(destination_entityProp_Data"m_iName"destination_namesizeof(destination_name));
        
        if (
StrEqual(destination_nametargetname))
        {
            
found true;
        }
    } 
As I mentioned in the first post, m_target is not recognized by GetEntPropString in CS:GO. It throws the error and I couldn't find it in my sm_dump_netprops. However it was in my sm_dump_datamaps, I just can't get any data I can recognize from the EntData functions.
infinite_ is offline
m_bNightstalker
Senior Member
Join Date: Jan 2015
Location: JWD
Old 03-23-2015 , 16:12   Re: [CS:GO] Find target of trigger_teleport
Reply With Quote #5

I'm wondering, so far I remember it was working on cs:go.
m_bNightstalker is offline
infinite_
SourceMod Donor
Join Date: Mar 2015
Old 03-23-2015 , 17:10   Re: [CS:GO] Find target of trigger_teleport
Reply With Quote #6

Quote:
Originally Posted by m_bNightstalker View Post
I'm wondering, so far I remember it was working on cs:go.
Tried it with both prop types Prop_Data and Prop_Send, both throw the error. I also found out FindEntityByClassname with info_teleport_destination always returns -1, even when I am certain the map has info_teleport_destinations in it. CS:GO is weird.
infinite_ is offline
Darkness_
Veteran Member
Join Date: Nov 2014
Old 03-23-2015 , 17:13   Re: [CS:GO] Find target of trigger_teleport
Reply With Quote #7

Try the script NightStalker posted with "m_iGlobalname"

Also, I think you can do GetEntPropString(triggerTeleport, Prop_Data, "m_iLandmark", teleTarget, sizeof(teleTarget)) to find the target

Last edited by Darkness_; 03-23-2015 at 17:16.
Darkness_ is offline
infinite_
SourceMod Donor
Join Date: Mar 2015
Old 03-23-2015 , 17:47   Re: [CS:GO] Find target of trigger_teleport
Reply With Quote #8

Quote:
Originally Posted by Darkness_ View Post
Try the script NightStalker posted with "m_iGlobalname"

Also, I think you can do GetEntPropString(triggerTeleport, Prop_Data, "m_iLandmark", teleTarget, sizeof(teleTarget)) to find the target
m_iLandmark returns empty strings for me, but at least it's recognized. I recently found out I don't even need the index of the teleport target for what I'm trying to accomplish, I only needed the value of m_bUseLandmarkAngles, oops.
infinite_ 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 14:28.


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