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

TF2 - On hit building event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
boynedmaster
Member
Join Date: Jun 2012
Old 07-30-2015 , 19:58   TF2 - On hit building event
Reply With Quote #1

Is there an event for when the Engineer hits a friendly building? I want to change the amount it upgrades by (from 25).

net_showevents 2 doesn't show anything
__________________
I mean Venusaur...with a question mark

Last edited by boynedmaster; 07-30-2015 at 19:58.
boynedmaster is offline
Tylerst
Veteran Member
Join Date: Oct 2010
Old 07-30-2015 , 23:39   Re: TF2 - On hit building event
Reply With Quote #2

Quote:
Originally Posted by boynedmaster View Post
Is there an event for when the Engineer hits a friendly building? I want to change the amount it upgrades by (from 25).

net_showevents 2 doesn't show anything
If you want to change it globally just change the cvar tf_obj_upgrade_per_hit

If you want to do it per player you can use the attribute "upgrade rate decrease" with a positive value(IE 1.6 = 40 per hit, 2.0 = 50 per hit, 3.0 = 75 per hit, etc).

As far as detecting when an engineer hits a friendly building, it's possible it still fires OnTakeDamage even though the damage is 0, though that's just a guess.
Tylerst is offline
boynedmaster
Member
Join Date: Jun 2012
Old 07-31-2015 , 12:41   Re: TF2 - On hit building event
Reply With Quote #3

Quote:
Originally Posted by Tylerst View Post
If you want to change it globally just change the cvar tf_obj_upgrade_per_hit

If you want to do it per player you can use the attribute "upgrade rate decrease" with a positive value(IE 1.6 = 40 per hit, 2.0 = 50 per hit, 3.0 = 75 per hit, etc).

As far as detecting when an engineer hits a friendly building, it's possible it still fires OnTakeDamage even though the damage is 0, though that's just a guess.
I wanted to make the amount dependent on other variables and parts in the code.
__________________
I mean Venusaur...with a question mark
boynedmaster is offline
Michalplyoutube
Veteran Member
Join Date: Jan 2013
Location: Tank Carrier in Mannhatt
Old 07-31-2015 , 15:29   Re: TF2 - On hit building event
Reply With Quote #4

Check distance and keys
__________________
The plugin developer of TF2BWR Reborn
And a TF2 Player
Michalplyoutube is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 07-31-2015 , 15:39   Re: TF2 - On hit building event
Reply With Quote #5

See if SDKHook_TraceAttack works in TF2 and for melee weapons and check if the hit entity is an obj_* ? or just do a trace on CalcAttackIsCritical
__________________
Pelipoika is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-31-2015 , 16:35   Re: TF2 - On hit building event
Reply With Quote #6

Quote:
Originally Posted by Pelipoika View Post
See if SDKHook_TraceAttack works in TF2 and for melee weapons and check if the hit entity is an obj_* ? or just do a trace on CalcAttackIsCritical
CalcAttackIsCritical is fired whenever you swing/fire a weapon, even when you don't hit anything.

On a side note, SDKHooks_TakeDamage is fired even when you hit allies... although it may be blocked before the Post hook fires.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-31-2015 at 16:57.
Powerlord is offline
boynedmaster
Member
Join Date: Jun 2012
Old 07-31-2015 , 22:39   Re: TF2 - On hit building event
Reply With Quote #7

Is there any way I can set upgrade progress with it?
__________________
I mean Venusaur...with a question mark
boynedmaster is offline
Michalplyoutube
Veteran Member
Join Date: Jan 2013
Location: Tank Carrier in Mannhatt
Old 08-01-2015 , 05:20   Re: TF2 - On hit building event
Reply With Quote #8

Quote:
Originally Posted by boynedmaster View Post
Is there any way I can set upgrade progress with it?
U can only set lvl of building via defaultupgrade kv

for upgrade progress u should check this netprops:

m_iUpgradeMetal
m_iUpgradeMetalRequired
__________________
The plugin developer of TF2BWR Reborn
And a TF2 Player
Michalplyoutube is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 08-01-2015 , 10:36   Re: TF2 - On hit building event
Reply With Quote #9

you can perhaps hook the building for ontakedamage, probably melee hits register
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Michalplyoutube
Veteran Member
Join Date: Jan 2013
Location: Tank Carrier in Mannhatt
Old 08-01-2015 , 15:20   Re: TF2 - On hit building event
Reply With Quote #10

Quote:
Originally Posted by friagram View Post
you can perhaps hook the building for ontakedamage, probably melee hits register
Damage when taken from ent on the same team will do no dmg at all

Checkout robo-sapper 2 source I used get client weapon distance buttons etc to detect melee hit
__________________
The plugin developer of TF2BWR Reborn
And a TF2 Player
Michalplyoutube 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 12:17.


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