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

Solved [TF2] Setting General Properties and Checking Weapon On-Hit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alfonso Crawford
Member
Join Date: Feb 2012
Old 07-03-2012 , 11:30   [TF2] Setting General Properties and Checking Weapon On-Hit
Reply With Quote #1

I just installed TF2Items for the next leg of my mod, but I'm not sure how to use it. My goals are thus:
  1. Alter weapon-switch times (177/178) when specific weapons are equipped
  2. Block Medic healing (236) when a weapon's out
  3. Check which weapon struck in a player_hurt event
Goals #1 and #2, I don't know how to tackle. When do I set these attributes? With the third goal, I simply do not know how to identify a weapon on the fly. Which function(s) do I use?

Any direction or examples are greatly appreciated. :)

Last edited by Alfonso Crawford; 07-03-2012 at 15:12. Reason: set to solved
Alfonso Crawford is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-03-2012 , 11:47   Re: [TF2] Setting General Properties and Checking Weapon On-Hit
Reply With Quote #2

Quote:
Originally Posted by Alfonso Crawford View Post
I just installed TF2Items for the next leg of my mod, but I'm not sure how to use it. My goals are thus:
  1. Alter weapon-switch times (177/17 when specific weapons are equipped
  2. Block Medic healing (236) when a weapon's out
  3. Check which weapon struck in a player_hurt event
Goals #1 and #2, I don't know how to tackle. When do I set these attributes? With the third goal, I simply do not know how to identify a weapon on the fly. Which function(s) do I use?

Any direction or examples are greatly appreciated.
#1 and #2 should be done in TF2Items_OnGiveNamedItem, which allows you to modify weapon attributes as the item is being given.

The Pyrovision plugin might be a good place to look how to do this, although it adds that attribute to all weapons... you can instead check the classname or item index in TF2Items_OnGiveNamedItem and add the attributes there.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-03-2012 at 11:48.
Powerlord is offline
DarthNinja
SourceMod Plugin Approver
Join Date: Mar 2009
Location: PreThinkHook()
Old 07-03-2012 , 12:20   Re: [TF2] Setting General Properties and Checking Weapon On-Hit
Reply With Quote #3

Quote:
Originally Posted by Alfonso Crawford View Post
3. Check which weapon struck in a player_hurt event
I suggest you use SDKHooks and a take damage hook.
The player_hurt event passes very little in the way of useful data.
__________________

Last edited by DarthNinja; 07-03-2012 at 12:20.
DarthNinja is offline
Alfonso Crawford
Member
Join Date: Feb 2012
Old 07-03-2012 , 12:44   Re: [TF2] Setting General Properties and Checking Weapon On-Hit
Reply With Quote #4

A quick question to both of you: how do I compile my plugin, with TF2Items and/or SDKHooks? The official(?) online compiler gives me errors when use it.
Alfonso Crawford is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-03-2012 , 13:10   Re: [TF2] Setting General Properties and Checking Weapon On-Hit
Reply With Quote #5

Quote:
Originally Posted by Alfonso Crawford View Post
A quick question to both of you: how do I compile my plugin, with TF2Items and/or SDKHooks? The official(?) online compiler gives me errors when use it.
If you followed both of our suggestions, then you'll need both.

Unfortunately, the online compiler doesn't support the include files for TF2Items or SDKHooks.

I usually download the current version of SourceMod and copy the include files from the TF2Items and SDKHooks into addons/sourcemod/scripting/include and then use compile.exe to compile them.

(or use PawnStudio which can do the compile part for you)
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Alfonso Crawford
Member
Join Date: Feb 2012
Old 07-03-2012 , 15:11   Re: [TF2] Setting General Properties and Checking Weapon On-Hit
Reply With Quote #6

Ah, that's gonna save time!

I got it up and running, thanks! If you're curious, I slowed the weapon-switch time of the Sharpened Volcano Fragment and blocked healing on the Third Degree~! Setting thread to Solved.

Now I've just got to convert my player_hurt function to an SDKHooks one. I should ask about that in the official SDKHooks thread, shouldn't I?

Last edited by Alfonso Crawford; 07-03-2012 at 15:12. Reason: notified about setting to solved
Alfonso Crawford is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-03-2012 , 15:40   Re: [TF2] Setting General Properties and Checking Weapon On-Hit
Reply With Quote #7

Quote:
Originally Posted by Alfonso Crawford View Post
Now I've just got to convert my player_hurt function to an SDKHooks one. I should ask about that in the official SDKHooks thread, shouldn't I?
Out of curiosity, why do you want to know which weapon it was?

Anyway, if you have a weapon's entity index (either from player_hurt's weaponid or SDKHooks OnTakeDamage's weapon), you can use this to get its item definition index:
PHP Code:
new index GetEntProp(weaponProp_Send"m_iItemDefinitionIndex"); 
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-03-2012 at 15:46.
Powerlord is offline
Alfonso Crawford
Member
Join Date: Feb 2012
Old 07-03-2012 , 16:55   Re: [TF2] Setting General Properties and Checking Weapon On-Hit
Reply With Quote #8

Oh yeah, I found that out in the Scripting forum. ;)

My goal with the weapon-ID is to do as such:
  • Axtinguisher puts out burning enemies
  • Back Scratcher causes bleed
  • Sharpened Volcano Fragment has 5 seconds of afterburn
These are to balance the weapons around the buffs and nerfs I gave to afterburn in my mod, Sick Burn. I'll create a thread here for it when Version 2 (with these new bits) is working.
Alfonso Crawford is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-04-2012 , 09:58   Re: [TF2] Setting General Properties and Checking Weapon On-Hit
Reply With Quote #9

Quote:
Originally Posted by Alfonso Crawford View Post
Oh yeah, I found that out in the Scripting forum. ;)

My goal with the weapon-ID is to do as such:
  • Axtinguisher puts out burning enemies
  • Back Scratcher causes bleed
  • Sharpened Volcano Fragment has 5 seconds of afterburn
These are to balance the weapons around the buffs and nerfs I gave to afterburn in my mod, Sick Burn. I'll create a thread here for it when Version 2 (with these new bits) is working.
For Back Scratcher, just give it the bleed attribute (149).
As for afterburn, attribute 74 may work to reduce the afterburn time, but since no weapon in the game actually uses it...

Axtinguisher putting out allies would need a mod, though.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-04-2012 at 10:00.
Powerlord 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 07:30.


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