Raised This Month: $13 Target: $400
 3% 

[EXTENSION] NPCs in CS:S (extended)


Post New Thread Reply   
 
Thread Tools Display Modes
kadet.89
Veteran Member
Join Date: Nov 2012
Old 04-09-2018 , 12:34   Re: [EXTENSION] NPCs in CS:S (extended)
Reply With Quote #11

Moved operator definitions to *.cpp and there is no more g_pMemAlloc errors. But it's not really good, somehow the compiler omits the include with the pointer it may be caused by loop-including.
Now I have two errors:
1) "random", I think I understand why it happens..but at the moment I see no other solution than making changes to the SDK... though I'm pretty sure it is possible to redefine it somehow so it would work properly.
2) This is the problems I wrote about 2 posts ago, these templates and macroses are absolutely not clear to me.
If anybody can fix it, than we can move on.

Code:
In file included from /home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/AI/CAI_Navigator.h:16:0,
                 from /home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/Class/CAI_NPC.h:10,
                 from /home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/Class/CCycler_Fix.h:5,
                 from /home/d/SDK/sourcemod/extensions/npc/Extension/SM/npc_custom.h:6,
                 from /home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp:3:
/home/d/SDK/hl2sdk-css/game/shared/simtimer.h: In member function ‘void CSimpleSimTimer::Set(float, float)’:
/home/d/SDK/hl2sdk-css/game/shared/simtimer.h:57:42: error: request for member ‘RandomFloat’ in ‘random’, which is of non-class type ‘long int() throw ()’
    m_next = gpGlobals->curtime + random->RandomFloat( minInterval, maxInterval );
                                          ^
/home/d/SDK/hl2sdk-css/game/shared/simtimer.h: In member function ‘void CRandSimTimer::Set(float, float, bool)’:
/home/d/SDK/hl2sdk-css/game/shared/simtimer.h:141:43: error: request for member ‘RandomFloat’ in ‘random’, which is of non-class type ‘long int() throw ()’
     m_next = gpGlobals->curtime + random->RandomFloat( m_minInterval, m_maxInterval );
                                           ^
/home/d/SDK/hl2sdk-css/game/shared/simtimer.h: In member function ‘void CRandSimTimer::Reset()’:
/home/d/SDK/hl2sdk-css/game/shared/simtimer.h:150:42: error: request for member ‘RandomFloat’ in ‘random’, which is of non-class type ‘long int() throw ()’
    m_next = gpGlobals->curtime + random->RandomFloat( m_minInterval, m_maxInterval );
                                          ^
/home/d/SDK/hl2sdk-css/game/shared/simtimer.h: In member function ‘void CRandStopwatch::Start(float, float)’:
/home/d/SDK/hl2sdk-css/game/shared/simtimer.h:281:42: error: request for member ‘RandomFloat’ in ‘random’, which is of non-class type ‘long int() throw ()’
    m_next = gpGlobals->curtime + random->RandomFloat( minOverride, maxOverride );
                                          ^
In file included from /home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/CEntity.h:100:0,
                 from /home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/IEntityFactory.h:24,
                 from /home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.h:5,
                 from /home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp:2:
/home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/Class/CAI_NPC.h: In member function ‘virtual void CNPCBaseInteractive<NPC_CLASS>::InitDataMap()’:
/home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/macros.h:42:56: error: there are no arguments to ‘BaseEntity’ that depend on a template parameter, so a declaration of ‘BaseEntity’ must be available [-fpermissive]
   datamap_t *pMap = gamehelpers->GetDataMap(BaseEntity()); \
                                                        ^
/home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/Class/CAI_NPC.h:2019:2: note: in expansion of macro ‘CE_DECLARE_CLASS’
  CE_DECLARE_CLASS( CNPCBaseInteractive, NPC_CLASS );
  ^
/home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/macros.h:42:56: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
   datamap_t *pMap = gamehelpers->GetDataMap(BaseEntity()); \
                                                        ^
/home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/Class/CAI_NPC.h:2019:2: note: in expansion of macro ‘CE_DECLARE_CLASS’
  CE_DECLARE_CLASS( CNPCBaseInteractive, NPC_CLASS );
  ^
In file included from /home/d/SDK/mmsource-1.10/core/sourcehook/sh_vector.h:14:0,
                 from /home/d/SDK/mmsource-1.10/core/sourcehook/sh_stack.h:15,
                 from /home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.h:6,
                 from /home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp:2:
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp: In member function ‘void SM_CustomNPCEntityFactory::AddToList(char*)’:
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp:25:10: error: ‘EntityFactoryDictionary_CE’ was not declared in this scope
   assert(EntityFactoryDictionary_CE);
          ^
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp: In member function ‘virtual IServerNetworkable* SM_CustomNPCEntityFactory::Create(const char*)’:
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp:31:83: error: ‘EntityFactoryDictionary_CE’ was not declared in this scope
   IEntityFactoryReal *pFactory = (IEntityFactoryReal *)EntityFactoryDictionary_CE()->FindFactory("cycler");
                                                                                   ^
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp: In member function ‘virtual void SM_CustomNPCEntityFactory::Destroy(IServerNetworkable*)’:
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp:39:83: error: ‘EntityFactoryDictionary_CE’ was not declared in this scope
   IEntityFactoryReal *pFactory = (IEntityFactoryReal *)EntityFactoryDictionary_CE()->FindFactory("cycler");
                                                                                   ^
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp: In member function ‘virtual size_t SM_CustomNPCEntityFactory::GetEntitySize()’:
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp:46:83: error: ‘EntityFactoryDictionary_CE’ was not declared in this scope
   IEntityFactoryReal *pFactory = (IEntityFactoryReal *)EntityFactoryDictionary_CE()->FindFactory("cycler");
                                                                                   ^
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp: In member function ‘virtual CEntity* CustomNPCManager::Create(edict_t*, CBaseEntity*)’:
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp:75:11: error: ‘class CE_NPC_Custom’ has no member named ‘Init’
  pOurEnt->Init(pEdict, pEnt);
           ^
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp: In member function ‘int CustomNPCManager::AddCustomNPC(SourcePawn::IPluginContext*, unsigned int)’:
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp:151:22: error: ‘EF_CE_PostInit’ was not declared in this scope
  sp_npc->sp_function[EF_##f_name] = the_sp->GetFunctionByName("M_"#f_name);\
                      ^
/home/d/SDK/sourcemod/extensions/npc/Extension/SM/CustomNpcManager.cpp:233:2: note: in expansion of macro ‘DECLARE_SP_FUNCTION’
  DECLARE_SP_FUNCTION(CE_PostInit);
  ^

Last edited by kadet.89; 04-09-2018 at 12:51.
kadet.89 is offline
Send a message via Skype™ to kadet.89
raydan
Senior Member
Join Date: Aug 2006
Old 04-09-2018 , 23:59   Re: [EXTENSION] NPCs in CS:S (extended)
Reply With Quote #12

all files in "SM" folder should not compile, these files for create npc from sourcemod.
i never finish this part and make it work
raydan is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Old 04-10-2018 , 15:06   Re: [EXTENSION] NPCs in CS:S (extended)
Reply With Quote #13

I've solved main problems, there are some not very difficult left though.
I have to put CEntity:: before each call of CEntity-member functions, to get rid of such errors:
Quote:
/home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/Class/CItem.h:405:17: error: there are no arguments to ‘DoMuzzleFlash’ that depend on a template parameter, so a declaration of ‘DoMuzzleFlash’ must be available [-fpermissive]
DoMuzzleFlash();
Can anybody recommend me a simpler solution?

And I have this error:
Quote:
In file included from /home/d/SDK/sourcemod/extensions/npc/Extension/extension.h:4:0,
from /home/d/SDK/sourcemod/extensions/npc/Extension/CEntity/CEntityManager.h:24,
from /home/d/SDK/sourcemod/extensions/npc/Extension/Monster/npc_vortigaunt.h:4,
from /home/d/SDK/sourcemod/extensions/npc/Extension/Monster/npc_vortigaunt.cpp:
/home/d/SDK/sourcemod/extensions/npc/Extension/Monster/npc_vortigaunt.cpp: In function ‘datamap_t* DataMapInit(T*) [with T = CNPC_Vortigaunt]’:
/home/d/SDK/hl2sdk-css/public/datamap.h:190:188: error: invalid static_cast from type ‘void (CNPC_Vortigaunt::*)(inputdata_t&)’ to type ‘inputfunc_t {aka void (CBaseEntity::*)(inputdata_t&)}’
#define DEFINE_INPUTFUNC( fieldtype, inputname, inputfunc ) { fieldtype, #inputfunc, { 0, 0 }, 1, FTYPEDESC_INPUT, inputname, NULL, static_cast <inputfunc_t> (&classNameTypedef::inputfunc) }
^
/home/d/SDK/sourcemod/extensions/npc/Extension/Monster/npc_vortigaunt.cpp:132:2: note: in expansion of macro ‘DEFINE_INPUTFUNC’
DEFINE_INPUTFUNC( FIELD_VOID, "Dispel", InputDispel ),
^
/home/d/SDK/hl2sdk-css/public/datamap.h:190:188: error: invalid static_cast from type ‘void (CNPC_Vortigaunt::*)(inputdata_t&)’ to type ‘inputfunc_t {aka void (CBaseEntity::*)(inputdata_t&)}’
#define DEFINE_INPUTFUNC( fieldtype, inputname, inputfunc ) { fieldtype, #inputfunc, { 0, 0 }, 1, FTYPEDESC_INPUT, inputname, NULL, static_cast <inputfunc_t> (&classNameTypedef::inputfunc) }
^
/home/d/SDK/sourcemod/extensions/npc/Extension/Monster/npc_vortigaunt.cpp:133:2: note: in expansion of macro ‘DEFINE_INPUTFUNC’
DEFINE_INPUTFUNC( FIELD_VOID, "BeginCarryNPC", InputBeginCarryNPC ),
^
/home/d/SDK/hl2sdk-css/public/datamap.h:190:188: error: invalid static_cast from type ‘void (CNPC_Vortigaunt::*)(inputdata_t&)’ to type ‘inputfunc_t {aka void (CBaseEntity::*)(inputdata_t&)}’
#define DEFINE_INPUTFUNC( fieldtype, inputname, inputfunc ) { fieldtype, #inputfunc, { 0, 0 }, 1, FTYPEDESC_INPUT, inputname, NULL, static_cast <inputfunc_t> (&classNameTypedef::inputfunc) }
^
/home/d/SDK/sourcemod/extensions/npc/Extension/Monster/npc_vortigaunt.cpp:134:2: note: in expansion of macro ‘DEFINE_INPUTFUNC’
DEFINE_INPUTFUNC( FIELD_VOID, "EndCarryNPC", InputEndCarryNPC ),
^
/home/d/SDK/hl2sdk-css/public/datamap.h:190:188: error: invalid static_cast from type ‘void (CNPC_Vortigaunt::*)(inputdata_t&)’ to type ‘inputfunc_t {aka void (CBaseEntity::*)(inputdata_t&)}’
#define DEFINE_INPUTFUNC( fieldtype, inputname, inputfunc ) { fieldtype, #inputfunc, { 0, 0 }, 1, FTYPEDESC_INPUT, inputname, NULL, static_cast <inputfunc_t> (&classNameTypedef::inputfunc) }
^
/home/d/SDK/sourcemod/extensions/npc/Extension/Monster/npc_vortigaunt.cpp:136:2: note: in expansion of macro ‘DEFINE_INPUTFUNC’
DEFINE_INPUTFUNC( FIELD_BOOLEAN, "TurnBlue", InputTurnBlue ),
^
/home/d/SDK/hl2sdk-css/public/datamap.h:190:188: error: invalid static_cast from type ‘void (CNPC_Vortigaunt::*)(inputdata_t&)’ to type ‘inputfunc_t {aka void (CBaseEntity::*)(inputdata_t&)}’
#define DEFINE_INPUTFUNC( fieldtype, inputname, inputfunc ) { fieldtype, #inputfunc, { 0, 0 }, 1, FTYPEDESC_INPUT, inputname, NULL, static_cast <inputfunc_t> (&classNameTypedef::inputfunc) }
^
/home/d/SDK/sourcemod/extensions/npc/Extension/Monster/npc_vortigaunt.cpp:137:2: note: in expansion of macro ‘DEFINE_INPUTFUNC’
DEFINE_INPUTFUNC( FIELD_BOOLEAN, "TurnBlack", InputTurnBlack ),
^
I have no idea what to do with it. baseclass of CNPC_Vortigaunt is CEntity, not CBaseEntity, is it ok if I change the definition CBaseEntity -> CEntity ?
Does any of you guys have skype?

Btw I ran a server yesterday on my old windows mashine, it gathered 4 players and everything worked just fine. The only problem I had - a crash heppend when I ran the server for the first time and tryed to join it. And one more thing Sven Co-op maps would go nicely with this mode, there thousands of maps and it's not really difficult to get sources form some of them.
Attached Images
File Type: jpg 20180407191604_1.jpg (94.8 KB, 507 views)
Attached Files
File Type: 7z npc.7z (724.9 KB, 90 views)

Last edited by kadet.89; 04-12-2018 at 08:32.
kadet.89 is offline
Send a message via Skype™ to kadet.89
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 04-12-2018 , 08:05   Re: [EXTENSION] NPCs in CS:S (extended)
Reply With Quote #14

How NPC navigated in BSP Map ? I mean they used Navigation Mesh System or AI Nodegraph ?

Last edited by Vit_amin; 04-12-2018 at 08:07.
Vit_amin is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Old 04-12-2018 , 08:27   Re: [EXTENSION] NPCs in CS:S (extended)
Reply With Quote #15

Vit_amin, They use AI Nodegraph, You don't have to make *.nav for them. It works the same way as in Half-Life 2

Last edited by kadet.89; 04-12-2018 at 08:29.
kadet.89 is offline
Send a message via Skype™ to kadet.89
raydan
Senior Member
Join Date: Aug 2006
Old 04-13-2018 , 01:53   Re: [EXTENSION] NPCs in CS:S (extended)
Reply With Quote #16

all these "DEFINE_INPUTFUNC" error should be including wrong .h
there are "modify" folder, files come from hl2sdk, and i modify something.
include "modify" folder BEFORE hl2sdk folder should work, check vc++ solution file
raydan is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Old 04-13-2018 , 05:15   Re: [EXTENSION] NPCs in CS:S (extended)
Reply With Quote #17

raydan, thanks, I'll try it on tuesday (I'm on a business trip right now)

A short instruction how to build it:
First of all read the article https://wiki.alliedmods.net/Building_SourceMod and install all ther necessary libs

Create folder: /home/d/SDK/; (d - my username)
>cd /home/d/SDK/
>git clone --recursive https://github.com/alliedmodders/sourcemod
>bash sourcemod/tools/checkout-deps.sh
>cd ambuild
>sudo python setup.py install
Now you have in the SDK directory these folders:
"ambuild", "hl2sdk-*", "sourcemod", "mmsource-*" and may be "mysql-*"

Move the extension (my version) here "/home/d/SDK/sourcemod/extensions/" (along with other extensions, it'll be like "cstrike"; "npc" and so on)

Add the extension to the ambuild config: *SDK/sourcemod/AMBuildScript this way:

Quote:
BuildScripts = [
#'loader/AMBuilder',
....
'extensions/npc/AMBuilder',
....
]
It's time to build the extension.
Set build derictory:
>./SDK/sourcemod/build/

Reconfiguration for RELEASE mode:
>python ../configure.py --sdks css
OR
Reconfiguration for DEBUG mode:
>python ../configure.py --sdks css --enable-debug

Compiling:
>ambuild

A more detailed instruction in attachments here: https://forums.alliedmods.net/showthread.php?t=268065

Last edited by kadet.89; 04-13-2018 at 05:36.
kadet.89 is offline
Send a message via Skype™ to kadet.89
kadet.89
Veteran Member
Join Date: Nov 2012
Old 04-19-2018 , 15:43   Re: [EXTENSION] NPCs in CS:S (extended)
Reply With Quote #18

My server is closing down in a few weeks. No players for quite a long time and the hoster can't find a reason to keep it alive. So, there is no reason for me to keep on working on this extension.
Just want to wish you guys luck with it. If anybody has any question, don't hesitate asking me, I'm still here.
kadet.89 is offline
Send a message via Skype™ to kadet.89
Seamusmario
Junior Member
Join Date: Jun 2017
Old 04-22-2020 , 18:31   Re: [EXTENSION] NPCs in CS:S (extended)
Reply With Quote #19

It would be nice if this were ported to TF2. I have actually tried porting it to TF2 but i didn't understand signatures back then.
__________________
I host servers for fun.
I also code alot.
Seamusmario is offline
[email protected]
Junior Member
Join Date: Dec 2009
Old 05-07-2020 , 15:32   Re: [EXTENSION] NPCs in CS:S (extended)
Reply With Quote #20

On a leak assembled a COOP server npcs, hl2, ep2, hls, portal 188.243.54.154:27100
If anyone needs I can throw off the source
__________________
D@Ni1986 is offline
Send a message via ICQ to D@Ni1986
Reply


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

Forum Jump


All times are GMT -4. The time now is 07:56.


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