Page 1 of 1

Call of Chernobyl Engine Changes

Posted: 16 Jun 2016, 21:53
by Alundaio
Here is place where I will quickly describe newly implemented features into the engine (mainly for myself to remember)

Layered Icons

    New fields for item sections:
    • 1icon_layer ; must equal name of a section that contains inv_grid_width, inv_grid_height, inv_grid_x and inv_grid_y -- can be existing item section
    • 1icon_layer_x ; offset x
    • 1icon_layer_y ; offset y
  • 1icon_layer_scale ; optional: defaults to 1.0

... repeatable up to as many as you need

    Code: Select all

    1icon_layer            = wpn_pm
    1icon_layer_x       = 0
    1icon_layer_y      = 0
    1icon_layer_scale   = 1.0       

    2icon_layer            = medkit
    2icon_layer_x    = 0
    2icon_layer_y   = 0

    3icon_layer            = wpn_pm
    3icon_layer_x    = 0
    3icon_layer_y   = 0

Scripted Context Menu Actions

New item section fields

    Code: Select all


    Example Item Section usage:
    use1_functor = some_script.some_function
    use1_action_functor = some_script.some_action_function

    Example functions in a scripted called [b]some_script.script
    for use with above:[/b]

    Code: Select all

    function some_function(itm)

           -- if something is true then we return a string for a context menu action
           if (something = true) then
                  return game.translate_string("st_some_string")
           -- returning nil means this will not show up as a context menu option


    -- This function will only execute when context menu option is selected. That means some_function, above, needs to return a string.
    function some_action_function(itm)

    -- do something here


Actor Menu Inventory Item Drag & Drop Callback:

    Refers to when an icon is dragged onto another icon in Actor Inventory Menu

    passed parameters:
    • itm1 is the object being dragged; may be nil
    • itm2 is the object the item is being dragged onto; may be nil
    • from_slot is the number value of the slot itm1 is being dragged from; 0 is invalid
    • to_slot is the number value of the slot itm2 is occupying; 0 is invalid

    from_slot and to_slot values:
    • EDDListType.iInvalid = 0
    • EDDListType.iActorSlot = 1
    • EDDListType.iActorBag = 2
    • EDDListType.iActorBelt = 3
    • EDDListType.iActorTrade = 4
    • EDDListType.iPartnerTradeBag = 5
    • EDDListType.iPartnerTrade = 6
    • EDDListType.iDeadBodyBag = 7
    • EDDListType.iQuickSlot = 8
    • EDDListType.iTrashSlot = 9

    These might be confusing if you are used to 'slots' as they are defined in configs. ActorBag is the main inventory window, while ActorSlot is weapon, helmet and outfit slots. ActorBelt is where artefacts go. PartnerTradeBag is the window of whomever the actor is currently trading with, while ActorTrade is like ActorBag but when in trade menu. The rest should be self-explanatory now.


    Code: Select all

    function on_game_start()

    function on_drag_drop(itm1,itm2,from_slot,to_slot)

       -- We only want to know when an item within actor's rucksack to another item in rucksack; not to a slot
       if (from_slot == to_slot and to_slot == EDDListType.iActorBag) then
          -- example on how to make a crafting system; sorry these functions don't really exist!
          if ( can_combine(itm1:section(),itm2:section()) ) then
             craft_new_item( itm1:section(), itm2:section() )
             -- TODO: release itm1 and itm2

CUIActorMenu exports:

    Code: Select all

          class_< enum_exporter<EDDListType> >("EDDListType")
                value("iActorBag", int(EDDListType::iActorBag)),
                value("iActorBelt", int(EDDListType::iActorBelt)),
                value("iActorSlot", int(EDDListType::iActorSlot)),
                value("iActorTrade", int(EDDListType::iActorTrade)),
                value("iDeadBodyBag", int(EDDListType::iDeadBodyBag)),
                value("iInvalid", int(EDDListType::iInvalid)),
                value("iPartnerTrade", int(EDDListType::iPartnerTrade)),
                value("iPartnerTradeBag", int(EDDListType::iPartnerTradeBag)),
                value("iQuickSlot", int(EDDListType::iQuickSlot)),
                value("iTrashSlot", int(EDDListType::iTrashSlot))

             class_< CUIActorMenu, CUIDialogWnd, CUIWndCallback>("CUIActorMenu")
                .def("get_drag_item", &CUIActorMenu::GetCurrentItemAsGameObject)
                .def("highlight_section_in_slot", &CUIActorMenu::HighlightSectionInSlot)
                .def("refresh_current_cell_item", &CUIActorMenu::RefreshCurrentItemCell)
                .def("IsShown", &CUIActorMenu::IsShown)
                .def("ShowDialog", &CUIActorMenu::ShowDialog)
                .def("HideDialog", &CUIActorMenu::HideDialog)

       module(L, "ActorMenu")
          def("get_actor_menu", &GetActorMenu),
          def("get_menu_mode", &GrabMenuMode)

    • ActorMenu.get_actor_menu()
    • ActorMenu.get_actor_menu():highlight_section_in_slot("section_name",CUIActorMenu.iActorBag)
    • ActorMenu.get_actor_menu():get_drag_item()
    • ActorMenu.get_actor_menu():ShowDialog(false)
    • if to_slot == EDDListType.iActorBag then


Game Object Exports:

    Code: Select all

          //For Car
          attach_vehicle(game_object)                               ----- C++      &CScriptGameObject::AttachVehicle(CScriptGameObject car)
          detach_vehicle()                                        ----- C++      &CScriptGameObject::DetachVehicle()
          get_attached_vehicle()                                     ----- C++      &CScriptGameObject::GetAttachedVehicle()
          iterate_feel_touch(functor)                               ----- C++      &CScriptGameObject::IterateFeelTouch(luabind::functor funct)
          get_luminocity_hemi()                                     ----- C++      &CScriptGameObject::GetLuminocityHemi()
          get_luminocity()                                        ----- C++      &CScriptGameObject::GetLuminocity()
          bone_visible()                                           ----- C++      &CScriptGameObject::IsBoneVisible()
          set_bone_visible()                                        ----- C++      &CScriptGameObject::SetBoneVisible(LPCSTR bone_name)
          set_health_ex(number)                                     ----- C++      &CScriptGameObject::SetHealthEx(u8 value)
          force_set_position(vector3)                               ----- C++      &CScriptGameObject::ForceSetPosition(FVector3 position)
          set_spatial_type(number)                                  ----- C++      &CScriptGameObject::SetSpatialType(u8 type)
          get_spatial_type()                                        ----- C++      &CScriptGameObject::GetSpatialType()
          //For Weapons
          weapon_addon_attach(game_object)                            ----- C++      &CScriptGameObject::Weapon_AddonAttach(CScriptGameObject addon)
          weapon_addon_detach(section)                                     ----- C++      &CScriptGameObject::Weapon_AddonDetach()
          //For Weapon & Outfit
          install_upgrade(string)                                  ----- C++      &CScriptGameObject::InstallUpgrade(LPCSTR section_name)
          has_upgrade(string)                                        ----- C++      &CScriptGameObject::HasUpgrade(LPCSTR section_name)
          iterate_installed_upgrades(functor)                         ----- C++      &CScriptGameObject::IterateInstalledUpgrades(luabind::functor funct)
          // For CHudItem
          play_hud_motion(string name, bool mixIn, number state)             ----- C++      &CScriptGameObject::PlayHudMotion(LPCSTR motion, bool bMixIn, u8 state)
          switch_state(number)                                     ----- C++      &CScriptGameObject::SwitchState(u8 value)
          get_state()                                           ----- C++      &CScriptGameObject::GetState()
          // For EatableItem
          set_remaining_uses(number)                                  ----- C++      &CScriptGameObject::SetRemainingUses(u8 value)
          get_remaining_uses()                                     ----- C++      &CScriptGameObject::GetRemainingUses()
          get_max_uses()                                           ----- C++      &CScriptGameObject::GetMaxUses()
          // Phantom
          phantom_set_enemy(game_object)                               ----- C++      &CScriptGameObject::PhantomSetEnemy(CScriptGameObject enemy)
          // Actor
          set_character_icon(string)                                  ----- C++      &CScriptGameObject::SetCharacterIcon(LPCSTR texture_name)

    game_object:get_attached_vehicle() {return game_object}
    game_object:add_upgrade(section) {void}
    game_object:has_upgrade(section) {return bool}
    game_object:iterate_installed_upgrades(lua_function,game_object) -- passes section and given game_object
    game_object:play_hud_motion(anim_section,bMixIn,game_object:get_state()) {return number} -- animation length
    game_object:get_state() {return number}

Weapon Sounds

    Ability to set individual actor sounds (For stereo sound!):
    Ability to Layer Sounds!

      Code: Select all

      snd_shoot = ak74_shoot

      snd_1_layer = weapons\ak74\ak74_bass
      snd_2_layer = weapons\ak74\ak74_shoot, 1, 0.01
      snd_2_layer1 = weapons\ak74\ak74_shoot1, 1, 0.01
      snd_2_layer2 = weapons\ak74\ak74_shoot2, 1, 0.01
      snd_2_layer3 = weapons\ak74\ak74_shoot, 1.3, 0.012
      snd_2_layer4 = weapons\ak74\ak74_shoot1, 1.1, 0.008
      snd_2_layer5 = weapons\ak74\ak74_shoot2, 1.5, 0.014
      snd_3_layer = weapons\ak74\ak74_mech, 1.5
      snd_3_layer1 = weapons\ak74\ak74_mech1, 1.5
      snd_3_layer2 = weapons\ak74\ak74_mech2, 1.5
      snd_3_layer3 = weapons\ak74\ak74_mech, 1
      snd_3_layer4 = weapons\ak74\ak74_mech1, 1.25
      snd_3_layer5 = weapons\ak74\ak74_mech2, 1.8
      snd_4_layer = weapons\ak74\ak74_reflect, 1, 0.015
      snd_4_layer1 = weapons\ak74\ak74_reflect1, 1, 0.015
      snd_4_layer2 = weapons\ak74\ak74_reflect2, 1, 0.015
      snd_4_layer3 = weapons\ak74\ak74_reflect, 1.2, 0.012
      snd_4_layer4 = weapons\ak74\ak74_reflect1, 1, 0.019
      snd_4_layer5 = weapons\ak74\ak74_reflect2, 1.4, 0.01


Check the GITHUB wiki for incomplete and not up-to-date info: ... of-Changes

Re: Call of Chernobyl Engine Changes

Posted: 31 Jul 2016, 20:28
by Alundaio
Random Weapon Loadouts:

Normally in char_desc_*.xml you would spawn items like this:

Code: Select all

        [spawn] \n
        wpn_beretta = 1 \n
        wpn_sig550 \n
        ammo_5.56x45_ss190 = 1 \n
        ammo_9x19_fmj = 1 \n

But in CoC it's possible to spawn randomly 1 item out of a list like this:

Code: Select all

[spawn] \n
[spawn_loadout] \n
wpn_beretta = 2 \n
wpn_lr300 = 1, silencer, scope, ammo_type=1 \n
wpn_pm, cond=0.7 \n

[spawn_loadout2] \n
wpn_beretta, level=k00_marsh \n

Can have as many spawn_loadout* as you want.

section = <count> where count is the amount of ammo boxes to spawn, not how many items of that section to spawn like it would normally be for the vanilla supplies.

Must not be spaces when using ammo_type=<number> and level=<name>

Valid params:
  • silencer
  • scope
  • launcher
  • level=
  • cond=
  • ammo_type=

When using level param, item will only have the chance to spawn if the npc spawning it is on that level.

ammo_type corresponds to ammo_class in weapon ltx. So the ammo_type = 0 would be the first param in ammo_class = someammo_name1, someammo_name 2. While ammo_type = 1 would be the second param

Re: Call of Chernobyl Engine Changes

Posted: 14 Aug 2017, 10:46
by Plaargath
Is it possible to start a coroutine in a script?

Nice. Thanks!

Re: Call of Chernobyl Engine Changes

Posted: 14 Aug 2017, 19:38
by Alundaio
No, but it is possible to run code on another thread, in coc see _g.script AddUniqueCall

Re: Call of Chernobyl Engine Changes

Posted: 14 Nov 2017, 09:56
by Romann
Alundaio wrote:Check the GITHUB wiki for incomplete and not up-to-date info: ... of-Changes

Good evening, do not know where to write I will write here: I have downloaded the source from the repository (""), and with the Assembly of the engine such situation: well, first oddity: it seems the projects ground under VS2013, but when you open all the projects are unloaded ( ... 8.png.html
Image) - does not want to boot in VS2013, but in VS2017 only way to go, if you download asked to transfer all projects to the tools on the newer VS2017 - I refused all except "xrGame.dll" going without problems when building xrGame.dll in the end, under the link, and it is:
( ... 8.png.html
Image ... 8.png.html

Code: Select all

1>LINK : fatal error C1510: Cannot load language resource clui.dll

Which means:
( ... rror-c1510)

Cannot open language resource clui.dll
The compiler can't load the language resource DLL.
There are two common causes for this issue. When using the 32-bit compiler and tools, you may see this error for large projects that use more than 2GB of memory during a link. A possible solution on 64-bit Windows systems is to use the 64-bit native or cross compiler and tools to generate your code. This takes advantage of the larger memory space available to 64-bit apps. If you must use a 32-bit compiler because you are running on a 32-bit system, in some cases you can increase the amount of memory available to the linker to 3GB.

Well, as I understand it, the x32 C compiler without any modifications, and if exceeds the allowable RAM=flies, so a different compiler and not Pouseele project "Release x32".
On some sites, Dating advice - turn off optimization for the project, I tried: well, first of all, the Assembly went first, the second twice as long, but still ended with success(for the first time brought the source code of CoC):

Code: Select all

1> create a library X:\src\..\_build\lib\Release\xrGame.lib and the object X:\src\..\_build\lib\Release\xrGame.exp
1>code generation
1>code generation finished
1>xrGame.vcxproj -> E:\STALKER\Games\bin_rel\xrGame.dll
1>Build project "xrGame.vcxproj" has been completed.
========== Build: successfully: 1, errors: 0, unchanged: 0 skipped: 0 ==========

So the question is: can this error -

Code: Select all

1>LINK : fatal error C1510: Cannot load language resource clui.dll

fix as anything else, except how to turn optimization off? And somehow not smiling after even the slightest changes to wait more than two hours of Assembly, and also on the computer at this time nothing else will do(just like the location to compile)...

PS: Sorry for my English - Google translator.

Re: Call of Chernobyl Engine Changes

Posted: 21 Dec 2017, 16:56
by Graff46
Tell me the game has a scripting function to change the textures of the static objects?

Re: Call of Chernobyl Engine Changes

Posted: 13 Jan 2018, 17:37
by SadBlackFox
Graff46 wrote:Tell me the game has a scripting function to change the textures of the static objects?

No. Но если есть мы были бы благодарны за Pull-request с изменениями для появления этой возможности. :)