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

[TF2] Modifying weapon's attributes on the fly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arbieo
New Member
Join Date: Dec 2009
Old 12-01-2009 , 22:56   [TF2] Modifying weapon's attributes on the fly
Reply With Quote #1

Is it possible to modify a weapon's attributes on the fly? Most notably, the "TimeFireDelay" attribute. I wish to make a "no run and gun" mod where the character's gun shoots at different speeds depending if they're running, crouch-walking or standing still.

Otherwise, can I prevent attacks from occuring and simulate attacks myself? Though, this would be much more work and it would be so much easier just to change weapon attributes if possible...

Hmm.... now thinking.... Is there a way to change the reload time on a weapon? (cannot find it in the weapon's config) I could do tricks where you have to reload after eavry shot when running, but have enough ammo to keep firing when not (to simulate 2 different fire rates)

Please let 1 of these 3 hacks be possible...
Arbieo is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 12-02-2009 , 00:04   Re: [TF2] Modifying weapon's attributes on the fly
Reply With Quote #2

It's all possible, but sadly not just with a plugin. You'll need an extension back-end to modify anything like that to do with weapons.
bl4nk is offline
noodleboy347
AlliedModders Donor
Join Date: Mar 2009
Old 12-02-2009 , 01:07   Re: [TF2] Modifying weapon's attributes on the fly
Reply With Quote #3

Quote:
Originally Posted by bl4nk View Post
It's all possible, but sadly not just with a plugin. You'll need an extension back-end to modify anything like that to do with weapons.
Has anyone attempted to make that extension?
noodleboy347 is offline
Arbieo
New Member
Join Date: Dec 2009
Old 12-02-2009 , 07:05   Re: [TF2] Modifying weapon's attributes on the fly
Reply With Quote #4

Quote:
Originally Posted by bl4nk View Post
It's all possible, but sadly not just with a plugin. You'll need an extension back-end to modify anything like that to do with weapons.
Alright, that's helpful. I'll look into extensions tonight.

Thanks! (and if I need help, it's the next sub-forum down, right?)
Arbieo is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 12-02-2009 , 08:11   Re: [TF2] Modifying weapon's attributes on the fly
Reply With Quote #5

Quote:
Originally Posted by noodleboy347 View Post
Has anyone attempted to make that extension?
Yes, but I don't work well with IDA and C++. From what i've found we need to call CScriptCreatedItem::Init which itself calls CScriptCreatedAttribute::CreateAttribute. Unfortunately, CScriptCreatedItem::Init is not a virtual function. If anyone has information how to hook/call such functions using SourceHook or BinTools, it'll be very appreciated.
FaTony is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 12-02-2009 , 10:19   Re: [TF2] Modifying weapon's attributes on the fly
Reply With Quote #6

you can change rate of fire without an extension but it will a lot harder. tf2 doesn't have an event for weapon fire, i remember reading in some thread there's a similar event but only works on servers with crits enabled. each weapon has properties for when the weapon can fire next you change it after the player fires which will change the rate of fire.

you can tell if a player is standing still by their velocity. there's an entity prop that tells you if a player is crouching or standing, you can then use both methods combined to see if they are crouch walking.

not sure about reload, it may be possible. there would be 2 factors though, the delay after which the player can shoot and if the weapon has actually reload. there's a player prop that controls when the player is next allowed to fire, i know for a fact this is used when you switch weapons, it may also work for reload. if you reduce the reload time you still may not be able to shoot if the clip hasn't been refilled. the clip is normally filled towards the end of the animation, but the shoot delay is normally until the end of the animation.
blodia is offline
Arbieo
New Member
Join Date: Dec 2009
Old 12-06-2009 , 15:24   Re: [TF2] Modifying weapon's attributes on the fly
Reply With Quote #7

So, I've gotten rate of fire changes to work (woot!) but it seems m_vecVelocity doesn't work with TF2. Anyone have any idea what I can use as a substitute? (I'm still trying to do this without using an extension =p)

Also, where can I find a list of all properties that have offsets findable with findsendpropinfo? (for stuff like "CTFPlayer", "CBaseCombatWeapon" etc..) Is there a function that returns a list or something?
Arbieo is offline
The JCS
AlliedModders Donor
Join Date: Jan 2007
Location: Brazil
Old 12-06-2009 , 18:08   Re: [TF2] Modifying weapon's attributes on the fly
Reply With Quote #8

TF2 Instagib does this by adding the weapon to a queue on shooting. On frame change, it process the queue and modify the time to the next shoot of the weapon.
The JCS is offline
Send a message via MSN to The JCS
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 12-06-2009 , 21:04   Re: [TF2] Modifying weapon's attributes on the fly
Reply With Quote #9

what do you need m_vecVelocity for? if you want to get the players speed use m_vecBaseVelocity.

as for property lists http://forums.alliedmods.net/showthread.php?t=110735
blodia 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 02:50.


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