Hi,
I was thinking of bypassing the config issues, and add a little script to the player unit to check several things.
With this solution it's possible now to have addon vehicles included.
Thanks to Mandoble for some good ideas.
I am not sure about sleep values or more if-loops to check certain things like height, speed.
Mandoble also made a suggestion to limit the ILS only to pilot class or make it adjustable by the mission maker by placing a logic (init: OFPEC_ILS_ENABLE = true) or something like that.
// OPFEC ILS MOD v1.3
// Runs on startup and checks if player is:
// - in an air vehicle
// - has engine started
// - higher than 5 meters (?)
// - moving (by speed check) (?)
private ["_OFPECpilot","_OFPECvehicle","_ofpec_ils_idx"];
_OFPECpilot = _this select 0;
// while player is alive do
while {(alive _OFPECpilot)} do
{
// find vehicle the player is in
_OFPECvehicle = assignedVehicle _OFPECpilot;
sleep .5;
_OFPECpilot sideChat format["%1",_OFPECvehicle]; // debug
// check if given vehicle is a helicopter or a plane
if ((_OFPECvehicle isKindOf "Helicopter") || (_OFPECvehicle isKindOf "Plane")) then
{
//check if driver of given vehicle is player
if (driver _OFPECvehicle == _OFPECpilot) then
{
// check if vehicle is flying (engine is on) and is in the air
if (isEngineOn _OFPECvehicle) then
{
// add the action (test script)
_ofpec_ils_idx = _OFPECvehicle addAction ["ILS", "ils.sqf"];
// code to check if player still alive or vehicle alive
[_OFPECpilot]spawn
{
sleep 1;
(_this select 0) sideChat "ILS system enabled";
};
waitUntil {((driver _OFPECvehicle != _OFPECpilot) || (!alive _OFPECvehicle))};
sleep .5;
_OFPECvehicle removeAction _ofpec_ils_idx;
};
};
};
};
Please give some suggestion and ideas or code improvement.
I was thinking of increasing the FIRST "sleep .5" value, as in my opinion it would take at least more than 0.5 sec to start the engine of the vehicle and get ready for flight.
ISSUE WITH DOUBLING THE ACTION ENTRY
Please see the ofpec_ils.sqf.
I added:
OFPEC_ILS = _vehicle addAction ["ILS", "OFPEC_ILS\s\ofpec_open_airfieldselector.sqf"]
So when the script is running the Action has the index OFPEC_ILS.
If the player gets out the action from the OFPEC_ILS_INIT.sqf with index _ofpec_ils_idx is deleted but not found.
Therefore the action is doubled when the player reenters the vehicle.
So far, merry x mas to ofpec !
regards
rocko