Home   Help Search Login Register  

Advertisement

Author Topic: OFPEC ILS as addon  (Read 4666 times)

0 Members and 1 Guest are viewing this topic.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
OFPEC ILS as addon
« on: 22 Dec 2007, 21:00:58 »
Following the original script resource, we'll start here a project with Rocko for addon conversion and testing of OFPEC ILS.

Offline rocko

  • Members
  • *
Re: OFPEC ILS as addon
« Reply #1 on: 22 Dec 2007, 22:37:58 »
Hi,

according to Mandobles last PM in the BIS forums I hereby supply the converted version of the OFPEC ILS script as is (current status).

Please see attechment for file. Due to distributing misuse the file is passworded. Password is sent to all authors involved with the script.
Until you decide to unlock the file and host yourself for testing purposes.

Current status of mod resource:

 - Utilises original script 1:1 plus minor changes in renaming some variables to match specific needs
 - Utilises "Extended Init Eventhanlder"

All changes are well documentated in the various scripts as well.
Config.cpp has a neutral look now.

According to OFPEC needs to be free of third party addons such as EXTENDED INIT EVENTHANDLER, complete rework of config.cpp is needed and is provided herein until tomorrow(~).

Further description of what has been done to get the mod working under realistic aspects and possible engine limitations.

As was before conversion:
 - script is activated by addAction
 -- possible access of action by just standing outside the assigned vehicle

After conversion:
 - added "GetIn" eventhandler to start script only when player enters specific vehicle, using "Extended Init Eventhandler"-method
 -- only executed for pilot (DRIVER slot), as it makes no sense for CARGO or GUNNER slots to access the action.
 - removed initial hint message

I am going to rewrite config.cpp to match above requirements and supply new version asap.

regards
rocko

« Last Edit: 22 Dec 2007, 22:58:18 by rocko »

Offline rocko

  • Members
  • *
Re: OFPEC ILS as addon
« Reply #2 on: 23 Dec 2007, 09:32:33 »
Hi,

I messed around with the config. Version 1.1 contains just a new config.
I got rid of the Extended Eventhandler Addon.

CHANGEs:
 - removed dependecy from "Extended Init Eventhandler"
 - using base class definitions
 - using getin eventhandler for base class definitions (Helicopter & Plane)
 - works for every air vehicle in vanilla arma
- possible addition: using getout eventhandler to remove action from vehicle, as this was roughly scripted by me in the initial version.
    but since I haven't checked the script enough how certain actions are added this is minor priority.


BUGs:
 - does not work for addon air vehicles
 - in planes where you can switch seats the action is gone when you switch to passenger seat and back again to pilot seat (goes for DC3)

Unfortunately I am not able to update base classes of addon vehicles such as RHS Hind or MAP AH 64.
Dunno where the problem is.

Right now, the "Extended Init Eventhandler" method seems most suitable until every air vehicle can be equipped.

File is attached and passworded again (same password I handed out).

I also tried attaching new class Useraction to the vehicles but it seems, you just can add this to known classes like AH1W, UH60MG, KA50 and not to the upper class Helicopter. This would fix the issue with changing seats in planes/helicopters.
This again would exclude addon vehicles.

Anyway, two solutions are given now which can be tested and discussed.

regards
rocko

 
« Last Edit: 23 Dec 2007, 15:18:08 by rocko »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: OFPEC ILS as addon
« Reply #3 on: 23 Dec 2007, 14:54:38 »
Try this way for the getin.

Code: [Select]
private ["_ofpec_ils_idx", "_OFPECair", "_OFPECpos", "_OFPECpilot"];
//execute on get in action of player
_OFPECair = _this select 0;
_OFPECpos = _this select 1;
_OFPECpilot = _this select 2;

if ((_OFPECair isKindOf "ParachuteBase") || (!isPlayer _OFPECpilot)) exitWith{};


// NOT SURE ABOUT THIS WITH GETIN EH
if (!local _OFPECpilot) exitWith{};


while {(_OFPECpilot in _OFPECair) && (alive _OFPECair)} do
{
   if (driver _OFPECair == _OFPECpilot) then
   {
      _ofpec_ils_idx = _OFPECair addAction ["ILS", "OFPEC_ILS\s\ofpec_open_airfieldselector.sqf"];
      [_OFPECpilot]spawn
      {
         sleep 1;
         (_this select 0) vehicleChat "ILS system enabled";
      };
      waitUntil {(driver _OFPECair != _OFPECpilot) || (!alive _OFPECair)};
      sleep .5;
      _OFPECair removeAction _ofpec_ils_idx;
   };
   Sleep 2;
};

Offline rocko

  • Members
  • *
Re: OFPEC ILS as addon
« Reply #4 on: 23 Dec 2007, 16:18:38 »
Just tested demo mission of the ILS script.

I see no complications with missions which already have the script enabled and the use of the addon version.

Only the double action entry.

Mandoble:
Replaced my code with yours, and tested the demo, with empty A10 on ground.
When you get in you see two actions ("Call ILS" < from the script & "ILS" < from addon version).

With your version the actions are added per call of the addon version. For each getin one action is added from the addon but not deleted on get out.

Replaced again with my code, and the added action from addon version is deleted properly.
Maybe I just copy & pasted wrong - but will check again.

For now it seems the action is not deleted.
Please check the script "ofpec_ils.sqf" from the addon version. I changed the addAction with a global var, called OFPEC_ILS.
This is removed in the "OFPEC_ILS_INIT.sqf" and also added by the same var name.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: OFPEC ILS as addon
« Reply #5 on: 23 Dec 2007, 16:21:14 »
The action should be removed when
Code: [Select]
      waitUntil {(driver _OFPECair != _OFPECpilot) || (!alive _OFPECair)};
      sleep .5;
      _OFPECair removeAction _ofpec_ils_idx;

The driver is not the original unit or the vehicle is destroyed.

Offline rocko

  • Members
  • *
Re: OFPEC ILS as addon
« Reply #6 on: 24 Dec 2007, 03:15:42 »
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.


Code: [Select]
// 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:
Code: [Select]
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


Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: OFPEC ILS as addon
« Reply #7 on: 24 Dec 2007, 14:58:39 »
This version works with the initialization of a GL, it is tested and works quite well running on dedi server and with JIP players. Check GL init field.

Offline rocko

  • Members
  • *
Re: OFPEC ILS as addon
« Reply #8 on: 25 Jan 2008, 14:36:47 »
just to inform you.

i have taken up the work on that again.

regards
rocko

Offline maxsword

  • Members
  • *
Re: OFPEC ILS as addon
« Reply #9 on: 08 Feb 2009, 17:08:51 »
Hello Mandoble,

As You know from my previous posts about mando missiles I tried to implement ILS on my aircraft but something wierd happened:

some planes don't show the ILS option in the action menu
some planes have the path circle and square stuck in the middle of hud with the ils cross as well.

How can  fix the problem? (I'm using ACE)

Thanx

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: OFPEC ILS as addon
« Reply #10 on: 08 Feb 2009, 22:16:54 »
Hi maxsword, the ILS thread is this one. Have you tried the demo mission? Is it working for you? How are you adding the ILS to your planes? Can you isolate the problem with a simple mission with one or two planes only? Please, use the above thread to continue as this one is in dead-line.