[Tutorial] Faction Control

User avatar
Alundaio
S.T.A.L.K.E.R.
Posts: 1368
Joined: 26 May 2012, 22:26

[Tutorial] Faction Control

Postby Alundaio » 10 Oct 2015, 06:24

Faction Control is a feature added in 1.2.21. This allows for factions to take control of smart terrains, in effect, changing which faction respawns at the smart. When a smart terrain is being contested, all squads contesting the smart will be switched online allowing for combat to occur outside of actor switch distance. A smart terrain is considered contested when two enemy factions enter a smart terrain and each squad's current action is stay on target.

While -dbg is passed through command line, detailed information about smart faction can be seen when mouse-hovering over a smart terrain in the PDA. Note that this system is not fully implemented into Call of Chernobyl. It was a development left over that I decided to merge into the official build. Military Warehouse logic is a good place to see further examples.


How-to enable faction control
  • First, find a smart terrain you want to become faction controlled. Open it's smart logic (ie. gamedata\configs\scripts\<level>\smart\<name>.ltx) in your preferred text editor.
  • Familiarize yourself with three new fields:
    • faction_controlled - This is a list of factions that are allowed to control this smart. If a faction takes over the smart and is not in the list then the respawner is deactivated.
    • faction_respawn_num - This is how many squads to respawn every time respawn idle timer hits zero
    • default_faction - This is the starting faction for the smart terrain. This is what will respawn if there is no controlling faction.
  • Now look at this example of how to use the above new fields:

      Code: Select all

      faction_controlled = stalker, freedom, dolg
      faction_respawn_num = 1
      default_faction = stalker

  • This is a list of all valid faction names:

      Code: Select all

      stalker
      bandit
      csky
      army
      freedom
      dolg
      ecolog
      killer
      monolith

  • That's it! Smart is now able to be faction controlled. But there is one more important step. Call of Chernobyl has a special smart terrain property system that tells what factions can enter which smart terrain. Open up gamedata\configs\misc\simulation_objects_props.ltx and Ctrl+F find your smart terrain you just made faction controlled. Make sure all factions you want to be able to enter this smart has a property value of 1 or greater, like this:

      Code: Select all

      ;NE car repair, military
      [mar_smart_terrain_10_5]:default_base
      sim_avail    = true
      surge       = 1
      army      = 1
      bandit       = 1
      army_heli   = 1

  • The higher the prop value, the higher priority the target is. Priority is based on distance, squad behavior and property value. Squads select their target randomly from the highest 1/4 of available targets, so keep this in mind.

How-to make dynamic jobs
    This section is to show you how to make an exclusive trader/mechanic job available to simulation squads when a smart is taken over and the exclusive NPC dies. In this example I will show you what I did to mil_smart_terrain_7_10_smart_logic.ltx to make skinflint's trade position taken over by simulation npcs.
  • First, here is a new xr_conditions function you will need to use for the suitable field: smart_under_faction_control
    • param1 - smart by name
    • param2 - community
    • param3 - if true, then it will check_npc_name for that faction (This is used for suitable in logic section)
  • Now we need to adjust this logic so that this job can be used by both skinflint and a sim squad:

      Code: Select all

      ;freedom trader
      [logic@mil_smart_terrain_7_10_freedom_trader]
      suitable = {=smart_under_faction_control(mil_smart_terrain_7_10:freedom:false) =check_npc_name(mil_smart_terrain_7_10_freedom_trader_stalker)} true, {!squad_exist(mil_smart_terrain_7_10_freedom_trader_stalker_squad) =smart_under_faction_control(mil_smart_terrain_7_10:freedom:true)} true, false

    • {=smart_under_faction_control(mil_smart_terrain_7_10:freedom:false) =check_npc_name(mil_smart_terrain_7_10_freedom_trader_stalker)} true Here we make sure 3rd param is false, because we don't want to check NPC name for faction (ie. sim_default_duty_0) we want to check for skinflint, his name is mil_smart_terrain_7_10_freedom_trader_stalker so we added a check_npc_name for that.
    • , {!squad_exist(mil_smart_terrain_7_10_freedom_trader_stalker_squad) =smart_under_faction_control(mil_smart_terrain_7_10:freedom:true)} true, false Now we append a new conditional with a comma! Then we make sure skinflint squad doesn't exist and that smart is under control of freedom. Make sure 3rd param is false this time, this means that npcs with sim_default_freedom name can take the job.
    • That is it, this means that simulation npcs of freedom faction can take over skinflints trade job if he is dead.
    • Now, copy and paste the entire logic section for each new faction you added to the faction_controlled list. This is pretty simple now just make sure faction is correct, here is an example:

        Code: Select all

        ;bandit trader
        [logic@faction_controlled_bandit_trader]
        suitable = {=smart_under_faction_control(mil_smart_terrain_7_10:bandit:true)} true
    • Now since this is an exclusive job, we need to add faction_controlled_bandit_trader to exclusive section the smart logic. Here is what mine looks like now:

        Code: Select all

        [exclusive]
        mil_smart_terrain_7_10_freedom_trader =  military\mil_smart_terrain_7_10_smart_logic.ltx
        faction_controlled_bandit_trader = military\mil_smart_terrain_7_10_smart_logic.ltx
        faction_controlled_dolg_trader = military\mil_smart_terrain_7_10_smart_logic.ltx
        faction_controlled_monolith_trader = military\mil_smart_terrain_7_10_smart_logic.ltx

Okay so that should be all the important steps to enabling a faction controlled smart terrain. Have fun.
"I have a dream that one day this community will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident; that all mods are created equal."

comradeUSSR
Scavenger
Posts: 1
Joined: 18 Oct 2015, 07:30

Re: [Tutorial] Faction Control

Postby comradeUSSR » 18 Oct 2015, 07:39

Did a quick test by altering all '(Base) smart terrains in the western part of the zone to be capturable by any faction. Now, the altering of imulation_objects_props.ltx file seems to work. Factions travel from all over the zone to try and capture places like the agroprom, there are ecologists in death city etc. However, these factions may travel to smart terrains they didn't travel to before, but they don't seem to be able to capture them. So I think I edited the smart logics wrongly. I just pasted your code at the top of the smart logic scripts.

Code: Select all

faction_controlled = stalker, freedom, dolg
faction_respawn_num = 1
default_faction = stalker


and added all factions. Perhaps I forgot to add something to initiate this part of the script?

User avatar
Alundaio
S.T.A.L.K.E.R.
Posts: 1368
Joined: 26 May 2012, 22:26

Re: [Tutorial] Faction Control

Postby Alundaio » 18 Oct 2015, 16:10

There was an issue with respawner not working. It should be fixed now as of latest dev_build commit. I just saw stalker squad respawn at unattended freedom smart.
"I have a dream that one day this community will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident; that all mods are created equal."

fox
Scavenger
Posts: 1
Joined: 24 Jan 2016, 12:30

Re: [Tutorial] Faction Control

Postby fox » 24 Jan 2016, 12:40

Hello fellow stalker's, I'm new to this forum and this fine mod :)
I can't find script folder. It just ain't there and I want to change some spawn points and reduce that annoying heli in cordon. Am I doing something wrong? I've got win vista.
Please help, I want play it sooo badly!

User avatar
Alundaio
S.T.A.L.K.E.R.
Posts: 1368
Joined: 26 May 2012, 22:26

Re: [Tutorial] Faction Control

Postby Alundaio » 24 Jan 2016, 20:21

You need to extract the archives with http://www.moddb.com/mods/call-of-chern ... -converter

This will extract gamedata from the *.db files into unpacked. Then you just copy scripts and configs from unpacked to gamedata folder. Just keep in mind that gamedata directory takes priority over stuff in the *.db. This means when you update CoC version it won't work without manually merging your changes with the newly unpacked patch.


CoC 1.2.32 lets you disable the helicopters in game options. Just use CoCdater.exe.
"I have a dream that one day this community will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident; that all mods are created equal."

xenomorf
Scavenger
Posts: 9
Joined: 10 Sep 2014, 03:48

Re: [Tutorial] Faction Control

Postby xenomorf » 27 May 2016, 09:14

What about properties like "territory", or "base"? What they do?
Also, is there a way to make respawn radius from smart_terrain.script to override ones from configs? So i don't need to edit every single config if i want change general respawn radius :>

User avatar
Alundaio
S.T.A.L.K.E.R.
Posts: 1368
Joined: 26 May 2012, 22:26

Re: [Tutorial] Faction Control

Postby Alundaio » 28 May 2016, 22:07

There is default respawn radius in smart_terrain.script but it's overriden by whatever is in the smart logic.

territories are smart terrains that both stalkers and mutants can go to. Bases are smart terrains that only stalkers can go to, but also, there are extra flags to determine which faction is allowed to select that smart as a destination. For example putting csky = 0 for a smart means csky will not target this smart. lairs are smart terrains for monsters.
"I have a dream that one day this community will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident; that all mods are created equal."


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest