Hello. I like to mod video games. │ Twitter: ModdersPlaygro1 │ YouTube: Modder's Playground │ As for any of the mods that I release, feel free to adapt them to your liking or tweak them to make them better. I just want the modding community to thrive for as long as possible. That's what keeps many of our favourite games alive. All of my mods are only released in English; translations and adaptations are welcome. DM's open.

Report RSS S.T.A.L.K.E.R. modding functions (.ltx files) (short-ish memo)

Posted by on

===== FUNCTIONS FOR STALKER .LTX SCRIPTS =====

Current version dated 21/07/2023. Originally created 17/05/2021.

**at present, most of these are compatible across all three of the original S.T.A.L.K.E.R. games. Be aware that some may not be compatible with SoC (not yet found via testing, only through past recollection).

------------------------------------------------------
PLAYER/SQUAD RELATIONS:
------------------------------------------------------

Make a squad to be friends with the player: %=set_squad_goodwill(squad_name_1:friend)%

Set a squad to be enemies with the player: %=set_squad_enemy_to_actor(squad_name_1)%

Set two different squads to be enemies with each other: %=set_squads_enemies(squad_name_1:squad_name_2)%

Sets faction attitude towards player: %=set_faction_community_to_actor(bandit:enemy)%

%=set_factions_community(killer:renegade:enemy)%

Triggers a function with "on_info = " if the player is in a certain faction: {=actor_community(actor_monolith)}

**"actor_monolith" has been used as an example.

Triggers a function with "on_info = " if the player is an enemy to a certain NPC/squad: {=actor_enemy}

Examples of changes in faction goodwill if a player is in a particular faction (below):

on_info = {=actor_community(actor_freedom)} sr_idle %=inc_faction_goodwill_to_actor(freedom:5000)%

on_info2 = {=actor_community(actor_freedom)} sr_idle %=dec_faction_goodwill_to_actor(dolg:5000)%

**only use on_info2, on_info3, on_info4, etc. if there is more than one on_info variable under a section of script (i.e. under anything with a [ and a ] between them, such as [sr_idle] - you'll see [sr_idle] a lot in the games' .ltx files).

------------------------------------------------------
ITEM SPAWNING/OWNERSHIP:
------------------------------------------------------

Spawns item in player's inventory: %=give_item(item_name)%

Removes item from player's inventory: %=remove_item(item_name)%

Spawns an item in a container: %=spawn_object_in(item_name:container_name)%

Spawns item in non-smart_terrain type area (i.e. walk/look-defined): %=spawn_object(item_name:jup_b207_depot_cover)%

Triggers a function with "on_info = " if the player has an item in their inventory: {=actor_has_item(item_name)}


------------------------------------------------------
PLAYER/SQUAD POSITION:
------------------------------------------------------

Teleports player to walk/look-defined area: %=teleport_actor(zat_b7_actor_teleport_walk:zat_b7_actor_teleport_look)%

Teleports a squad to a walk/look-defined area: %=teleport_squad(squad_name:walk/look_area)%

Function that checks if the player is in a certain area: {=actor_in_zone(lim_space_restrictor_0008)}

Function that checks if the player is on a certain level: {=actor_on_level(k00_marsh)}


------------------------------------------------------
SQUAD SPAWNING/DE-SPAWNING:
------------------------------------------------------

Spawns a squad in smart_terrain area: %=create_squad(squad_name_1:smart_terrain_name)%

Add an NPC to a squad: %=create_squad_member(zat_b5_npc_name:squad_name_1)%

Removes existing squad based on squad name: %=remove_squad(squad_name_1)%

Clear a defined smart_terrain area of existing NPC's: %=clear_smart_terrain(smart_terrain_name)%


------------------------------------------------------
KILLING ENTITIES/SPAWNING DEAD NPC'S:
------------------------------------------------------

Kill the player: %=kill_actor%

Kills an existing squad(s): %=kill_squad(squad_name_1)%

Spawns a dead NPC in a walk/look-defined area: %=spawn_corpse(zat_b5_npc_name:walk/look_area)%

Function that checks if the player is alive: {=actor_alive}


------------------------------------------------------
GIVING/SHOWING/REMOVING INFO:
------------------------------------------------------

Gives PDA message to the player: %=send_tip (st_pda_message_string_name)%

Gives info: %+info_name%

Removes info: %-info_name%

Triggers function if actor has certain info portion(s): {+info_name}

Triggers function if actor does not have certain info portion(s): {-info_name}


---------------------------
SAVING YOUR GAME:
---------------------------

Autosaves the game: %=scenario_autosave(st_save_name)%


------------------------------------------------------
IN-GAME TIMER:
------------------------------------------------------

Value; 1000 = 1 second, start_value is in milliseconds


[sr_timer]

type = dec

start_value = 30000 (milliseconds)

on_value = 0 | sr_idle@check_death

Post comment Comments
neitys
neitys - - 1 comments

where does this stuff go?

for example if i want to use:

%=give_item(item_name)%

so i can : "Spawns item in player's inventory"

where do i enter this information?

Thanks!

Reply Good karma Bad karma+2 votes
Jacob_MP Author
Jacob_MP - - 168 comments

Hi, neitys.

Sorry for the late reply. ModDB doesn't seem to be giving me notifications for comments, but still does DM's, thankfully. :D

As for your query, the %=give_item(item_name)% function would go in any .ltx file that can be found in:

- gamedata/config/scripts/LEVEL NAME (for SoC, plus mods that are based on this)

OR

- gamedata/configs/scripts/LEVEL NAME (for CS, CoP and mods based on these)

In both cases, LEVEL NAME would be the game's internal name for your desired level (i.e. k00_marsh for the Swamps in CS, etc. - most of them are easy to recognise).

Furthermore, in the %=give_item(item_name)%, just substitute item_name with the item that you want to spawn, like wpn_ak74 for the AKM-74/2 and the game will spawn it for you when you boot it up.

For spawning multiple items, I'd go with something like:

%=give_item(wpn_ak74) =give_item(wpn_mp5)%
**as an example

It'd be best to add an info portion (a string or bit of text for the game to remember) so it's not constantly filling up your inventory with AK's. For instance:

After on_info =, you might put

{-neitys_has_a_gun} %=give_item(wpn_ak74) +neitys_has_a_gun%

By doing this, the game would check if it's been given the neitys_has_a_gun info portion. If it hasn't, hence the "-" minus beforehand, it will give you the gun, then the game would be given the neitys_has_been_given_a_gun info portion, hence the "+" plus where it's shown a second time, which would prevent it from spamming your inventory with AK's.

EDIT: Something I forgot to mention. If you do plan on adding more info portions for your game or mod to remember, make sure the game knows what the info portion is beforehand. To do this, you'd need to go to gamedata/configs/gameplay to find .xml file (similar to .ltx ones, can be opened in notepad, etc.). Copy and paste any info portion from any of the .xml files that handle these (i.e. info_escape.xml, or something similar - this one, for instance, handles info portions in the Cordon, though the game can read any of them regardless of which level they are used in), add it to the bottom of the document and substitute the info portion text with whatever you want to name your new info portion (i.e. neitys_has_a_gun from earlier would be fine). Doing this would prevent the game from crashing and giving you an error saying that it doesn't know what your new info_portion is. Also, don't forget that SoC and mods based on this game (to my knowledge) use a config folder rather than a configs folder.

I hope this all helps. I might've included a tad bit too much info, but just some extra bits and pieces incase you get stuck. Shoot me a DM if you need any more help. I've been dealing with .ltx script files for a good while now. They took quite some time to get my head around, but I'd be pleased to help you further if you need anything.

Happy hunting, stalker!

Jacob_MP.

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: