Mission Elements

Last edit by Luffy, 04-27-2017, 03:46 PM.

*This was originally written by walrus, in the future every element will have its own page

Basic mission elements

MissionScriptElement

This is the most basic element, it is used for executing other elements.

<entry index="ID" type="table">
    <entry key="class" type="string" value="MissionScriptElement"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreMissionScriptElement"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
            <entry index="1" type="table">
                <entry key="delay" type="number" value="1"/>
                <entry key="id" type="number" value="ELEMENT ID"/>
            </entry>
        </entry>
        <entry key="trigger_times" type="number" value="1"/>
    </entry>
</entry>

editor_name: This is the name of this element, you can make it whatever you want.

base_delay: You can use this to have a delay before this element will execute.

execute_on_startup: If this is set to “true” the element will execute when the map starts, note that startup is before the player spawns. You should try to only make one or two elements execute on startup. Some elements are required to execute on startup to work, for example “ElementWhisperState”.

on_executed: When the element is executed it will execute everything in the on_executed table.

delay: Use this to have a delay before the other element gets executed.

id: This is the id of the element that will get executed.

trigger_times: This is how often this element can get executed. “ElementToggle” can be used to reset this.

ElementToggle

This is used to enable/disable other elements.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementToggle"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementToggle"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="elements" type="table">
            <entry index="1" type="number" value="ELEMENT ID"/>
        </entry>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="set_trigger_times" type="number" value="-1"/>
        <entry key="toggle" type="string" value="on"/>
        <entry key="trigger_times" type="number" value="1"/>
    </entry

elements: The id's in this table will get enabled/disabled when the toggle is executed.

set_trigger_times: This sets how often the id's in the elements table can get executed.

toggle: “on” will set enabled to true on the id's in the elements table, “off” will set enabled to false, “toggle” will set enabled to true or false depending on what it is when “ElementToggle” is executed.

ElementOperator

This is used to add/remove elements.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementOperator"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementOperator"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="elements" type="table">
            <entry index="1" type="number" value="ELEMENT ID"/>
        </entry>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="operation" type="string" value="remove"/>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

elements: The id's in this table are the elements that will get removed/added.

operation: This is the operation it will use for elements. Can be “add” or “remove”.

ElementLogicChance

This is used for adding a % of chance for something to happen.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementLogicChance"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementLogicChance"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="chance" type="number" value="10"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
            <entry index="1" type="table">
                <entry key="delay" type="number" value="0"/>
                <entry key="id" type="number" value="ELEMENT ID"/>
            </entry>
        </entry>
        <entry key="position" type="vector3" value="2000 1200 4100"/>
        <entry key="rotation" type="quaternion" value="0 0 0 -1"/>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

chance: The amount of chance for everything in on_executed to execute. Can be 0-100.

ElementLogicChanceTrigger

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementLogicChanceTrigger"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementLogicChance"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="elements" type="table">
            <entry index="1" type="number" value="ELEMENT ID"/>
        </entry>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
            <entry index="1" type="table">
                <entry key="delay" type="number" value="0"/>
                <entry key="id" type="number" value="ELEMENT ID"/>
            </entry>
        </entry>
        <entry key="outcome" type="string" value="fail"/>
        <entry key="position" type="vector3" value="1900 1200 4100"/>
        <entry key="rotation" type="quaternion" value="0 0 0 -1"/>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

elements: The element id's in this table are the ElementLogicChance elements that this element should trigger from.

outcome: The outcome of the ElementLogicChance element that this element will trigger from. Can be “fail” or “success”.

ElementLogicChanceOperator

This is used for adding/subtracting or setting/resetting the ElementLogicChance element.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementLogicChanceOperator"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementLogicChance"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="chance" type="number" value="5"/>
        <entry key="elements" type="table">
            <entry index="1" type="number" value="ELEMENT ID"/>
        </entry>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="operation" type="string" value="add_chance"/>
        <entry key="position" type="vector3" value="1900 1100 4100"/>
        <entry key="rotation" type="quaternion" value="0 0 0 -1"/>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

elements: The element id's in this table are the ElementLogicChance elements that this element should add/subtract to or set/reset.

chance: How much chance it should add/subtract or set for the ElementLogicChance.

operation: What kind of operation it should do for the ElementLogicChance elements. Can be “add_chance”, “subtract_chance”, “reset” and “set_chance”.

ElementFilter

This is used for having different things happen between difficulties and such.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementFilter"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="difficulty_easy" type="boolean" value="true"/>
        <entry key="difficulty_hard" type="boolean" value="true"/>
        <entry key="difficulty_normal" type="boolean" value="true"/>
        <entry key="difficulty_overkill" type="boolean" value="false"/>
        <entry key="difficulty_overkill_145" type="boolean" value="false"/>
        <entry key="difficulty_overkill_290" type="boolean" value="false"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="true"/>
        <entry key="mode_assault" type="boolean" value="true"/>
        <entry key="mode_control" type="boolean" value="true"/>
        <entry key="on_executed" type="table">
            <entry index="1" type="table">
                <entry key="delay" type="number" value="0"/>
                <entry key="id" type="number" value="ELEMENT ID"/>
            </entry>
        </entry>
        <entry key="platform_ps3" type="boolean" value="true"/>
        <entry key="platform_win32" type="boolean" value="true"/>
        <entry key="player_1" type="boolean" value="true"/>
        <entry key="player_2" type="boolean" value="true"/>
        <entry key="player_3" type="boolean" value="true"/>
        <entry key="player_4" type="boolean" value="true"/>
        <entry key="position" type="vector3" value="-724 -3475 1000"/>
        <entry key="rotation" type="quaternion" value="0 0 0 -1"/>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

If all requirements are met it will execute everything in “on_executed”.

Having difficulty_overkill_290 as false means that it won't execute if the difficulty is DeathWish.

ElementRandom

This is used to randomly pick which elements should be executed in the on_executed table.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementRandom"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementRandom"/>
    <entry key="values" type="table">
        <entry key="amount" type="number" value="1"/>
        <entry key="amount_random" type="number" value="0"/>
        <entry key="base_delay" type="number" value="0"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="ignore_disabled" type="boolean" value="true"/>
        <entry key="on_executed" type="table">
            <entry index="1" type="table">
                <entry key="delay" type="number" value="0"/>
                <entry key="id" type="number" value="ELEMENT ID"/>
            </entry>
            <entry index="2" type="table">
                <entry key="delay" type="number" value="0"/>
                <entry key="id" type="number" value="ELEMENT ID"/>
            </entry>
        </entry>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

amount: how many elements should be executed.

amount_random: I haven't used this but I'm pretty sure that if you put it as 4 it will randomly pick an amount between 1-4.

ElementAreaTrigger

This is used to check for units or the player entering a defined area.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementAreaTrigger"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementArea"/>
    <entry key="values" type="table">
        <entry key="amount" type="string" value="1"/>
        <entry key="base_delay" type="number" value="0"/>
        <entry key="depth" type="number" value="380"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="height" type="number" value="300"/>
        <entry key="instigator" type="string" value="player"/>
        <entry key="interval" type="number" value="0.1"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="position" type="vector3" value="-2724 6400 5275"/>
        <entry key="radius" type="number" value="250"/>
        <entry key="rotation" type="quaternion" value="0 0 1 -4.37114e-008"/>
        <entry key="shape_type" type="string" value="box"/>
        <entry key="spawn_unit_elements" type="table">
        </entry>
        <entry key="trigger_on" type="string" value="on_enter"/>
        <entry key="trigger_times" type="number" value="0"/>
        <entry key="use_disabled_shapes" type="boolean" value="false"/>
        <entry key="width" type="number" value="250"/>
    </entry>
</entry>

amount: The amount that needs to be within the area for it to execute. Can be set to all to check for all players.

depth: The depth of the area.

height: The height of the area.

instigator: What type of unit that the area should check for. Can be player, vehicle, npc_vehicle(spooky), vehicle_with_players, enemies, civilians, escorts, hostages, ai_teammates, loot or unique_loot.

interval: How often the area should check if the instigator is inside it.

radius: The radius of the area.

shape_type: What shape the area should be. Can be box or cylinder.

spawn_unit_elements: I haven't seen this used. But I think it has something to do with setting a certain unit as the instigator.

trigger_on: When the area should execute everything in the on_executed table. Can be on_enter, on_exit, both or while_inside. Having it as both will make it trigger on both enter and exit.

use_disabled_shapes: Seems to be old and unused?

width: The width of the area.

Advanced mission elements

ElementCounter

Counters are used to count how many times a certain thing has happened.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementCounter"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementCounter"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="counter_target" type="number" value="2"/>
        <entry key="digital_gui_unit_ids" type="table">
        </entry>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

counter_target: This is how many times the counter needs to be executed before it will execute everything in the on_executed table. I prefer to set the counter_target to 0 then use ElementCounterOperator and ElementCounterTrigger to set the value and have it trigger at a certain value.

digital_gui_unit_ids: With this you can make a digital gui display the counter value.

ElementCounterOperator

This is used to add, subtract or set a ElementCounter to a certain value.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementCounterOperator"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementCounter"/>
    <entry key="values" type="table">
        <entry key="amount" type="number" value="4"/>
        <entry key="base_delay" type="number" value="0"/>
        <entry key="elements" type="table">
            <entry index="1" type="number" value="ELEMENT ID"/> <!-- this should be the element id of the counter -->
        </entry>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="operation" type="string" value="set"/>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

amount: This is the amount that the ElementCounterOperator should add, subtract or set to the counter.

operation: This is which operation it should use. Can be add, subtract, set or reset.

ElementCounterTrigger

This is used to check if a ElementCounter value is the same as amount.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementCounterTrigger"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementCounter"/>
    <entry key="values" type="table">
        <entry key="amount" type="number" value="5"/>
        <entry key="base_delay" type="number" value="0"/>
        <entry key="elements" type="table">
            <entry index="1" type="number" value="ELEMENT ID"/> <!-- this should be the element id of the counter -->
        </entry>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="trigger_times" type="number" value="0"/>
        <entry key="trigger_type" type="string" value="value"/>
    </entry>
</entry>

amount: When the ElementCounter value is the same as amount it will execute everything in the on_executed table.

trigger_type: I think you can use this to check if a certain operation has been done to the ElementCounter. Can be: none, value, add, subtract, reset and set.

ElementCounterFilter

This is used to check if value is equal, less or equal, greater or equal, less than or greater than the ElementCounter value.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementCounterFilter"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementCounter"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="check_type" type="string" value="equal"/>
        <entry key="elements" type="table">
            <entry index="1" type="number" value="ELEMENT ID"/>
            <entry index="2" type="number" value="ELEMENT ID"/>
        </entry>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="needed_to_execute" type="string" value="all"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="trigger_times" type="number" value="0"/>
        <entry key="value" type="number" value="2"/>
    </entry>
</entry>

check_type: Can be equal, less_or_equal, greater_or_equal, less_than or greater_than.

elements: These are the ElementCounters it will check with.

needed_to_execute: Can be counters_equal, counters_not_equal, all or any. all means that the check_type and value needs to work with every ElementCounter for ElementCounterFilter to execute. any means that any ElementCounter can work with the check_type and value for ElementCounterFilter to execute.

Enemies

ElementSpawnEnemyDummy

This is used for spawning enemies.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementSpawnEnemyDummy"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="values" type="table">
        <entry key="accessibility" type="string" value="any"/>
        <entry key="amount" type="number" value="0"/>
        <entry key="base_delay" type="number" value="0"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="enemy" type="string" value="units/payday2/characters/ene_swat_1/ene_swat_1"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="force_pickup" type="string" value="none"/>
        <entry key="interval" type="number" value="5"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="participate_to_group_ai" type="boolean" value="true"/>
        <entry key="position" type="vector3" value="2694 -1214 -225"/>
        <entry key="rotation" type="quaternion" value="0 0 0 -1"/>
        <entry key="spawn_action" type="string" value="none"/>
        <entry key="team" type="string" value="default"/>
        <entry key="trigger_times" type="number" value="0"/>
        <entry key="voice" type="number" value="0"/>
    </entry>
</entry>

accessibility: I'm not sure what this does, but I haven't seen it put as anything else but “any”

interval: This is how often the element can spawn an enemy.

participate_to_group_ai: If this is set to true the enemy will fall back when assault ends and follow the group.

spawn_action: This is used for making an enemy do an animation as he spawns, if you for example put “e_sp_down_16m_left” here the enemy will repel down when he spawns.

team: This is which team he is on, “default” will try to kill you “neutral1” will not.

ElementSpawnEnemyGroup

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementSpawnEnemyGroup"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="values" type="table">
        <entry key="amount" type="number" value="0"/>
        <entry key="base_delay" type="number" value="0"/>
        <entry key="elements" type="table">
            <entry index="1" type="number" value="ELEMENT ID"/>
        </entry>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="ignore_disabled" type="boolean" value="true"/>
        <entry key="interval" type="number" value="0"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="preferred_spawn_groups" type="table">
            <entry index="1" type="string" value="CS_shields"/>
            <entry index="2" type="string" value="CS_defend_c"/>
            <entry index="3" type="string" value="FBI_stealth_a"/>
            <entry index="4" type="string" value="FBI_defend_a"/>
            <entry index="5" type="string" value="CS_cops"/>
            <entry index="6" type="string" value="CS_tazers"/>
            <entry index="7" type="string" value="FBI_stealth_b"/>
            <entry index="8" type="string" value="CS_defend_b"/>
            <entry index="9" type="string" value="FBI_shields"/>
            <entry index="10" type="string" value="CS_tanks"/>
            <entry index="11" type="string" value="FBI_defend_d"/>
            <entry index="12" type="string" value="CS_defend_a"/>
            <entry index="13" type="string" value="CS_swats"/>
            <entry index="14" type="string" value="FBI_defend_c"/>
            <entry index="15" type="string" value="CS_stealth_a"/>
            <entry index="16" type="string" value="FBI_swats"/>
            <entry index="17" type="string" value="FBI_tanks"/>
            <entry index="18" type="string" value="FBI_heavys"/>
            <entry index="19" type="string" value="FBI_spoocs"/>
            <entry index="20" type="string" value="FBI_defend_b"/>
            <entry index="21" type="string" value="CS_heavys"/>
        </entry>
        <entry key="spawn_type" type="string" value="ordered"/>
        <entry key="team" type="string" value="default"/>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

elements: These are the id's that the group will spawn from.

ignore_disabled: If set to true it will ignore the ElementSpawnEnemyDummy elements that are disabled. As in it won't spawn anything on those points.

interval: How often the group can spawn.

Preferred_spawn_groups: These are the groups that can spawn if ElementEnemyPreferedAdd is using this group to spawn units. If you use ElementEnemyPreferedAdd to spawn units it will override the enemy in ElementSpawnEnemyDummy.

spawn_type: This can be set to ordered to spawn from being executed or using ElementEnemyPreferedAdd. It can also be set to random or group.

ElementEnemyPreferedAdd

This is used to let the game spawn units whenever it wants. It is required to have for smooth combat.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementEnemyPreferedAdd"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="spawn_groups" type="table">
            <entry index="1" type="number" value="ELEMENT ID"/>
        </entry>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

spawn_groups: These are the id's of the ElementSpawnEnemyGroup elements that this element will spawn units from. The type of groups that this element can spawn is decided by preferred_spawn_groups in ElementSpawnEnemyGroup.

ElementAiGlobalEvent

This is used to start certain AI events or setting the wave mode to a certain type.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementAiGlobalEvent"/>
    <entry key="editor_name" type="string" value="ElEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="values" type="table">
        <entry key="AI_event" type="string" value="police_called"/>
        <entry key="base_delay" type="number" value="0"/>
        <entry key="blame" type="string" value="empty"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="position" type="vector3" value="-100 100 4102.5"/>
        <entry key="rotation" type="quaternion" value="0 0 0 -1"/>
        <entry key="trigger_times" type="number" value="0"/>
        <entry key="wave_mode" type="string" value="besiege"/>
    </entry>
</entry>

AI_event: This can be used to start the alarm. Possible events are: “police_called”, “police_weapons_hot”, “gangsters_called” and “gangster_weapons_hot”. You can also remove AI_event to just make it do wave_mode.

blame: This is what the alarm will blame it on if you use “police_called” in AI_event. Possible blames are: “none”, “empty”, “cop”, “gangster”, “civilian”, “metal_detector”, “security_camera”, “civilian_alarm”, “cop_alarm”, “gangster_alarm”, “motion_sensor”, “glass_alarm”, “blackmailer”, “gensec”, “police_alerted” and “csgo_gunfire”.

wave_mode: This is what type of assault/wave mode the enemies should get. “besiege” is the usual assault. “hunt” is the never ending assault. There is also “assault”, “blockade”, “quiet” and “passive” but I have never seen them used.

ElementGlobalEventTrigger

This element will execute when the global_event happens, it is used for timing elements together with events happening in-game.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementGlobalEventTrigger"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="module" type="string" value="CoreElementGlobalEventTrigger"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="global_event" type="string" value="end_assault"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="position" type="vector3" value="-300 -800 4100"/>
        <entry key="rotation" type="quaternion" value="0 0 0 -1"/>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

global_event: When the event you put here happens this element will execute. Possible events are: “bankmanager_key”,

       keycard,
       start_assault,
       end_assault,
       police_called,
       police_weapons_hot,
       civilian_killed,
       loot_lost,
       loot_exploded,
       pku_gold,
       pku_money,
       pku_jewelry,
       pku_painting,
       pku_meth,
       pku_cocaine,
       pku_weapons,
       pku_toolbag,
       pku_atm,
       pku_folder,
       pku_poster,
       pku_artifact_statue,
       pku_server,
       pku_samurai,
       bar_code,
       equipment_evidence_lost,
       pku_sandwich,
       equipment_sandwich,
       hotel_room_key,
       pku_evidence_bag,
       ecm_jammer_on,
       ecm_jammer_off,
       pku_warhead,
       enemy_killed,
       pku_rambo,
       player_damaged

ElementDifficulty

This is used to set the difficulty of the AI, it changes what types(or how many?) of enemies spawn when using ElementPreferedAdd to spawn enemies.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementDifficulty"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="difficulty" type="number" value="0.75"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="position" type="vector3" value="-300 -1200 4100"/>
        <entry key="rotation" type="quaternion" value="0 0 0 -1"/>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

difficulty: This sets the difficulty, can be set between 0-1.

ElementSpecialObjective

This is used to make characters do certain animations or move to certain positions, it's also used for making characters do a certain animation between two navigation areas.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementSpecialObjective"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="values" type="table">
        <entry key="SO_access" type="string" value="245760"/>
        <entry key="action_duration_max" type="number" value="0"/>
        <entry key="action_duration_min" type="number" value="0"/>
        <entry key="ai_group" type="string" value="enemies"/>
        <entry key="align_position" type="boolean" value="true"/>
        <entry key="align_rotation" type="boolean" value="true"/>
        <entry key="attitude" type="string" value="avoid"/>
        <entry key="base_chance" type="number" value="1"/>
        <entry key="base_delay" type="number" value="0"/>
        <entry key="chance_inc" type="number" value="0"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="forced" type="boolean" value="true"/>
        <entry key="interaction_voice" type="string" value="none"/>
        <entry key="interrupt_dis" type="number" value="0"/>
        <entry key="interrupt_dmg" type="number" value="1"/>
        <entry key="interval" type="number" value="-1"/>
        <entry key="is_navigation_link" type="boolean" value="false"/>
        <entry key="needs_pos_rsrv" type="boolean" value="false"/>
        <entry key="no_arrest" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="path_haste" type="string" value="walk"/>
        <entry key="path_stance" type="string" value="ntl"/>
        <entry key="path_style" type="string" value="destination"/>
        <entry key="patrol_path" type="string" value="none"/>
        <entry key="pose" type="string" value="stand"/>
        <entry key="position" type="vector3" value="-2161 5801 -495"/>
        <entry key="repeatable" type="boolean" value="false"/>
        <entry key="rotation" type="quaternion" value="0 0 0.92388 -1.1"/>
        <entry key="scan" type="boolean" value="true"/>
        <entry key="search_distance" type="number" value="0"/>
        <entry key="search_position" type="vector3" value="3400 1400 0"/>
        <entry key="so_action" type="string" value="e_so_sneak_wait_crh"/>
        <entry key="trigger_on" type="string" value="none"/>
        <entry key="spawn_instigator_ids" type="table">
            <entry index="1" type="number" value="ELEMENT ID"/>
        </entry>
        <entry key="trigger_times" type="number" value="0"/>
        <entry key="use_instigator" type="boolean" value="true"/>
    </entry>
</entry>

SO_access: This needs to be a certain value for it to work with different enemies.

action_duration_max: The maximum amount of time the character can spend doing the SO(special objective)

action_duration_min: The minimum amount of time the character can spend doing the SO(special objective)

ai_group: What group the character is in. enemies for any enemy units and AI teammates, civilians for civilians.

align_position: If the character should walk to the position.

align_rotation: If the character should use the rotation.

attitude: What combat attitude the character should have. Either “avoid” or “engage

base_chance: Used to specify chance to happen. 1 is 100% 0 is 0%.

chance_inc: Used to specify an incremental chance to happen. Barely understand it. Rarely used.

forced: If the character is forced to finish the SO. If set to true the character can't get interrupted and stop doing the SO.

interaction_voice: What the player says when interacting with the character: (some of these don't have sound files) “default”,

   cuff_cop,
   down_cop,
   stop_cop,
   escort_keep,
   escort_go,
   escort,
   stop,
   down_stay,
   down,
   bridge_codeword,
   bridge_chair,
   undercover_interrogate

interrupt_dis: Interrupt if a threat is detected closer than this distance. -1 means at any distance. For non-visible threats this value is multiplied with 0.7.

interrupt_dmg: Interrupt if total damage received as a ratio of total health exceeds this ratio. Can be between 0 and 1.

interval: Used to specify how often the SO should search for a character. A negative value means it will check only once.

is_navigation_link: navigation links are used to make the character do an animation as he is moving between two navigation areas. If set to true the SO will use position as the start point and search_position as the end up point.

needs_pos_rsrv: If the SO should need position reserve.

no_arrest: If the character should arrest the player or not?

path_haste: What haste the character should have, can be “walk” or “run”

path_stance: What stance the character should have, can be: “ntl”(neutral),

   hos(hostile),
   cbt(combat)

path_style: What style the character should have, can be: “destination”,

   precise,
   coarse,
   warp

patrol_path: Used for the patrol_path units that were used in PD:TH.

pose: What pose the character should have, can be “crouch” or “stand”.

repeatable: If the SO can happen more than once?

scan: I have no clue what this does, it's usually set to true though.

so_action: What animation the character should do. For example: “e_so_sneak_wait_crh”

trigger_on: What the SO should trigger on, can only be “interact”. Interact is being shouted at or meleed by the player.

spawn_instigator_ids: Which ids the SO should use as its instigators.

use_instigator: If you use a “ElementSpawnEnemyDummy” to execute the SO the “ElementSpawnEnemyDummy” becomes an instigator for the SO. This decides if it should use instigators.

SO_access

The SO_access is a table consisting of multiple characters access that is then converted from a table to a number through the navigationmanager.

You can find the access of any unit in lib/tweak_data/charactertweakdata.lua

Captain Winters and his minions currently don't have any access group, so their SO_access number is 0.

self.swat.access = "swat" 

These are all the access groups that are currently used for units in charactertweakdata: teamAI1 teamAI4 civ_male civ_female cop taser shield spooc tank gangster sniper swat fbi security

To convert the table into a number we need to use a function from navigationmanager.

local character_access = { -- this table needs to contain every access group you want the Special Objective to work for.
    "swat"
}
local create_SO_access = managers.navigation:convert_access_filter_to_string(character_access) -- This converts the table into a number.
log(create_SO_access) -- I made it log what the number is so I can use it

I edited the SpecialObjective so that I can add a table with which groups I want the SO to work for and it will automatically set the SO_access to a number that works.

This is added to the ElementSpecialObjective

<entry key="character_access" type="table">
    <entry index="1" type="string" value="swat"/>
</entry>

This is what I added to ElementSpecialObjective:_finalize_values

if values.character_access then
    local create_SO_access = managers.navigation:convert_access_filter_to_string(values.character_access)
    values.SO_access = create_SO_access
end

Player

ElementPlayerSpawner

Spawns the player. Needs to be executed on startup.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementPlayerSpawner"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="position" type="vector3" value="-2610 7025 5200"/>
        <entry key="rotation" type="quaternion" value="0 0 1 -4.37114e-008"/>
        <entry key="state" type="string" value="standard"/>
        <entry key="trigger_times" type="number" value="0"/>
    </entry>
</entry>

state: What player state the player should start in. mask_off for unmasked, standard for masked.

ElementPlayerState

Sets the player to a certain state.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementPlayerState"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="position" type="vector3" value="500 600 575"/>
        <entry key="rotation" type="quaternion" value="0 0 0 -1"/>
        <entry key="state" type="string" value="jerry1"/>
        <entry key="trigger_times" type="number" value="0"/>
        <entry key="use_instigator" type="boolean" value="false"/>
    </entry>
</entry>

state: What state the player should be set to. Can be standard, mask_off, bleed_out, fatal, arrested, tased, incapacitated, clean, civilian, carry(might turn out broken), bipod(might turn out broken), driving(might turn out broken), jerry1(freefall) and jerry2(parachuting)

ElementPlayerStateTrigger

This will execute when the player enters the defined state.

<entry index="ID" type="table">
    <entry key="class" type="string" value="ElementPlayerStateTrigger"/>
    <entry key="editor_name" type="string" value="ELEMENT NAME"/>
    <entry key="id" type="number" value="ELEMENT ID"/>
    <entry key="values" type="table">
        <entry key="base_delay" type="number" value="0"/>
        <entry key="enabled" type="boolean" value="true"/>
        <entry key="execute_on_startup" type="boolean" value="false"/>
        <entry key="on_executed" type="table">
        </entry>
        <entry key="position" type="vector3" value="-50 50 575"/>
        <entry key="rotation" type="quaternion" value="0 0 0 -1"/>
        <entry key="state" type="string" value="mask_off"/>
        <entry key="trigger_times" type="number" value="1"/>
    </entry>
</entry>

state: When the player enters this state it will execute everything in the on_executed table.