How to make a "Kill HVT" Task persistent with Editor placed unit as target

  1. 5 years ago

    Hi Devs & ALiVE Wiseguys,

    I tried invain to save & retrieve a custom variable in the way the WIKI shows it. I use local saving from testing the mission in SP Editor mode. First I've built a classic BIS task with the modules and have a trigger which, upon the death of my Editor placed HVT (trigger condition: !alive hvt_1), sets the task as succeeded and sets the variable killed_hvt_1 to true. And also deletes him, to be sure: deleteVehicle hvt_1.

    Ingame, I see the task as succeeded and the body vanishes.

    Then I type this into the console:

    ["killed_hvt_1",_true] call ALiVE_fnc_ProfileNameSpaceSave;

    The mission's init.sqf has this code:

    _true = "killed_hvt_1" call ALiVE_fnc_ProfileNameSpaceLoad;
     
    if (isnil "_killed_hvt_1" || {!_true}) then {
        // start script
        ["killed_hvt_1", true] call ALiVE_fnc_ProfileNameSpaceSave;
    };

    Upon loading the persistent save, the usual stuff like markers or player position& health, ammo etc. are restored correctly. But the wretched HVT has returned from the dead!

    How can I save that kind of task state as custom variable?

    THX in advance for any insights/ help!

  2. I think something like this help you.

    killed_hvt_1 = "killed_hvt_1" call ALiVE_fnc_ProfileNameSpaceLoad;
     
    if !(isnil "killed_hvt_1") then {
        
    hvt_1 setdamage 1;    
    deleteVehicle hvt_1;
    
    };
    

    Variable dont knows what you refer when you save it with killed_hvt_1. You must define at mission start what to do if is true or false. In example if variable is defined as true, it kills hvt and deletebody at mission start. Your task module set task to succeeded when check if hvt_1 is alive.

  3. Hi Sanchez & THX for your suggestion. Unfortunately if I put your code into init.sqf and set the task to "succeeded" by linking a task state module (set to "succeeded") with a trigger whose

    CONDITION is

    !alive hvt_1

    and whose

    ONACTIVATION result is

    killed_hvt_1=true

    Maybe I was still to stupid to understand when & from where to call the code you posted? Was init.sqf wrong?

    The task completes immediately upon starting the mission. OFC I did rename the PBO and thus started a fresh ALIVE session for trying your code in order to avoid conflicts with the older ALIVE savegame made with a different "Life Hack/McGyvver/Duct Tape Style" of saving the killing event.

    BTW, here I'm going to post this primitive way of checking for the kill - just in case. It's simply utilizing the fact that ALIVE saves always the player's inventory. Heros Survive has a skull that isn't a map prop but an inventory item. So I reflected the RL practice of proving a kill by showing a severed body part of the target to the superior officer/person who set out the bounty and placed a group of triggers which does the following:

    1) Place target person & name him "hvt_1"

    2) Place a BIS task module and then place a BIS task state module set to "succeeded" & synced it to the task module.

    3) Sync the task state module to the 5th Trigger of the following setup:

    1st TRIGGER:take_his_head_as_proof

    CONDITION:

    !alive hvt_1;

    ONACTIVATION:

    player addItem "herl_o_Skull";

    2nd TRIGGER:show_head_as_proof

    CONDITION:

    "herl_o_Skull" in items player;

    ONACTIVATION:

    killed_hvt_1=true;

    3nd TRIGGER:kill_him_again_by_showing_him_his_severed_head_so_he_HAS_to_believe_he_is_REALLY_REALLY_DEAD

    CONDITION:

    killed_hvt_1

    ONACTIVATION:

    hvt_1 setdamage 1;

    COUNTDOWN 5-5-5

    4th TRIGGER:bury_him_in_a_shallow_grave

    CONDITION:

    killed_hvt_1

    ONACTIVATION:

    deleteVehicle hvt_1;

    COUNTDOWN 10-10-10

    5th TRIGGER:report_your_torough_your_very_very_very_thorough_and_ultimately_successful_task_completion

    CONDITION:

    killed_hvt_1

    ONACTIVATION:

    nothing stated; 5th Trigger is synced to a BIS Task State Module that is set to "succeeded"

    Tested with local saving & WORKS! after loading the save, playing some more, saving again, quitting game, starting game, loading ALIVE save.

    Anyway, THX for your help so far & hopefully you can give me some more directions

 

or Sign Up to reply!