Home   Help Search Login Register  

Author Topic: !!Aircraft smoke trail script help!!  (Read 5830 times)

0 Members and 1 Guest are viewing this topic.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: !!Aircraft smoke trail script help!!
« Reply #15 on: 19 Jun 2007, 00:19:24 »
Ok, try passing variables to the vehicles.

Run the following script in the init.sqs
Code: [Select]
// mando_vehvars.sqf
private ["_vehicle"];

mando_vehvar_vehiclew = objNull;
mando_vehvar_requestw = false;
mando_vehvar_valuew = 0;
mando_vehvar_w = "";

mando_vehvar_vehicler = objNull;
mando_vehvar_requestr = false;
mando_vehvar_r = "";

while {true} do
{
   waitUntil {mando_vehvar_requestw || mando_vehvar_requestr};
   if (mando_vehvar_requestw) then
   { 
      mando_vehvar_requestw = false;
      _vehicle = mando_vehvar_vehiclew;
      mando_vehvar_vehiclew setVariable [mando_vehvar_W, mando_vehvar_valuew];
   };

   if (mando_vehvar_requestr) then
   {   
      mando_vehvar_requestr = false;
      _vehicle = mando_vehvar_vehicler;
      if (local server) then
      {
         mando_vehvar_vehiclew = _vehicle;
         mando_vehvar_valuew = _vehicle getVariable mando_vehvar_r;
         if (!isNil "mando_vehvar_valuew") then
         {
            mando_vehvar_w = mando_vehvar_r;
            mando_vehvar_requestw = true;
            {publicVariable _x} forEach ["mando_vehvar_vehiclew", "mando_vehvar_w", "mando_vehvar_valuew", "mando_vehvar_requestw"];
         };
      };
   };
};


Then to write and publish a variable, for example skomeonoff set to true:
Code: [Select]
      mando_vehvar_vehiclew = _plane;
      mando_vehvar_w = "skomeonoff";
      mando_vehvar_valuew = true;
      mando_vehvar_requestw = true;
      {publicVariable _x} forEach ["mando_vehvar_vehiclew", "mando_vehvar_w", "mando_vehvar_valuew", "mando_vehvar_requestw"];
      Sleep 0.5;

Then you have a script running per each vehicle and you pass the name of the vehicle as argument:

Code: [Select]
// SmokeControl
_plane = _this select 0;

mando_vehvar_vehicler = _plane;
mando_vehvar_r = "skomeonoff";
mando_vehvar_requestr = true;
{publicVariable _x} forEach ["mando_vehvar_vehicler", "mando_vehvar_r", "mando_vehvar_requestr"];

_var = _plane getVariable "skomeonoff";
if (isNil "_var") then
{
   mando_vehvar_vehiclew = _plane;
   mando_vehvar_w = "skomeonoff";
   mando_vehvar_valuew = false;
   mando_vehvar_requestw = true;
   {publicVariable _x} forEach ["mando_vehvar_vehiclew", "mando_vehvar_w", "mando_vehvar_valuew", "mando_vehvar_requestw"];
   Sleep 0.5;
};   
Sleep 1;
_var = _plane getVariable "skomeonoff";
while {true} do
{
   while {!(_plane getVariable "skomeonoff")} do
   {
      Sleep 1;
   };

   // Create the smoke and light with createVehicleLocal
 
   // The smoke is "alive" while next while is true
   while {(_plane getVariable "skomeonoff")} do
   {
      Sleep 1;   
   };

   // Delete particle and light vehicles here

};
« Last Edit: 19 Jun 2007, 00:36:57 by Mandoble »