Custom Variables

  1. 8 years ago

    I'd like to push the ACE Vehicle Cargo as a Custom Variable in my ALiVE missions to keep things like ammo crates and spare wheels persistent. I'm wondering how I would go about this, I understand how to use the function my concern is more where / when do I have it execute?

  2. Sorry I can't help you on this (I'm sure someone will pretty quickly), but if you're THE OHally, I'm a big fan of your CAF Aggressors mod. :)

  3. Edited 8 years ago by SpyderBlack723

    Where you execute it is fully up to you. To store vehicle cargo you could have a global array that contains nested arrays of [vehicleid,ace_vehicle_cargo]. Maybe you store each entry to thr global array everytime a player exits a vehicle.

    To save this variable, you could run ["myAwesomeVehicleData", myglobalarray] call alive_fnc_setData.

    To load the data after a restart, you could have a check in the server's init sqf that checks if ["myAwesomeVehicleData] call alive_fnc_setData
    Returns a non-nil variable and if so, start restoring the data.

    The difficult part is keeping track of each vehicle since their object id's might change over restart -- I believe sys_data keeps a persistent ID for all vehicles but that's beyond my exploration.

    Sucky explanation but hopefully it spurs some inspiration.

    And just a general explanation for anyone who's never used these functions before.

    Think of _fnc_setdata as
    missionNamespace setVariable ["key", var]
    And _fnc_getdata as
    missionNamespace getVariable "key"

    Except each key - value pair can be persisted

 

or Sign Up to reply!