Port HL:S npc
 

0 Пользователей и 1 Гость просматривают эту тему.

  • Citizen
  • *
  • Сообщений: 21
    • Просмотр профиля
sorry for the inconvenience but someone knows if is possible port the houndeyes and bullsquid from hls to hl2?
  • *
  • Сообщений: 314
    • Просмотр профиля
Of course it's possible. You have to update the code a little bit, as it was originally written for older compiler format, so some things don't quite fit anymore, but it sure is possible.

(for example, you'll find datedesc definitions be like this
DEFINE_FIELD( CNPC_Houndeye, field_name, field_type )
and it should be like this
DEFINE_FIELD( field_name, field_type)
because redeclaring the class was deemed pointless, so the function now takes fewer arguments. Another example is how linking, thinks, and how beams are being handled in modern SDK vs old SK. It's all minor detail, but the code needs to be updated to be able to compile it.)

Seeing how houndeyes and bullsquids from HL2 are essentially same as in HL:S, you can just download Source SDK 2006 in Steam and get the code from there (they're not in the game, obviously, but the code was always legally available from the SDK).

And the assets (models, textures, sounds) were always compatible.
  • Citizen
  • *
  • Сообщений: 21
    • Просмотр профиля
Sorry but I'm not very good programming
  can you explain it to me with more steps please
  • *
  • Сообщений: 314
    • Просмотр профиля
An NPC, naturally, requires both code and assets.
Assets are already compatible so you just copy the models and the textures.
The code is mostly compatible but needs to be edited a bit, in key spots.

If you're a complete newbie to coding, read this https://developer.valvesoftware.com/wiki/Getting_Started_On_Source_SDK_2013
And get Visual Studio 2015 Community, it's the best, in my optinion. Although I haven't tried 2017 yet.

Now that I looked in the code, it seems that 2006 SDK version of the houndeye is incompatible because it misses a few files, they're simply not present.
So we'll go with HL:S version.

When you copy the code of hl1_npc_houndeye.cpp and .h into your project (into Server), you'll immediately notice a few red flares, erros in the code. The first one is that the NPC wants to include the file hl1_ai_basenpc.h, and you could copy it, but it's far easier and less messy to just change it to "ai_basenpc.h", omitting 'hl1', and using HL2's basic ai functions for navigation and such.

Then you'll see that in the header file, hl1_npc_houndeye.h, the creature is declared as a CHL1BaseNPC. We should change to CAI_BaseNPC (because CHL1BaseNPC is defined in hl1_ai_basenpc.h, and we already decided not to use it).

Then let's look at the cpp file. It also has a few flaring error.s
One is that the creature is classified as CLASS_ALIEN_MONSTER. This relationship class (used for determening how one type of creatures percieves others, for example CLASS_COMBINE always hates CLASS_ZOMBIE, or CLASS_ANTLION hates and attacks most other things) is not present in HL2. You could add this class in hl2_gamerules.cpp, or you could change it to use one of the existing ones, for example CLASS_ANTLION.
That'll make the houndeye hostile to the player, to Combine soldiers, player allies, zombies and whatnot, and naturally, it'll make it neutral towards anltions (since they'll be sharing the same class). If you're not planning on mixing the two in one area, it's fine.

CLASS_ALIEN_MONSTER is referenced a couple times in the cpp, so you should change all instances of it to CLASS_ANTLION or whatever you chose. Again, the compiler lights up all errors in red, so you can quickly find them.

In case of the houndeye specifically, it uses some fancy beam magic to create shockwaves, and it absolutely needs the sprite material, sprite/shockwave.vmt, to be present, to be copied from HLS to your mod, or it'll crash. The path to the texture is declared inside the Precache() function.

Anyway, here I include the houndeye files which should go in your mod's sourcecode Server folder, or Server\yourmod for better file organising. I fixed everything I wrote about above, and tested it in-game.

https://drive.google.com/file/d/0B62rJ8GDQ_WnelRNUTRyTTlXWnc/view?usp=sharing
https://drive.google.com/file/d/0B62rJ8GDQ_WnWGlfaEYzNGFuYlk/view?usp=sharing

Image

Image

You should also remember to define health and attack strength in your skill.cfg, the commands would be sk_houndeye_health and sk_houndeye_dmg_blast. It will work if you don't define them, but you wouldn't be able to tweak them w/o editing source code every time.

And in case of the bullsquid, it's very similar, you also need to fix the includes, fix the classify function to return something other than CLASS_BULLSQUID, and I think you need to change the spit grenade calls because they're slightly different in Ep2 as they were changed for the antlions, so they take different arguments for spawning, or at least I think so from what I remember.
  • Citizen
  • *
  • Сообщений: 21
    • Просмотр профиля
ok
thank you so much
  • Citizen
  • *
  • Сообщений: 21
    • Просмотр профиля
I'm sorry I know it's a little rude to ask you but I see you know so much I think it would be a good idea to ask you.
A friend wants to make a skin of the oicw for the ar2 and not do it for smg1 but wants it to look like the oicw that had in the beta you know if it would be possible to change the secondary firing of the ar2 to use the secondary firing of the smg1?
  • Citizen
  • *
  • Сообщений: 2
    • Просмотр профиля
    • My steam page
Ok so for some reason when you port the HL:S houndeye, he doesn't want to run toward the player to attack him. But for some reason npc_select and npc_go work, and he can run away of the bullsquid. Anyone know why ?
  • Citizen
  • *
  • Сообщений: 2
    • Просмотр профиля
Someone still have this code? о_О
  • Citizen
  • *
  • Сообщений: 2
    • Просмотр профиля
Ok i follow the guie written above and I managed to get it to work but he can't use the shockwave attack, so he can't deal damage, i also add the bullsquid but him also can't deal damage [he can't throw the acid and the melee attack does not cause damage] besides that the ia works well, someone know how why they can't deal damage?
[Yes i try with the skill.cfg]