Raised This Month: $ Target: $400
 0% 

Move_Rope help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bobbls
Junior Member
Join Date: Apr 2016
Old 04-14-2016 , 18:56   Move_Rope help
Reply With Quote #1

I'm attempting to get the next keyframe in a rope entity (aka the location of the keyframe_rope) but i'm not entirely sure how to go about it. I can't simply get the location of keyframe_rope as there is often more than one rope in a map. Sadly I have no choice but to use rope entities, as i'm attempting to emulate the behavior of a closed source plugin.

I thought I could just read the entity properties but there doesn't seem to be any available. The netprop dumps don't seem to log anything and I can't find any posts about it here on alliedmods. I'm rather lost on how to proceed. I thought about hooking the creation of the move_rope but i'm not entirely sure where to go from there either.

EDIT: This is in TF2, if it matters.

Last edited by Bobbls; 04-14-2016 at 18:56.
Bobbls is offline
d1rTyS
Junior Member
Join Date: Dec 2015
Old 04-14-2016 , 23:05   Re: Move_Rope help
Reply With Quote #2

Maybe you'll find what you are looking for if you dump all datamaps.

Sorry that i can't help you in detail but maybe these are of any interest for you
Code:
- m_iNextLinkName (Save|Key)(4 Bytes) - NextKey
- m_hStartPoint (Save)(4 Bytes)
- m_hEndPoint (Save)(4 Bytes)
- m_iStartAttachment (Save)(2 Bytes)
- m_iEndAttachment (Save)(2 Bytes)
d1rTyS is offline
Bobbls
Junior Member
Join Date: Apr 2016
Old 04-15-2016 , 18:28   Re: Move_Rope help
Reply With Quote #3

Quote:
Originally Posted by d1rTyS View Post
Maybe you'll find what you are looking for if you dump all datamaps.

Sorry that i can't help you in detail but maybe these are of any interest for you
Code:
- m_iNextLinkName (Save|Key)(4 Bytes) - NextKey
- m_hStartPoint (Save)(4 Bytes)
- m_hEndPoint (Save)(4 Bytes)
- m_iStartAttachment (Save)(2 Bytes)
- m_iEndAttachment (Save)(2 Bytes)
It seems neither handles for start or end point actually return a valid reference, I always seem to get -1 using GetEntPropEnt

After looking at the source sdk for the move_rope stuff, it looks like they use these handles to get the start and end point (https://github.com/ValveSoftware/sou.../rope.cpp#L296)

Perhaps it's an issue with my code?
I've tried both
Code:
index = GetEntPropEnt(entity, Prop_Send, "m_hEndPoint")
and
Code:
EntRefToEntIndex(index);
though i've never dabbled in this end of sourcemod. I also tried using Prop_Data with the same results, it seems to always return -1.

Last edited by Bobbls; 04-15-2016 at 18:31.
Bobbls is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 04-15-2016 , 18:39   Re: Move_Rope help
Reply With Quote #4

Have you tried prop_data?
__________________
Neuro Toxin is offline
Bobbls
Junior Member
Join Date: Apr 2016
Old 04-15-2016 , 18:43   Re: Move_Rope help
Reply With Quote #5

Quote:
Originally Posted by Neuro Toxin View Post
Have you tried prop_data?
Said that at the end of my last post, but yeah I had tried prop_data with no change in results.
Bobbls is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 04-15-2016 , 19:15   Re: Move_Rope help
Reply With Quote #6

What about the other netprops.

Surely next link name contains an entity name.

Have you also tried the two attachment ones?
__________________
Neuro Toxin is offline
Bobbls
Junior Member
Join Date: Apr 2016
Old 04-15-2016 , 19:44   Re: Move_Rope help
Reply With Quote #7

Quote:
Originally Posted by Neuro Toxin View Post
What about the other netprops.

Surely next link name contains an entity name.

Have you also tried the two attachment ones?
The next link name should return a string for m_iName, but the issue then becomes finding the names of every single keyframe_rope and some how re-associating them with move_rope, which seems impractical.
The two attachments looked like the same issue as before, returning 0 or -1.
Bobbls is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 04-16-2016 , 23:03   Re: Move_Rope help
Reply With Quote #8

Quote:
Originally Posted by Bobbls View Post
I also tried using Prop_Data with the same results, it seems to always return -1.
You're checking things too early (SpawnPost still appears to be too early to check). A quick hack of getting it a frame after it spawns seems to return stuff that isn't -1.

I've had a similar issue when I worked on the Revive Health modifications. Just using RequestFrame here since I'm not sure if ropes can even think.

Code:
#include <sdkhooks>

public void OnEntityCreated(int entity, const char[] name) {
    if (StrEqual(name, "move_rope")) {
        SDKHook(entity, SDKHook_SpawnPost, OnMoveRopeSpawnPost);
    }
}

public void OnMoveRopeSpawnPost(int entity) {
    RequestFrame(PrintRopeStuff, entity);
}

public void PrintRopeStuff(int rope) {
    int hStartPoint = GetEntPropEnt(rope, Prop_Data, "m_hStartPoint");
    int hEndPoint = GetEntPropEnt(rope, Prop_Data, "m_hEndPoint");
    
    char sStartOrigin[64], sEndOrigin[64];
    GetEntOriginString(hStartPoint, sStartOrigin, sizeof(sStartOrigin));
    GetEntOriginString(hEndPoint, sEndOrigin, sizeof(sEndOrigin));
    
    PrintToServer("rope -- start: %d (%s), end: %d (%s)", hStartPoint, sStartOrigin, hEndPoint, sEndOrigin);
}

void GetEntOriginString(int entity, char[] buffer, int maxlen) {
    float vecOrigin[3];
    GetEntPropVector(entity, Prop_Data, "m_vecOrigin", vecOrigin);
    
    Format(buffer, maxlen, "%.2f %.2f %.2f", vecOrigin[0], vecOrigin[1], vecOrigin[2]);
}
There might be a better hook to call that doesn't need callbacks, but I'm too lazy to check.

(I know you already got the news from our mutual staff comms, just wanted to post it if anyone else has a similar issue later on.)
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 04-16-2016 at 23:10.
nosoop 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 04:32.


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