Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding

Reply
 
Thread Tools Display Modes
Old 03-14-2008, 12:20 AM   #1
NukeyMcnuke
 
Guest
Posts: n/a
npcs using custom weapons?

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
 
Reply With Quote
Old 03-14-2008, 12:03 PM   #2
NukeyMcnuke
 
Guest
Posts: n/a
no help? D:
  Reply With Quote
Old 03-14-2008, 12:13 PM   #3
benjy355
 
Join Date: Dec 2005
Reputation: 0
Posts: 144
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.
benjy355 is offline   Reply With Quote
Old 03-14-2008, 12:14 PM   #4
Winston
 
Join Date: Jul 2007
Reputation: 84
Posts: 2,170
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.
Winston is offline   Reply With Quote
Old 03-14-2008, 12:34 PM   #5
NukeyMcnuke
 
Guest
Posts: n/a
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
  Reply With Quote
Old 03-14-2008, 03:51 PM   #6
Winston
 
Join Date: Jul 2007
Reputation: 84
Posts: 2,170
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.
Winston is offline   Reply With Quote
Old 03-15-2008, 07:51 PM   #7
NukeyMcnuke
 
Guest
Posts: n/a
this is the code i have so far:
http://files.filefront.com/weapon+sn.../fileinfo.html
but it gets this on building the code:
Quote:
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
  Reply With Quote
Old 03-16-2008, 03:25 AM   #8
Winston
 
Join Date: Jul 2007
Reputation: 84
Posts: 2,170
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!"
Winston is offline   Reply With Quote
Old 03-16-2008, 05:06 AM   #9
Marine
 
Join Date: Sep 2006
Reputation: 9
Posts: 2,691
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
Marine is offline   Reply With Quote
Old 03-16-2008, 05:48 AM   #10
Winston
 
Join Date: Jul 2007
Reputation: 84
Posts: 2,170
Quote:
Originally Posted by Marineio View Post
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.
Winston is offline   Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding


Thread Tools
Display Modes

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



All times are GMT -7. The time now is 01:36 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2012, All Rights Reserved.