Jump to content
Sign in to follow this  
wld427

Scripter help

Recommended Posts

if anyone s an experienced scripter and would liek to help Project RACS add afterburner scripts to our planes please get in touch with me.....

Share this post


Link to post
Share on other sites

would anyne be abloe to remeve the second engine and make it wirk as a standalone single script so i can add it as a user action?

also

anybody else happen to know why the hell BIS can put multiple proxies on the SU34 and we cant???

Share this post


Link to post
Share on other sites

i have developed this script.....

the fuel lessens as it should but the aircraft does not accelerate..... can anyone help?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_plane = _this

~1

_plane setobjecttexture[1, "\PRACS_MiG23\tex\flame.paa"]

_endtime =time + 22

#Loop

_factor =1.001

?(speed _plane > 400) : _factor = _factor * 1.001

?(speed _plane > 700) : _factor = _factor * 1.001

?(speed _plane > 1000) : _factor = _factor * 0.999

?(speed _plane > 1200) : _factor = _factor * 0.999

?(speed _plane > 1600) : _factor = 1

_vel = velocity _plane

_plane setvelocity[(velocity _this select 0) - ((vectordir _this) select 0)*30*(1/(speed _this + 1)),(velocity _this select 1) - ((vectordir _this) select 1)*30*(1/(speed _this + 1)),(velocity _this select 2) - ((vectordir _this) select 2)*30*(1/(speed _this + 1))]

~.1

_plane setfuel (fuel _plane -.0005)

?(time < _endtime) : goto "Loop"

_plane setobjecttexture[1, ""]

#Exit

exit

Share this post


Link to post
Share on other sites

very confusing

what does factor do? and where?

velocity _this select 0 should be _vel select 0 i guess

imaybe i can take a look later today

Share this post


Link to post
Share on other sites

what is the speed of your plane (max)

Share this post


Link to post
Share on other sites

wich doesnt matter since the result fromt the speedcheck _factor isnt use in the rest of the script

Share this post


Link to post
Share on other sites

copy and pasted from the wiki:

_vel = velocity _vehicle;

_dir = direction _vehicle;

_speed = 10; comment "Added speed";

_vehicle setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+(cos _dir*_speed),(_vel select 2)];

Share this post


Link to post
Share on other sites

here is what i have now.....

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_plane = _this

~1

_plane setobjecttexture[1, "\PRACS_MiG23\tex\flame.paa"]

_endtime =time + 22

#Loop

_factor =1.001

?(speed _plane > 400) : _factor = _factor * 1.001

?(speed _plane > 700) : _factor = _factor * 1.001

?(speed _plane > 1000) : _factor = _factor * 0.999

?(speed _plane > 1200) : _factor = _factor * 0.999

?(speed _plane > 1600) : _factor = 1

_vel = velocity _plane

_dir = direction _vehicle;

_speed = 1200; comment "Added speed";

_plane setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+(cos _dir*_speed),(_vel select 2)];

~.1

_plane setfuel (fuel _plane -.0005)

?(time < _endtime) : goto "Loop"

_plane setobjecttexture[1, ""]

_

#Exit

exit

the issue now is the plane stops in mid air and excelerates backwards wich makes you stall and crash lovingly in to the ground.....

Share this post


Link to post
Share on other sites

.... So why didn't you open the Su33 and use those scripts?

Thats STILL my #1 tip, learn from others.

1) Animate anything with "rpm". On the Su33 its the jet nozzles, but it can be anything, including a tiny box hidden inside the plane body if you want.

Quote[/b] ] class ExhaustUp

{

type="translation";

source="rpm";

memory=1;

selection="exhaust_up";

axis="exhaust_up_axis";

minValue=0;

maxValue=5;

angle0=0;

angle1=-3;

offset0=0;

offset1=-3;

};

I also animated a switch, which is an tiny box hidden from view. This switch links to the Action Menu to turn the AB on and off

Quote[/b] ] class ABSwitch

{

type ="rotation";

selection ="ABswitch";

axis ="axis_ABswitch";

source="UserAB";

sourceAddress = "clamp";

memory = true;

minValue=0;

maxValue=1;

angle0 =0;

angle1 ="rad 45";

};

In the cpp file;

Quote[/b] ] class AnimationSources

{

class  UserAB

{

source = "user";

animPeriod = 0.2;

initPhase=0;

};

};

also in the cpp

Quote[/b] ] class UserActions

{

class ABurner_on

{

displayName="Enable Burners";

position="pilotcontrol";

onlyforplayer=0;

radius=0.5;

condition="(this animationPhase ""MenuSwitch"" > 0.5)";

statement="this animate [""ABSwitch"",1]";

};

class ABurner_off

{

displayName="Burners Off";

position="pilotcontrol";

onlyforplayer=0;

radius=0.5;

condition="(this animationPhase ""MenuSwitch"" > 0.5)";

statement="this animate [""ABSwitch"",0]";

        };

};

Also in the cpp to start the AB script;

Quote[/b] ] class EventHandlers

{

init = "[_this select 0] exec ""\myplane\scr\LethalsAB.sqf""";

};

Now for the Scripting

Quote[/b] ]// ---------------------

// Original FX scripts by Lethal

// Modified by Gnat

// ---------------------

private ["_MaxIntensity","_Boost","_leftengine","_rightengine&q

uot;,"_emitters","_Intensity","_looptime", "_plane"];

_MaxIntensity = 2;

_Boost = 0.4;

_Intensity = 0;

_maxspeed = 1300;

_plane = _this;

_leftengine = "#particlesource" createVehicle position _this;

_rightengine = "#particlesource" createVehicle position _this;

_emitters = [_leftengine,_rightengine];

{_x setParticleRandom [0.05,[0.05,0.05,0.05],[0.05,0.05,0.05],0,0.8,[0.1,0.1,0.1,0],0,0]} foreach _emitters;

{_x setDropInterval 0} foreach _emitters;

_looptime = 0.1;

while {(alive _plane)} do {

if ((isengineon _this) and ((_this animationPhase "ExhaustUp") > 0.99) and ((_this animationPhase "ABSwitch") > 0.5)) then

{

if (_Intensity < _MaxIntensity) then {_Intensity = _Intensity + 0.1*(10*_looptime)};

if ((speed _this) < _maxspeed) then {_this setVelocity [(velocity _this select 0)+((vectordir _this) select 0)*((_Boost*_Intensity/2)*(10*_looptime)),(velocity _this select 1)+((vectordir _this) select 1)*((_Boost*_Intensity/2)*(10*_looptime)),(velocity _this select 2)+((vectordir _this) select 2)*((_Boost*_Intensity/2)*(10*_looptime))]};

if (fuel _this > 0) then {_this setFuel ((fuel _this)-((1/1200)*(3*_looptime)))};

}

else {if (_Intensity > 0) then {_Intensity = _Intensity - 0.2*(10*_looptime)}};

_leftengine setParticleParams ["\Ca\data\cl_exp","","Billboard",1,0.07,[-1.2,-8.9,0.5],[(velocity _this select 0) - ((vectordir _this) select 0)*30,(velocity _this select 1) - ((vectordir _this) select 1)*30,(velocity _this select 2) - ((vectordir _this) select 2)*30],1,1.2745,1,0,[0.6+(2*(speed _this/_maxspeed)),0.5+(10*(speed _this/_maxspeed))],[[0.040,0.100,0.900,0.1500*_Intensity],[0.200,0.200,0.800,0.1000*_Intensity],

[0.500,0.200,0.000,0.0250*_Intensity],[0.000,0.000,0.000,0.0000*_Intensity]],[0],0,0,&quot

;","",_this];

_rightengine setParticleParams ["\Ca\data\cl_exp","","Billboard",1,0.07,[1.2,-8.9,0.5],[(velocity _this select 0) - ((vectordir _this) select 0)*30,(velocity _this select 1) - ((vectordir _this) select 1)*30,(velocity _this select 2) - ((vectordir _this) select 2)*30],1,1.2745,1,0,[0.6+(2*(speed _this/_maxspeed)),0.5+(10*(speed _this/_maxspeed))],[[0.040,0.100,0.900,0.1500*_Intensity],[0.200,0.200,0.800,0.1000*_Intensity],

[0.500,0.200,0.000,0.0250*_Intensity],[0.000,0.000,0.000,0.0000*_Intensity]],[0],0,0,&quot

;","",_this];

{_x setpos (getpos _this)} foreach _emitters;

if (_Intensity > 0) then {{_x setDropInterval 0.001} foreach _emitters} else {{_x setDropInterval 0} foreach _emitters};

_looptime = time;

sleep 0.05; // mod by Crowe

_looptime = time - _looptime;

};

deleteVehicle _leftengine;

deleteVehicle _rightengine;

- If you want only 1 engine, it would look like this;

Quote[/b] ]// ---------------------

// Original FX scripts by Lethal

// Modified by Gnat

// ---------------------

private ["_MaxIntensity","_Boost","_leftengine","_emitters&quot

;,"_Intensity","_looptime", "_plane"];

_MaxIntensity = 2;

_Boost = 0.4;

_Intensity = 0;

_maxspeed = 1300;

_plane = _this;

_leftengine = "#particlesource" createVehicle position _this;

_emitters = [_leftengine];

{_x setParticleRandom [0.05,[0.05,0.05,0.05],[0.05,0.05,0.05],0,0.8,[0.1,0.1,0.1,0],0,0]} foreach _emitters;

{_x setDropInterval 0} foreach _emitters;

_looptime = 0.1;

while {(alive _plane)} do {

if ((isengineon _this) and ((_this animationPhase "ExhaustUp") > 0.99) and ((_this animationPhase "ABSwitch") > 0.5)) then

{

if (_Intensity < _MaxIntensity) then {_Intensity = _Intensity + 0.1*(10*_looptime)};

if ((speed _this) < _maxspeed) then {_this setVelocity [(velocity _this select 0)+((vectordir _this) select 0)*((_Boost*_Intensity/2)*(10*_looptime)),(velocity _this select 1)+((vectordir _this) select 1)*((_Boost*_Intensity/2)*(10*_looptime)),(velocity _this select 2)+((vectordir _this) select 2)*((_Boost*_Intensity/2)*(10*_looptime))]};

if (fuel _this > 0) then {_this setFuel ((fuel _this)-((1/1200)*(3*_looptime)))};

}

else {if (_Intensity > 0) then {_Intensity = _Intensity - 0.2*(10*_looptime)}};

_leftengine setParticleParams ["\Ca\data\cl_exp","","Billboard",1,0.07,[-1.2,-8.9,0.5],[(velocity _this select 0) - ((vectordir _this) select 0)*30,(velocity _this select 1) - ((vectordir _this) select 1)*30,(velocity _this select 2) - ((vectordir _this) select 2)*30],1,1.2745,1,0,[0.6+(2*(speed _this/_maxspeed)),0.5+(10*(speed _this/_maxspeed))],[[0.040,0.100,0.900,0.1500*_Intensity],[0.200,0.200,0.800,0.1000*_Intensity],

[0.500,0.200,0.000,0.0250*_Intensity],[0.000,0.000,0.000,0.0000*_Intensity]],[0],0,0,&quot

;","",_this];

{_x setpos (getpos _this)} foreach _emitters;

if (_Intensity > 0) then {{_x setDropInterval 0.001} foreach _emitters} else {{_x setDropInterval 0} foreach _emitters};

_looptime = time;

sleep 0.05; // mod by Crowe

_looptime = time - _looptime;

};

deleteVehicle _leftengine;

To change the position of the flame, you change the XYZ coordinates here;

_leftengine setParticleParams ["\Ca\data\cl_exp","","Billboard",1,0.07,[-1.2,-8.9,0.5],[(velocity _this select 0) - ...........

Should be it .....

Share this post


Link to post
Share on other sites

cant work.

_vel = velocity _plane

_dir = direction _vehicle; <span style='color:red'>wich vehicle? you defined _plane, not _vehicle</span>

Share this post


Link to post
Share on other sites
Gnat @ Aug. 28 2008,01:53)].... So why didn't you open the Su33 and use those scripts?

Thats STILL my #1 tip, learn from others.

1) Animate anything with "rpm". On the Su33 its the jet nozzles, but it can be anything, including a tiny box hidden inside the plane body if you want.

Quote[/b] ] class ExhaustUp

{

type="translation";

source="rpm";

memory=1;

selection="exhaust_up";

axis="exhaust_up_axis";

minValue=0;

maxValue=5;

angle0=0;

angle1=-3;

offset0=0;

offset1=-3;

};

I also animated a switch, which is an tiny box hidden from view. This switch links to the Action Menu to turn the AB on and off

Quote[/b] ] class ABSwitch

{

type ="rotation";

selection ="ABswitch";

axis ="axis_ABswitch";

source="UserAB";

sourceAddress = "clamp";

memory = true;

minValue=0;

maxValue=1;

angle0 =0;

angle1 ="rad 45";

};

In the cpp file;

Quote[/b] ] class AnimationSources

{

class  UserAB

{

source = "user";

animPeriod = 0.2;

initPhase=0;

};

};

also in the cpp

Quote[/b] ] class UserActions

{

class ABurner_on

{

displayName="Enable Burners";

position="pilotcontrol";

onlyforplayer=0;

radius=0.5;

condition="(this animationPhase ""MenuSwitch"" > 0.5)";

statement="this animate [""ABSwitch"",1]";

};

class ABurner_off

{

displayName="Burners Off";

position="pilotcontrol";

onlyforplayer=0;

radius=0.5;

condition="(this animationPhase ""MenuSwitch"" > 0.5)";

statement="this animate [""ABSwitch"",0]";

        };

};

Also in the cpp to start the AB script;

Quote[/b] ] class EventHandlers

{

init = "[_this select 0] exec ""\myplane\scr\LethalsAB.sqf""";

};

Now for the Scripting

Quote[/b] ]// ---------------------

// Original FX scripts by Lethal

// Modified by Gnat

// ---------------------

private ["_MaxIntensity","_Boost","_leftengine","_rightengine&a

mp;q

uot;,"_emitters","_Intensity","_looptime", "_plane"];

_MaxIntensity = 2;

_Boost = 0.4;

_Intensity = 0;

_maxspeed = 1300;

_plane = _this;

_leftengine = "#particlesource" createVehicle position _this;

_rightengine = "#particlesource" createVehicle position _this;

_emitters = [_leftengine,_rightengine];

{_x setParticleRandom [0.05,[0.05,0.05,0.05],[0.05,0.05,0.05],0,0.8,[0.1,0.1,0.1,0],0,0]} foreach _emitters;

{_x setDropInterval 0} foreach _emitters;

_looptime = 0.1;

while {(alive _plane)} do {

if ((isengineon _this) and ((_this animationPhase "ExhaustUp") > 0.99) and ((_this animationPhase "ABSwitch") > 0.5)) then

{

if (_Intensity < _MaxIntensity) then {_Intensity = _Intensity + 0.1*(10*_looptime)};

if ((speed _this) < _maxspeed) then {_this setVelocity [(velocity _this select 0)+((vectordir _this) select 0)*((_Boost*_Intensity/2)*(10*_looptime)),(velocity _this select 1)+((vectordir _this) select 1)*((_Boost*_Intensity/2)*(10*_looptime)),(velocity _this select 2)+((vectordir _this) select 2)*((_Boost*_Intensity/2)*(10*_looptime))]};

if (fuel _this > 0) then {_this setFuel ((fuel _this)-((1/1200)*(3*_looptime)))};

}

else {if (_Intensity > 0) then {_Intensity = _Intensity - 0.2*(10*_looptime)}};

_leftengine setParticleParams ["\Ca\data\cl_exp","","Billboard",1,0.07,[-1.2,-8.9,0.5],[(velocity _this select 0) - ((vectordir _this) select 0)*30,(velocity _this select 1) - ((vectordir _this) select 1)*30,(velocity _this select 2) - ((vectordir _this) select 2)*30],1,1.2745,1,0,[0.6+(2*(speed _this/_maxspeed)),0.5+(10*(speed _this/_maxspeed))],[[0.040,0.100,0.900,0.1500*_Intensity],[0.200,0.200,0.800,0.1000*_Intensity],

[0.500,0.200,0.000,0.0250*_Intensity],[0.000,0.000,0.000,0.0000*_Intensity]],[0],0,0,&quot

;

;","",_this];

_rightengine setParticleParams ["\Ca\data\cl_exp","","Billboard",1,0.07,[1.2,-8.9,0.5],[(velocity _this select 0) - ((vectordir _this) select 0)*30,(velocity _this select 1) - ((vectordir _this) select 1)*30,(velocity _this select 2) - ((vectordir _this) select 2)*30],1,1.2745,1,0,[0.6+(2*(speed _this/_maxspeed)),0.5+(10*(speed _this/_maxspeed))],[[0.040,0.100,0.900,0.1500*_Intensity],[0.200,0.200,0.800,0.1000*_Intensity],

[0.500,0.200,0.000,0.0250*_Intensity],[0.000,0.000,0.000,0.0000*_Intensity]],[0],0,0,&quot

;

;","",_this];

{_x setpos (getpos _this)} foreach _emitters;

if (_Intensity > 0) then {{_x setDropInterval 0.001} foreach _emitters} else {{_x setDropInterval 0} foreach _emitters};

_looptime = time;

sleep 0.05; // mod by Crowe

_looptime = time - _looptime;

};

deleteVehicle _leftengine;

deleteVehicle _rightengine;

- If you want only 1 engine, it would look like this;

Quote[/b] ]// ---------------------

// Original FX scripts by Lethal

// Modified by Gnat

// ---------------------

private ["_MaxIntensity","_Boost","_leftengine","_emitters&quot

;

;,"_Intensity","_looptime", "_plane"];

_MaxIntensity = 2;

_Boost = 0.4;

_Intensity = 0;

_maxspeed = 1300;

_plane = _this;

_leftengine = "#particlesource" createVehicle position _this;

_emitters = [_leftengine];

{_x setParticleRandom [0.05,[0.05,0.05,0.05],[0.05,0.05,0.05],0,0.8,[0.1,0.1,0.1,0],0,0]} foreach _emitters;

{_x setDropInterval 0} foreach _emitters;

_looptime = 0.1;

while {(alive _plane)} do {

if ((isengineon _this) and ((_this animationPhase "ExhaustUp") > 0.99) and ((_this animationPhase "ABSwitch") > 0.5)) then

{

if (_Intensity < _MaxIntensity) then {_Intensity = _Intensity + 0.1*(10*_looptime)};

if ((speed _this) < _maxspeed) then {_this setVelocity [(velocity _this select 0)+((vectordir _this) select 0)*((_Boost*_Intensity/2)*(10*_looptime)),(velocity _this select 1)+((vectordir _this) select 1)*((_Boost*_Intensity/2)*(10*_looptime)),(velocity _this select 2)+((vectordir _this) select 2)*((_Boost*_Intensity/2)*(10*_looptime))]};

if (fuel _this > 0) then {_this setFuel ((fuel _this)-((1/1200)*(3*_looptime)))};

}

else {if (_Intensity > 0) then {_Intensity = _Intensity - 0.2*(10*_looptime)}};

_leftengine setParticleParams ["\Ca\data\cl_exp","","Billboard",1,0.07,[-1.2,-8.9,0.5],[(velocity _this select 0) - ((vectordir _this) select 0)*30,(velocity _this select 1) - ((vectordir _this) select 1)*30,(velocity _this select 2) - ((vectordir _this) select 2)*30],1,1.2745,1,0,[0.6+(2*(speed _this/_maxspeed)),0.5+(10*(speed _this/_maxspeed))],[[0.040,0.100,0.900,0.1500*_Intensity],[0.200,0.200,0.800,0.1000*_Intensity],

[0.500,0.200,0.000,0.0250*_Intensity],[0.000,0.000,0.000,0.0000*_Intensity]],[0],0,0,&quot

;

;","",_this];

{_x setpos (getpos _this)} foreach _emitters;

if (_Intensity > 0) then {{_x setDropInterval 0.001} foreach _emitters} else {{_x setDropInterval 0} foreach _emitters};

_looptime = time;

sleep 0.05; // mod by Crowe

_looptime = time - _looptime;

};

deleteVehicle _leftengine;

To change the position of the flame, you change the XYZ coordinates here;

_leftengine setParticleParams ["\Ca\data\cl_exp","","Billboard",1,0.07,[-1.2,-8.9,0.5],[(velocity _this select 0) - ...........

Should be it .....

I personally wasn't sure how far you could take this.

I mean if I use a script source that is like 90% of one of yours, in effect it would just be copying.

I guess a quick PM to say 'hey I'm basing a zyx script off yours is that ok, etc would be ok?

Southy

Share this post


Link to post
Share on other sites
I personally wasn't sure how far you could take this.

I mean if I use a script source that is like 90% of one of yours, in effect it would just be copying.

I guess a quick PM to say 'hey I'm basing a zyx script off yours is that ok, etc would be ok?

Southy

Huh ? .... stop skirting the question.

But I'm guessing;

Simply do as I did, use Lethals scripts, credit him inside the script and in the readme / release documentation. If you're using this variation simply credit me for some modification as well.

np.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×