|
|
#1 |
![]() Join Date: Jan 2009
Reputation: 0
Posts: 11
|
Hi All,
My coding isn't great, so forgive me if my terminology is a bit off. What I'm trying to do is create a gametype whereby you need to defend citizens from combine attacks. So far everything is well, but I need to implement the win conditions in hl2mp_gamerules.cpp. What I'd like to be able to do is to keep an array of who (of the citizens) is left alive in CHL2MPRules. My problem is in accessing it from the spawn function in npc_citizen17.cpp. (The idea is that each time a citizen spawns, it is assigned an identifer so that the gamerules can update the clients' HUDs with which specific citizens are alive). Rather than try to outline all the fiddling I've done, can someone suggest in broad terms the best way to go about this, to nudge me in the right direction? Many Thanks, Andrew. |
|
|
|
|
|
#2 |
![]() Join Date: Aug 2010
Reputation: 35
Posts: 220
|
you add this to the includes:
#include "hl2mp_gamerules.cpp" since hl2mp_gamerules is suposto be shared you should by theory be able to add that include to any file :P (well in the source sdk source code) but there is a possible chance of failure... alltough i think thats its well codded (as in to include this if its on the client or the server whatever part) its possible that some of the includes of hl2mp_gamerules wont "want" to get included into npc_citizen17.cpp alltho give it a shot |
|
|
|
|
|
#3 |
![]() Join Date: Jan 2009
Reputation: 0
Posts: 11
|
I presume you mean include the header file? Yes, I did get that far.
I figured it out though: I'd made a mistake when defining my function in hl2mp_gamerules.cpp. I'd got: int GetNumberObjectives( void ) Instead of: int CHL2MPRules::GetNumberObjectives( void ) And so was getting "unresolved external" errors when accessing it from npc_citizen17.cpp. Amazing what a little sleep will do. Thanks though! |
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|