Raised This Month: $32 Target: $400
 8% 

[TF2] Reorienting a sentry gun


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sarysa
Senior Member
Join Date: Mar 2014
Old 11-21-2014 , 13:52   [TF2] Reorienting a sentry gun
Reply With Quote #1

It's really only useful for an aesthetic, but in the neverending quest to find new ways to mess with engineers in Freak Fortress 2, I figured out this hidden prop:

Code:
		// force the angle now
		new angleOffsetB = FindSendPropInfo("CObjectSentrygun", "m_iAmmoShells") - 16;
		new angleOffsetA = angleOffsetB - 12;
		SetEntDataVector(sentry, angleOffsetA, Sentry_CurrentAngle[sentryIdx]);
		SetEntDataVector(sentry, angleOffsetB, Sentry_CurrentAngle[sentryIdx]);
A couple things to keep in mind:
- It needs to be done every frame or a sentry will slowly revert to the closest target.
- The gun will fire normally only if the closest target is within a certain angle deviation from its reticle.
- Wrangler will either completely block this or result in a race condition.

Still, it can be used for fun mods that mess with players...like making the gun always face the engie. My particular use is to have the gun appear to go haywire.
__________________
sarysa is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 11-22-2014 , 16:55   Re: [TF2] Reorienting a sentry gun
Reply With Quote #2

Sentry has a think function, can probably hook post that. Offsets change pretty often, so this won't be stable between major updates.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
rswallen
SourceMod Donor
Join Date: Jun 2013
Location: 127.0.0.1
Old 11-22-2014 , 17:39   Re: [TF2] Reorienting a sentry gun
Reply With Quote #3

Quote:
Originally Posted by sarysa View Post
like making the gun always face the engie
beep-beep-beep-beep-beep-beep-beep-beep-beep-beep
__________________
rswallen is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 11-22-2014 , 17:48   Re: [TF2] Reorienting a sentry gun
Reply With Quote #4

Probably the other thing you could do is just set the sentry's target netprop to some entity and then teleport that around. i think that's how the wrangler works
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
sarysa
Senior Member
Join Date: Mar 2014
Old 11-23-2014 , 10:10   Re: [TF2] Reorienting a sentry gun
Reply With Quote #5

Maybe. I'd imagine that the sentry would retarget away from a BS target (i.e. same team) pretty quickly, though. Chance of success of firing at this target I'd imagine would be pretty low.

As far as offsets go, since it's a vector, there's only 4 bytes between it and the closest named netprop...it bodes well for its long-term viability. Not to mention it's one of the oldest sentry variables around. It probably has a datamap entry too, but I'm too lazy to figure out which vector it is. :p
__________________

Last edited by sarysa; 11-23-2014 at 10:15.
sarysa is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 11-26-2014 , 17:54   Re: [TF2] Reorienting a sentry gun
Reply With Quote #6

Quote:
Originally Posted by friagram View Post
Sentry has a think function, can probably hook post that. Offsets change pretty often, so this won't be stable between major updates.
Are you sure about this? Last time I tried to hook the think function, I had to manually set the m_nNextThinkTick netprop on the sentry to get it to actually "think".
bl4nk is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 11-28-2014 , 08:14   Re: [TF2] Reorienting a sentry gun
Reply With Quote #7

Nope, i'm not sure at all, and sometimes valve randomly decides to add and remove thinks from entities
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Reply


Thread Tools
Display Modes

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:57.


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