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

[TF2] how to check when building has finished building


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
foon
Member
Join Date: Dec 2018
Old 05-18-2020 , 18:26   [TF2] how to check when building has finished building
Reply With Quote #1

is there any way to check when a building has finished building?

"player_builtobject" is when you put the building down, and if you post hook it, that fires after you put it down
"player_upgradedobject" doesnt fire either once its done building, nor does OnEntityCreated (I wasnt sure if the model was replaced with another once it was finished playing its animation)

does anyone have any ideas?

Last edited by foon; 05-18-2020 at 21:57.
foon is offline
Scag
AlliedModders Donor
Join Date: May 2017
Location: Crashing Hale
Old 05-19-2020 , 01:04   Re: [TF2] how to check when building has finished building
Reply With Quote #2

You've a couple options:

IMO the best solution is to DHook CBaseObject::FinishedBuilding(). Offsets are 338 Linux and 336 Windows. There are a couple caveats with this, though. For example this'll fire if there is a Red Tape Recorder reversing the building. Also each time a building is upgraded. If you only want to hook it once, best bet is to Hook it OnEntityCreated/player_builtobject and remove the hook after the callback.

There are some netprops you could check every frame or so. When m_bBuilding true to false, then it has finished building. Also if m_flPercentageConstructed is >= 1.0, then it has also finished building.

Sentry's have a sentry_on_go_active event, so if you only need sentries then you can use that.
__________________
Over-engineering is underrated.

GitHub
BTC
ETH

Retired
Scag is offline
foon
Member
Join Date: Dec 2018
Old 05-19-2020 , 14:33   Re: [TF2] how to check when building has finished building
Reply With Quote #3

using Dhooks worked, thanks!
foon 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 16:23.


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