Home   Help Search Login Register  

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

0 Members and 1 Guest are viewing this topic.

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
!!Aircraft smoke trail script help!!
« on: 16 Jun 2007, 20:06:06 »
Hi this code if for a aircraft smoke trail script im creating but i cant seem to get it working in multiplayer so that other clients can see it also is there a way to create a kinda hadeling script so that once activated its starts the smoke script on all clients so they all can see it.

HOw would i go about doing this?
Code: [Select]
_unit = _this select 0;
_vol = 1.0;
_wei = 1.0;
_lifetime = 20;
_location = [];
_location2 = [];
smoketrail = false;
_act1 = vehicle _Unit AddAction [localize "STR_smokeon","scripts\mp_client\Effects\smokeswitchon.sqf"];
waitUntil {(smoketrail)};
_Unit RemoveAction _act1;
_act2 = vehicle _Unit AddAction [localize "STR_smokeoff","scripts\mp_client\Effects\smokeswitchoff.sqf"];
if(_unit isKindOf  "A10")then{_location = [8,0,1.0];_location2 = [-8,0,1.0];};
if(_unit isKindOf  "Camel")then{_location = [4,3,0.7];_location2 = [-4,3,0.7];};
if(_unit isKindOf  "AV8B2")then{_location = [5,-2,0.0];_location2 = [-5,-2,0.0];};
if(_unit isKindOf  "AV8B")then{_location = [4,0,0.0];_location2 = [-4,0,0.0];};
if(_unit isKindOf  "Camel2")then{_location = [4,3,0.7];_location2 = [-4,3,0.7];};
if(_unit isKindOf  "Su34")then{_location = [7.2,-4,-0.3];_location2 = [-7.2,-4,-0.3];};
if(_unit isKindOf  "Su34B")then{_location = [7.2,-4,-0.3];_location2 = [-7.2,-4,-0.3];};
_partdir = [0,0,1];
_col1 = [random 0.9,random 0.9,random 0.9,0.9]; //Red
_col2 = [random 0.9,random 0.9,random 0.9,0.9]; //Green
_col3 = [random 0.9,random 0.9,random 0.9,0.9]; //Blue
_col4 = [random 0.9,random 0.9,random 0.9,0.9]; //Transparrent
_exhaustlight = "#lightpoint" createVehicle [0,0,0];
_exhaustlight setLightColor [0,0.3,1];
_exhaustlight setLightAmbient [0,0.3,1];
_exhaustlight setLightBrightness 0.00;
_exhaustlight LightAttachObject [_unit,[0,2,1]];
drop ["\ca\data\koulesvetlo","","Billboard",100,4,[10,-2.6,6],[0,0,1],0,1.5,1,0.0,[3,2,0.5,0.05],[_col1,_col2,_col3,_col4],[0],0,0,"","",_unit];

_smoketrail = "#particlesource" createVehicle getPos _unit;
_smoketrail setParticleParams ["\ca\data\missileSmoke","","Billboard",.01,_lifetime,_location,_partdir,0,_wei,_vol,0.05,[1,2.5,3,3.5],[_col1,_col2,_col3,_col4],[0],0,0,"","",_unit];
_smoketrail2 = "#particlesource" createVehicle getPos _unit;
_smoketrail2 setParticleParams ["\ca\data\missileSmoke","","Billboard",.01,_lifetime,_location2,_partdir,0,_wei,_vol,0.05,[1,2.5,3,3.5],[_col1,_col2,_col3,_col4],[0],0,0,"","",_unit];
while {alive _unit} do
{
_smoketrail2 setDropInterval 0.05;
_smoketrail setDropInterval 0.05;

sleep 0.01;
if(not smoketrail)ExitWith
{
vehicle _Unit RemoveAction _act1;
vehicle _Unit RemoveAction _act2;
_smoketrail setDropInterval 1;
_smoketrail2 setDropInterval 1;
deleteVehicle _smoketrail;
deleteVehicle _smoketrail2;
deleteVehicle _exhaustlight;
drop ["\ca\data\koulesvetlo","","Billboard",100,12,[0,-2.6,-1],[0,0,0],0,1.2,1,0.0,[0.05,0.5,2,3],[_col1,_col2,_col3,_col4],[0],0,0,"","",_unit];
    _res= [vehicle _Unit] execVM "scripts\mp_client\Effects\smoketrail.sqf";
};
sleep 0.01;
if((not alive vehicle _unit))ExitWith
{
vehicle _Unit RemoveAction _act1;
vehicle _Unit RemoveAction _act2;
_smoketrail setDropInterval 1;
_smoketrail2 setDropInterval 1;
deleteVehicle _smoketrail;
deleteVehicle _smoketrail2;
deleteVehicle _exhaustlight;
drop ["\ca\data\koulesvetlo","","Billboard",100,12,[0,-2.6,-1],[0,0,0],0,1.2,1,0.0,[0.05,0.5,2,3],[_col1,_col2,_col3,_col4],[0],0,0,"","",_unit];
};
sleep 0.01;
};

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: !!Aircraft smoke trail script help!!
« Reply #1 on: 16 Jun 2007, 20:32:34 »
AFAIK particle effects are not transferred between clients, so you need to make sure to run that script in every client so that everybody can see the effects.

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: !!Aircraft smoke trail script help!!
« Reply #2 on: 16 Jun 2007, 21:31:19 »
yes but how do i do this i have attached the full mission useing this script can soem one take a look at it and tell me what im doign worng as i keep getting stumped with this MP codeing

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: !!Aircraft smoke trail script help!!
« Reply #3 on: 16 Jun 2007, 22:28:04 »
Was about to check, lost all interested seeing a bunch of scripts there and dont even knowing the name of your script or where and how do you execute it.

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: !!Aircraft smoke trail script help!!
« Reply #4 on: 17 Jun 2007, 18:25:39 »
its located @ "UNA(DM28)Gunship.Intro\scripts\mp_client\action\Make_fixedwing.sqf" at the bottom ish but would love it if you could see if the rest are running correctly also.

Any help welcomed as im stumped with JIP codeing all seems to work in the editor

@Mando
Would love if you would look at it for me as i know it would only take a few minits for you as your kinda a sqf God as im a .net man myself and im learning arma code and giving up with other stuff untill i get it nailed.

If you could take a look and maybe note where you changed it so i can learn

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: !!Aircraft smoke trail script help!!
« Reply #5 on: 17 Jun 2007, 19:16:14 »
As said before you need to implement a mechanism to execute your drop effects FOR THE SAME PLANE in every client. In this case the script seems to be smoketrail.sqf. When client A decides to turn smoke on in plane A, you need to transmit that smoke ON for plane A to every client, and in every client there should be a script waiting for that signal to generate the smoke there too for plane A. This way all the players will see the smoke trails of any plane.

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: !!Aircraft smoke trail script help!!
« Reply #6 on: 18 Jun 2007, 02:09:42 »
So if i was to have a script like this that gets the global ver "smokeunit" which would be called from the player creating smoke via action menu smoke as and that would name "smokeunit" as this
Code: [Select]
_unit = _this select 0;
smokeunit = _unit;
then this script would be running on all clients via the init.sqf(I think :>)
Code: [Select]
while {true} do
{
_smokeon = smokeunit;
if(_smokeon != "")then
{
[_smokeon]execVM"smoketrail.sqf"
smokeunit = "";
};
};
would this work?
How would i adapt my smoke trail script as i can work out how to start it by removing all the waituntil commands but how would i stop it running when turn of by the pilot for sky wrighting
Code: [Select]
_unit = _this select 0;
_vol = 1.0;
_wei = 1.0;
_lifetime = 20;
_location = [];
_location2 = [];
smoketrail = false;
_act1 = vehicle _Unit AddAction [localize "STR_smokeon","scripts\mp_client\Effects\smokeswitchon.sqf"];
waitUntil {(smoketrail)};
_Unit RemoveAction _act1;
_act2 = vehicle _Unit AddAction [localize "STR_smokeoff","scripts\mp_client\Effects\smokeswitchoff.sqf"];
if(_unit isKindOf  "A10")then{_location = [8,0,1.0];_location2 = [-8,0,1.0];};
if(_unit isKindOf  "Camel")then{_location = [4,3,0.7];_location2 = [-4,3,0.7];};
if(_unit isKindOf  "AV8B2")then{_location = [5,-2,0.0];_location2 = [-5,-2,0.0];};
if(_unit isKindOf  "AV8B")then{_location = [4,0,0.0];_location2 = [-4,0,0.0];};
if(_unit isKindOf  "Camel2")then{_location = [4,3,0.7];_location2 = [-4,3,0.7];};
if(_unit isKindOf  "Su34")then{_location = [7.2,-4,-0.3];_location2 = [-7.2,-4,-0.3];};
if(_unit isKindOf  "Su34B")then{_location = [7.2,-4,-0.3];_location2 = [-7.2,-4,-0.3];};
_partdir = [0,0,1];
_col1 = [random 0.9,random 0.9,random 0.9,0.9]; //Red
_col2 = [random 0.9,random 0.9,random 0.9,0.9]; //Green
_col3 = [random 0.9,random 0.9,random 0.9,0.9]; //Blue
_col4 = [random 0.9,random 0.9,random 0.9,0.9]; //Transparrent
_exhaustlight = "#lightpoint" createVehicle [0,0,0];
_exhaustlight setLightColor [0,0.3,1];
_exhaustlight setLightAmbient [0,0.3,1];
_exhaustlight setLightBrightness 0.00;
_exhaustlight LightAttachObject [_unit,[0,2,1]];
drop ["\ca\data\koulesvetlo","","Billboard",100,4,[10,-2.6,6],[0,0,1],0,1.5,1,0.0,[3,2,0.5,0.05],[_col1,_col2,_col3,_col4],[0],0,0,"","",_unit];

_smoketrail = "#particlesource" createVehicle getPos _unit;
_smoketrail setParticleParams ["\ca\data\missileSmoke","","Billboard",.01,_lifetime,_location,_partdir,0,_wei,_vol,0.05,[1,2.5,3,3.5],[_col1,_col2,_col3,_col4],[0],0,0,"","",_unit];
_smoketrail2 = "#particlesource" createVehicle getPos _unit;
_smoketrail2 setParticleParams ["\ca\data\missileSmoke","","Billboard",.01,_lifetime,_location2,_partdir,0,_wei,_vol,0.05,[1,2.5,3,3.5],[_col1,_col2,_col3,_col4],[0],0,0,"","",_unit];
while {alive _unit} do
{
_smoketrail2 setDropInterval 0.05;
_smoketrail setDropInterval 0.05;

sleep 0.01;
if(not smoketrail)ExitWith
{
vehicle _Unit RemoveAction _act1;
vehicle _Unit RemoveAction _act2;
_smoketrail setDropInterval 1;
_smoketrail2 setDropInterval 1;
deleteVehicle _smoketrail;
deleteVehicle _smoketrail2;
deleteVehicle _exhaustlight;
drop ["\ca\data\koulesvetlo","","Billboard",100,12,[0,-2.6,-1],[0,0,0],0,1.2,1,0.0,[0.05,0.5,2,3],[_col1,_col2,_col3,_col4],[0],0,0,"","",_unit];
    _res= [vehicle _Unit] execVM "scripts\mp_client\Effects\smoketrail.sqf";
};
sleep 0.01;
if((not alive vehicle _unit))ExitWith
{
vehicle _Unit RemoveAction _act1;
vehicle _Unit RemoveAction _act2;
_smoketrail setDropInterval 1;
_smoketrail2 setDropInterval 1;
deleteVehicle _smoketrail;
deleteVehicle _smoketrail2;
deleteVehicle _exhaustlight;
drop ["\ca\data\koulesvetlo","","Billboard",100,12,[0,-2.6,-1],[0,0,0],0,1.2,1,0.0,[0.05,0.5,2,3],[_col1,_col2,_col3,_col4],[0],0,0,"","",_unit];
};
sleep 0.01;
};

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: !!Aircraft smoke trail script help!!
« Reply #7 on: 18 Jun 2007, 19:10:14 »
Best you can do is to isolate your script in a test mission. In that test mission use a script so that the dedicated server (running in your machine) activates the smoke for few seconds on an AI plane turning circles over you, then deactivates for few seconds, then activates again and so on. You join the mission as a soldier near the turning plane. Your client ArmA should have an script waiting for the signal from the server to start to generate smoke locally in your machine. The final result is that you should see intermitent smoke comming from an AI plane controlled by the server. If everything goes ok, next step would be to control that "signal" from the script attached to an action triggered from players, but the solution would be the same.

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: !!Aircraft smoke trail script help!!
« Reply #8 on: 18 Jun 2007, 19:13:48 »
ok i have come up with this can u check it as i dont have access to a dedicated server 24/7 so i only get on change a week to upload the mission for mp testing any how take a look please

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: !!Aircraft smoke trail script help!!
« Reply #9 on: 18 Jun 2007, 20:28:45 »
You dont need to access any external dedi server, just open your own:

In ArmA directory create the server.cfg file, you may use this one as an example:
Code: [Select]
// comments are written with "//" in front of them.
// server.cfg
passwordAdmin = ""; // password to protect admin access
password = ""; // password required to connect to server
hostname="ArMaTeC  Server";
motd[]= {"Welcome to ArMaTeC server.","Hosted by ArMaTeC .",}; // Welcome message, two lines "," means 'new line'
motdInterval=1; // if motd has multiple lines, how fast to show these in succession (default is 5 seconds).
voteThreshold=0.33; // when one third agrees, this is enough to confirm a vote
reportingIP="armedass.master.gamespy.com"; // private server - no reporting ("armedass.master.gamespy.com" to report to the master server)
voteMissionPlayers=3; // start voting for missions when 3 players connect
checkfiles[]={"HWTL\dta\data3d.pbo","dta\data3d.pbo"}; //list of files to check for identity
kickduplicate=1; // do not allow duplicate id
equalModRequired=1; // require equal mod
class Missions
{
 class AIRSMOKEMP   // name for the mission, can be anything
 {
      template = airsmokeMP.Intro;
      cadetMode = 1;   // difficulty 0=veteran 1=cadet (not only AI, but radar, map etc)
 };
};

Then create a shortcut of arma_server.exe adding the option  -config=server.cfg

For example:
"THE PATH TO THIS FILE\arma_server.exe" -config=server.cfg

Export your mission to MP, launch the server with your new shortcut then run ArmA select MP and join your own game filtering by "ArMaTeC".

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: !!Aircraft smoke trail script help!!
« Reply #10 on: 18 Jun 2007, 22:10:53 »
Ok how would i make a golbal named like this

Code: [Select]
_smokeon = _unit;
if(call compile("smokeson" + _smokeon))then {
[_smokeon]execVM"smokeeffect.sqf";
smokeunit = "";
smoketrailon=false;
if(IsServer)then{hint "Server";};
};

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: !!Aircraft smoke trail script help!!
« Reply #11 on: 18 Jun 2007, 22:15:08 »
You have two options:
1 - create some known globals and the script wait for them in the clients (you need to publicVariable them)
2 - Use vehicle internal variables (setVariable and getVariable) and use a mechanism to publish these variables as with case 2, but in case 2 you may use the very same variable name for each vehicle.

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: !!Aircraft smoke trail script help!!
« Reply #12 on: 18 Jun 2007, 22:27:38 »
ok this is where im stuck mando how do i do that can u help me with an exsample

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: !!Aircraft smoke trail script help!!
« Reply #13 on: 18 Jun 2007, 23:13:19 »
In your example below, just make sure smokeeffect.sqf is always checking for your global, if set to false the script waits till it is true and then generate smoke again.
From the action menu you need to create the same global name, set it to true or false and publish it with public variable.

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: !!Aircraft smoke trail script help!!
« Reply #14 on: 18 Jun 2007, 23:28:15 »
i cant get it working as i need to have 28 globals one for each unit can u please help as if i we sort this out and i wont bug u again

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 »