View Full Version : npcs using custom weapons?
NukeyMcnuke
03-14-2008, 12:20 AM
is there a way to make npcs like combine soldiers use added weapons?(in my case the sniper rifle, using the model from hl2ctf)
at the moment that just stand there looking at you with the wep
thanks in advance
NukeyMcnuke
03-14-2008, 12:03 PM
no help? D:
benjy355
03-14-2008, 12:13 PM
Have you tried making them use it without any mods? The Combine can use the annabelle, so they should be able to use any single shot weapons you provide them.
Winston
03-14-2008, 12:14 PM
Have you given the weapon the required code for the AI to use it?
Specifically, the following functions:
Operator_HandleAnimEvent, CapabilitiesGet, GetPrimaryAttackActivity...
And while I don't think these are necessary, its worth also having:
GetFireRate, GetMaxBurst & GetMinBurst?
Copy & adjust these functions from the pistol or another weapon that you know the AI uses.
NukeyMcnuke
03-14-2008, 12:34 PM
ok ill try that
note that im using the left over sniper rifle code from the mod source, not the actual one from hl2ctf, im only using the model of that
Winston
03-14-2008, 03:51 PM
Basically the AI doesn't fire a weapon using PrimaryAttack, but with the above mentioned code instead. So you'll have to adjust it from other weapons accordingly, and if you lack those functions, your weapon will not work.
NukeyMcnuke
03-15-2008, 07:51 PM
this is the code i have so far:
http://files.filefront.com/weapon+sniperrifletxt/;9826252;/fileinfo.html
but it gets this on building the code:
1>weapon_sniperrifle.cpp
1>.\hl2\weapon_sniperrifle.cpp(178) : error C2511: 'int CWeaponSniperRifle::CapabilitiesGet(void) const' : overloaded member function not found in 'CWeaponSniperRifle'
1> .\hl2\weapon_sniperrifle.cpp(50) : see declaration of 'CWeaponSniperRifle'
im a horrible debugger so i have no idea what that means at all
Winston
03-16-2008, 03:25 AM
Interpret that error as:
"You've already given the function a body at line 50, so also giving a body at line 178 is clearly gonna cause problems, hence I'm not gonna compile. Delete one or the other!"
Marine
03-16-2008, 05:06 AM
Actually interpret that as:
You've got a function body at line 50 that's also on line 178. And to top it off you havent declared the second in the class definition. :P
Winston
03-16-2008, 05:48 AM
Actually interpret that as:
You've got a function body at line 50 that's also on line 178. And to top it off you havent declared the second in the class definition. :P
:) True, but at a glance the only difference i saw was that the second one is const int while the first is just int. I was attempting to add context missing in the errors, but yes, in order to do so, i had to change what they said. Technically. ;)
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.