Jump to content
Sign in to follow this  
wld427

Hwo so i write a check?

Recommended Posts

Fellas, im not a mster scripter and this one may seem trivial to yall but...

on our mirage2000 we use a script for the niclear weapon and i am using the below eventhandler to fire that script

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">fired = "_this exec ""\PRACS_Mirage2000\weapons\Nuke.sqs"";";

how do i make it to check the weapon is "PRACS_M2k_B61_Launcher"

cause now everytime i fire the machine gun the nuke goes off over and over LOL

Share this post


Link to post
Share on other sites

The fired event handler gives an array to your script as a param. It has

[unit, weapon, muzzle, mode, ammo]

All other are strings except the unit is an object. Test that the ammo class matches the nuke.

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">fired = "if (_weapon=="PRACS_M2k_B61_Launcher") then {_this exec ""\PRACS_Mirage2000\weapons\Nuke.sqs""};";

something liek this is what im after but i get a bunch of errors

Share this post


Link to post
Share on other sites

In the script which is launched in the fired event handler (Nuke.sqs), you have to check it e.g like this...

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

_weapon = _this select 1;

?( _weapon == "PRACS_M2k_B61_Launcher" ): boom;

EDIT:  I suppose you can test it in the config line too, like you tryed, but then probably need to put it like:

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

fired = "if(_this select 1 == ""PRACS_M2k_B61_Launcher"") then { _this exec ""...""}; ";

Share this post


Link to post
Share on other sites
In the script which is launched in the fired event handler (Nuke.sqs), you have to check it e.g like this...

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

_weapon = _this select 1;

?( _weapon == "PRACS_M2k_B61_Launcher" ): boom;

EDIT:  I suppose you can test it in the config line too, like you tryed, but then probably need to put it like:

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

fired = "if(_this select 1 == ""PRACS_M2k_B61_Launcher"") then { _this exec ""...""}; ";

i tries your idea int eh SQS..... causes a massive amount of Lag in game whent he machine gun is fired......

thats why i figured the init line would run better

Share this post


Link to post
Share on other sites

Check my released addons

For 1 you need to go sqf, not sqs

Note that the VERY FIRST check is "if not Gun"

This will help reduce lag.

Quote[/b] ]_array = _this select 0;

_weapon = _array select 1;

_ammoname = _array select 4;

_plane = _array select 0;

\\ If it's just the gun, then get out

if(_weapon != "GSh301") then

{

\\ if its not the gun then it must be one of these

if(_ammoname == "RKT_R27_AA") then

{

//Count how much ammo in differentwe've got left

_ammocount = _plane ammo "RKTR27Launcher";

......

......

......

};

if(_ammoname == "RKT_R73_AA") then

{

//Count how much ammo in differentwe've got left

_ammocount = _plane ammo "RKTR73Launcher";

.....

......

......

};

};

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  

×