AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [EXTENSION] NPCs in CS:S (extended) (https://forums.alliedmods.net/showthread.php?t=306169)

kadet.89 04-09-2018 12:34

Re: [EXTENSION] NPCs in CS:S (extended)
 
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);
  ^


raydan 04-09-2018 23:59

Re: [EXTENSION] NPCs in CS:S (extended)
 
all files in "SM" folder should not compile, these files for create npc from sourcemod.
i never finish this part and make it work

kadet.89 04-10-2018 15:06

Re: [EXTENSION] NPCs in CS:S (extended)
 
2 Attachment(s)
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:3:
/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.
https://forums.alliedmods.net/attach...3&d=1523465011

Vit_amin 04-12-2018 08:05

Re: [EXTENSION] NPCs in CS:S (extended)
 
How NPC navigated in BSP Map ? I mean they used Navigation Mesh System or AI Nodegraph ?

kadet.89 04-12-2018 08:27

Re: [EXTENSION] NPCs in CS:S (extended)
 
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

raydan 04-13-2018 01:53

Re: [EXTENSION] NPCs in CS:S (extended)
 
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

kadet.89 04-13-2018 05:15

Re: [EXTENSION] NPCs in CS:S (extended)
 
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

kadet.89 04-19-2018 15:43

Re: [EXTENSION] NPCs in CS:S (extended)
 
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.

Seamusmario 04-22-2020 18:31

Re: [EXTENSION] NPCs in CS:S (extended)
 
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.

D@Ni1986 05-07-2020 15:32

Re: [EXTENSION] NPCs in CS:S (extended)
 
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


All times are GMT -4. The time now is 09:18.

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