Page 1 of 3

[Tutorial] Creating a unique NPC

Posted: 08 Oct 2016, 23:22
by Alundaio
For this tutorial, I will assume you are using Notepad++ or similar text editor that allows multiple tabs.

This tutorial teaches you:
  • How to create a new unique stalker and squad
  • How to create an exclusive gulag job using the 'beh' scheme (No need for Level Editor or ACDC)
  • How to spawn squads

Files you will edit:
  • S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\gameplay\npc_profile.xml
  • S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\gameplay\character_desc_marsh.xml
  • S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\gameplay\dialogs_marsh.xml
  • S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\text\eng\st_dialogs_marsh.xml
  • S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\text\eng\st_characters.xml
  • S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\creatures\spawn_sections_marsh.ltx
  • S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\misc\squad_descr_marsh.ltx
  • S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\scripts\marsh\smart\mar_smart_terrain_base.ltx
  • S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\misc\simulation.ltx

Files you will create:
  • S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\scripts\marsh\mar_smart_terrain_base_new_job.ltx

Creating a new NPC:
  • Decide where you would like your NPC to be located. For this tutorial, I want to make a NPC in Clear Sky base.
  • Open S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\gameplay\npc_profile.xml
    • Create a new xml tag containing a new Character and Class ID. This will be used by our new Character Profile.

      Code: Select all

         <character id="mar_smart_terrain_my_new_npc">

  • Open S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\gameplay\character_desc_marsh.xml
    • Create a new Character Profile. You can copy an existing profile and change the tags as needed.

      Code: Select all

            <!-- MY NEW NPC -->
            <specific_character id="mar_smart_terrain_my_new_npc" team_default = "1">
            <map_icon x="1" y="0">
            <money min="1000000" max="1000000" infinitive="1" />
               [spawn] \n
               wpn_ak74u = 1 \n
               ammo_5.45x39_fmj = 1 \n
         #include "gameplay\character_criticals_4.xml"

    • For 'specific_character id' we want to use the name we defined in npc_profile.xml. I used mar_smart_terrain_my_new_npc.
    • For the 'name' tag we will use mar_smart_terrain_my_new_npc_name. This will refer to a text string alias that we will add later on in this tutorial.
    • The 'icon' tag refers to a texture alias defined in gamedata\configs\ui\textures_descr\ui_actor_portrets.xml. For this tutorial I'll just use generic ui_inGame2_csky_1
    • The 'visual' tag refers to the NPC's mesh name. For this tutorial I will just use generic actors\stalker_nebo\stalker_nebo_1
    • The 'supplies' tag allows you to set the npc's spawn loadout. It's important to use the '\n' because the text within this tag is loaded by the engine as an .ltx.
    • For 'start_dialog' I will use mar_smart_terrain_my_new_npc_start. This refers to a dialog xml tag we have yet to add!
    • For 'actor_dialog' I want this NPC to be able to use the new CoC task system. So we add the three new dialogs 'dm_ordered_task_*'
    • 'community' refers to faction. Make sure you use the names from game_relations.ltx, (ie. Duty would be <community>dolg</community>).
    • 'snd_config' refers to the character voice sets. I'll just use the generic human_02\csky set.
  • Open S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\gameplay\dialogs_marsh.xml
    • We're just going to add a tag for mar_smart_terrain_my_new_npc_start. This will just be a very simple start dialog.

      Code: Select all

          <dialog id="mar_smart_terrain_my_new_npc_start">
                  <phrase id="0">

    • mar_smart_terrain_my_new_npc_start_dialog_1 refers to a text string we will be adding later.
  • Open S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\text\eng\st_dialogs_marsh.xml
    • Add a new string tag with id="mar_smart_terrain_my_new_npc_start_dialog_1". For this tutorial, I'll just keep it simple:

      Code: Select all

          <string id="mar_smart_terrain_my_new_npc_start_dialog_1">
              <text>Yes? What do you need, stalker?</text>

  • Open S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\text\eng\st_characters.xml
    • We want to added a new string tag for our character's name:

      Code: Select all

           <string id="mar_smart_terrain_my_new_npc_name">
            <text>Tutorial NPC</text>

  • Open S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\creatures\spawn_sections_marsh.ltx
    • Here is where we create the object section for our new stalker.

      Code: Select all

         $spawn = "respawn\mar_smart_terrain_my_new_npc"
         character_profile = mar_smart_terrain_my_new_npc
         community = csky
         story_id = mar_smart_terrain_my_new_npc

    • The section name doesn't necessarily have to be the same as our character profile name. Story ID doesn't necessarily have to be the same as our section or character profile name, but it makes it easier to remember.
  • Open S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\misc\squad_descr_marsh.ltx
    • Now we need to create a new squad that will spawn this NPC.

      Code: Select all

         faction = csky
         npc = mar_smart_terrain_my_new_npc
         target_smart = mar_smart_terrain_base
         story_id = mar_smart_terrain_my_new_npc_squad

    • Since we are creating a unique NPC, we will want to force it to target a specific smart. We want mar_smart_terrain_base for our tutorial. This refers to the actual section name of the smart_terrain. You can use debug hud in PDA to find them.

    Okay, our NPC is done, now we need to create a gulag job for it. Make sure you have -dbg passed to your shortcut to enabled debug mode. You'll need it.
  • Run Stalker Call of Chernobyl by launching the game.
  • While in-game, enable the debug hud through gameplay options.
  • Pause the game to enter the main menu. Press F3 until you see 'actor_position' in the developer console (press `).
  • While back in-game you will see a HUD displaying positional data.
  • Find a suitable location you want your NPC to sit or stand. Make sure it says 'valid = true' in the HUD for this position.
  • Pause the game to enter main menu. Press 'P' while in the main menu to print this positional information to a file called positional_info.txt in your main game directory.
  • Exit the game and open the S.T.A.L.K.E.R. - Call of Chernobyl\positional_info.txt.
  • Open S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\scripts\marsh\smart\mar_smart_terrain_base.ltx
    • This is the "custom data" or "logic" for the mar_smart_terrain_base smart terrain.
    • We want to add our new exclusive job to the smart terrain.

      Code: Select all

      our_new_exclusive_job = marsh\mar_smart_terrain_base_new_job.ltx

    • Now create a new file S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\scripts\marsh\mar_smart_terrain_base_new_job.ltx
  • Open S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\scripts\marsh\mar_smart_terrain_base_new_job.ltx

      Code: Select all

         active = beh@mar_smart_terrain_base_new_job
         suitable = {=check_npc_name(mar_smart_terrain_my_new_npc)} true
         prior = 100
         behavior_state = beh_move
         target = waypoint
         walk_dist = 100
         jog_dist = 220
         wait_anim = rush
         walk_anim = rush
         jog_anim = rush
         run_anim = rush
         delay_anim = guard
         gather_items_enabled = false
         help_wounded_enabled = false
         corpse_detection_enabled = false
         meet = meet@general

         pt1 = 88860000,guard | pos:-158.74140930176,0.61138713359833,-312.51971435547 look:-156.08723449707,0.5962917804718,-309.91674804688
         path_end = loop

    • The 'beh' scheme is a new scheme created in Call of Chernobyl. It allows the ability to use scripted waypoints without the need to create them in all.spawn or Level Editor. But keep in mind positional data changes if the level geometry is changed.
    • You can have as many points as you want. You can use path_end = loop or path_end = reverse
    • guard refers to an animation state defined in gamedata\scripts\state_lib.script.
    • 88860000 refers to the delay in miliseconds before changing to the next point.
    • If you want to use an animpoint animation, then you need to use 'animpoint:' instead of 'pos:'. But with animpoint it uses 6 params instead of three: x,y,z,dirx,diry,dirz Direction should be the same as 'Heading' in the positional data.
  • Now that we created the exclusive gulag job, we want to spawn the NPC.
  • Open S.T.A.L.K.E.R. - Call of Chernobyl\gamedata\configs\misc\simulation.ltx
    • This file is the 'starting' spawns for the game. These only work on a NEW GAME.
    • Find mar_smart_terrain_base section and add our squad section!

      Code: Select all

  • Now run the game and start a new game closest to your new NPC's location. You should see him. If not, feel free to comment below for help!

Re: [Tutorial] Creating a unique NPC

Posted: 09 Oct 2016, 03:39
by olivius74
Good morning
Genious tutorial,I want to test it now.
I create all files you indicate and now in game I stop here :

Pause the game to enter main menu. Press 'P' to print this positional information to a file called positional_data.txt in your main game directory..

Sorry I confuse myself with the keys pause P,Esc, keys F3...
I can't obtain the file positional_data.txt.

Would you have the patience to tell me how to write this file,please?

And thank you very much for such tutorial,extraordinary to learn these features with you.
Best Regard Sir

Edit :
I manually copy my coordinate in screen,in scripts\marsh\mar_smart_terrain_base_new_job.ltx

It's ok! Forgot an equal :fight:

FANTASTIQUE!! Thank you Alundiao :first time I spawn a PNJ without big tools (acdc or SDK).
That is wonderful,I will try to change the apparence

Re: [Tutorial] Creating a unique NPC

Posted: 09 Oct 2016, 11:58
by Alundaio
It should be called, positional_info.txt, I made a mistake. It should be found S.T.A.L.K.E.R. - Call of Chernobyl\positional_info.txt after you press 'P' while in the main menu.
You can change the keybind for it in gamedata\configs\debug\xrs_debug_tools.ltx

Re: [Tutorial] Creating a unique NPC

Posted: 09 Oct 2016, 13:10
by olivius74
All perfect ,as usual!
YES it's good !to genious!
An enormous thank's to take time to explain us that!

My new Medic run in it's position!

Re: [Tutorial] Creating a unique NPC

Posted: 09 Oct 2016, 15:10
by Alundaio

Let's you add them as companion as long as actor is friendly (green). You can probably make your own version of friendly_companion_dialog without the relation check in dialogs.xml

Re: [Tutorial] Creating a unique NPC

Posted: 10 Oct 2016, 14:28
by olivius74
I found an old girl friend at Bar :)

Re: [Tutorial] Creating a unique NPC

Posted: 17 Oct 2016, 12:43
by olivius74

And please,how is it possible to spawn a unique mutant ,where I want ,in game?
Like Doctor's friend?

Re: [Tutorial] Creating a unique NPC

Posted: 17 Oct 2016, 14:00
by Alundaio
Well for mutant you don't need to create a profile, you just spawn the squad at the smart terrain that you want. But keep in mind there isn't a way to give them scripted waypoints, I never created anything that for mutants. Since there are no waypoints, you'll have to use 'mob_home' scheme.

Code: Select all

active = mob_home@default
suitable = {=check_npc_name(my_new_mutant_section)} true
prior = 100
monster_job = true

gulag_point = true
home_min_radius = 10
home_mid_radius = 20
home_max_radius = 30

Make sure you use the npc section name for the mutant, not the squad section for 'check_npc_name'

Re: [Tutorial] Creating a unique NPC

Posted: 17 Oct 2016, 15:14
by olivius74
Ah thank's a lot for your answer,Dear,I understand and try :)
So there is no mouvement possible.
And can we attribute him a special sound ?
(I though a wounded mutant,who walk in cercle or other or move strangely...)

Best Regard

Re: [Tutorial] Creating a unique NPC

Posted: 07 Nov 2016, 11:50
by olivius74
Hello Dear Stalkers

I'm so happy to enjoy CoC game and also modding it.
I think I will be able to create my own little mod for CoC :
Idea :
I create an unique NPC in each map of CoC.Unique actor with with unique great visual.
Even in all laboratory,I have ...gorgeus models!
The player can meet them,discuss,choose it for companion,medic,technician,trader man or women.

I would ask a question please:how I can create a dynamic new,each time I change level?
Just to prevent the player (text I create) need to see the unique NPC(I just write a tip to find them).

For example I'm in Marsh ,I go to Cordon ,level changer and here when first step in new map how create a message at screen .
I go to garbage idem a new message ,always and at each change I wonder to have displaying a message tip.
I look in lua function Sent_tip but I dont' know where I can write that,and how associate it to fact to level changer.

Thank a lot Dear Guys for help me once again :)
Have a good evening

Re: [Tutorial] Creating a unique NPC

Posted: 09 Nov 2016, 13:41
by olivius74
Thank's for all your help Dear Guys,news working on each map .
Need to lear to add a sound and new icon now.

Re: [Tutorial] Creating a unique NPC

Posted: 13 Nov 2016, 04:49
by olivius74
Send a good sunday

I look the logic for the unique NPC. ... ded_scheme
I have one wounded.
I want he need more than one medkit to save him.
Have you an idea on how can do that,please?

Best Regards

Re: [Tutorial] Creating a unique NPC

Posted: 04 Jan 2017, 08:43
by Mihelowsky
Good day, buddy.

So, i used this awesome guide to create my own unique character, BUT...

He doesn't stay where i need.

Where he is

Where he must be

What values of parameters in gulag job i need for it?

Re: [Tutorial] Creating a unique NPC

Posted: 04 Jan 2017, 11:08
by Alundaio
Did you create an 'exclusive' job for him like the guide says? gulag general is for generic simulation and obeys the max_population variable in the smart configuration. exclusive jobs ignore it.
Also make sure he has target_smart = <smart_name> in squad section.

If he is sitting randomly it usually means they don't have a smart terrain job because smart is full, but that don't happen when using target_smart

Re: [Tutorial] Creating a unique NPC

Posted: 04 Jan 2017, 12:26
by Mihelowsky
So. I deleted my posts because i made one new attempt and placed npc into a bar, in "bar_visitors" gulag.
And he again stay not in the right place.

Code: Select all

   active = beh@bar_visitors_new_job
   suitable = {=check_npc_name(bar_langer)} true
   prior = 100
   behavior_state = beh_move
   target = waypoint
   walk_dist = 100
   jog_dist = 220
   wait_anim = rush
   walk_anim = rush
   jog_anim = rush
   run_anim = rush
   delay_anim = guard
   gather_items_enabled = false
   help_wounded_enabled = false
   corpse_detection_enabled = false
   meet = meet@general

   pt1 = 88860000,guard | pos:127.95211791992,-4.8426423072815,28.956298828125 look:0.019196897745132,0.0011994207743555,-0.99981498718262
   path_end = loop

Code: Select all

position       = 127.95211791992,-4.8426423072815,28.956298828125
level_vertex_id = 35774
game_vertex_id    = 1741
direction       = 0.019196897745132,0.0011994207743555,-0.99981498718262
direction HP    = 3.1607909202576,0.0011994210071862
valid          = true

So, that's the data. Please, say: where i make mistake?

Re: [Tutorial] Creating a unique NPC

Posted: 04 Jan 2017, 12:49
by Alundaio
Show me the squad description

Re: [Tutorial] Creating a unique NPC

Posted: 04 Jan 2017, 12:53
by Mihelowsky

Code: Select all

faction = stalker
npc = bar_langer
target_smart = bar_visitors
story_id = bar_langer_squad

Re: [Tutorial] Creating a unique NPC

Posted: 05 Jan 2017, 05:39
by Mihelowsky
Good day. So, i checked it again - as i think, the game just ignore my exclusive job. Why?

Re: [Tutorial] Creating a unique NPC

Posted: 05 Jan 2017, 14:17
by Alundaio
I can't think of why, do you have gamedata\configs\scripts\bar\smart\bar_visitors.ltx

Code: Select all

bar_visitors_new_job = bar\bar_visitors_logic.ltx

Or whatever the filename you are using.

Also try setting prior to 200

Re: [Tutorial] Creating a unique NPC

Posted: 06 Jan 2017, 11:38
by Mihelowsky
I created a new exclusive job, as you writed in guide. And use it into bar_visitors.ltx

Code: Select all

bar_barman = bar\bar_barman.ltx
bar_guard1 = bar\bar_guard1.ltx
bar_guard2 = bar\bar_guard2.ltx
bar_arena_manager = bar\bar_visitors_logic.ltx
bar_arena_guard = bar\bar_visitors_logic.ltx
bar_visitors_animp_01 = bar\bar_visitors_logic.ltx
bar_visitors_animp_02 = bar\bar_visitors_logic.ltx
bar_visitors_animp_03 = bar\bar_visitors_logic.ltx
bar_visitors_animp_04 = bar\bar_visitors_logic.ltx
bar_visitors_animp_05 = bar\bar_visitors_logic.ltx
bar_visitors_animp_06 = bar\bar_visitors_logic.ltx
bar_visitors_animp_07 = bar\bar_visitors_logic.ltx
bar_visitors_animp_08 = bar\bar_visitors_logic.ltx
bar_visitors_animp_09 = bar\bar_visitors_logic.ltx
bar_visitors_animp_10 = bar\bar_visitors_logic.ltx
bar_visitors_animp_11 = bar\bar_visitors_logic.ltx
bar_visitors_animp_12 = bar\bar_visitors_logic.ltx
bar_visitors_animp_13 = bar\bar_visitors_logic.ltx
bar_visitors_animp_14 = bar\bar_visitors_logic.ltx
bar_visitors_animp_15 = bar\bar_visitors_logic.ltx
bar_visitors_animp_16 = bar\bar_visitors_logic.ltx
bar_visitors_animp_17 = bar\bar_visitors_logic.ltx
bar_visitors_animp_18 = bar\bar_visitors_logic.ltx
bar_visitors_animpoint_kamp1 = bar\bar_visitors_logic.ltx
bar_visitors_animpoint_kamp2 = bar\bar_visitors_logic.ltx
bar_visitors_animpoint_kamp3 = bar\bar_visitors_logic.ltx
bar_visitors_animpoint_kamp4 = bar\bar_visitors_logic.ltx
bar_visitors_animpoint_kamp5 = bar\bar_visitors_logic.ltx
bar_visitors_animpoint_kamp6 = bar\bar_visitors_logic.ltx
bar_visitors_animpoint_kamp7 = bar\bar_visitors_logic.ltx
bar_visitors_animpoint_kamp8 = bar\bar_visitors_logic.ltx
bar_visitors_animpoint_kamp9 = bar\bar_visitors_logic.ltx
bar_visitors_cardan_tech = bar\bar_visitors_cardan_logic.ltx
bar_visitors_animp_arena_1 = bar\bar_visitors_logic.ltx
bar_visitors_animp_arena_2 = bar\bar_visitors_logic.ltx
bar_visitors_animp_arena_3 = bar\bar_visitors_logic.ltx
bar_visitors_animp_arena_4 = bar\bar_visitors_logic.ltx
bar_visitors_animp_arena_5 = bar\bar_visitors_logic.ltx
bar_visitors_animp_arena_6 = bar\bar_visitors_logic.ltx
bar_visitors_animp_arena_7 = bar\bar_visitors_logic.ltx
bar_visitors_animp_arena_8 = bar\bar_visitors_logic.ltx
bar_visitors_animp_arena_9 = bar\bar_visitors_logic.ltx
bar_visitors_animp_arena_10 = bar\bar_visitors_logic.ltx
our_new_exclusive_job = bar\bar_visitors_new_job.ltx

And just in case i tried to write this in bar_visitors_logic.ltx

Code: Select all

active = beh@bar_visitors_new_job
suitable = {=check_npc_name(bar_langer)} true
prior = 200

But nothing changed.