Jump to content
Sign in to follow this  
Bjorling

rifle range script fail

Recommended Posts

i got the mission and its 4-8 script code that is the mission file that igave you a link to

Share this post


Link to post
Share on other sites

Start_Range_30_Targets scrip and code is here

_targetTime = _this select 0;

if (not RangeRunning) then

{

rangeRunning = true;

playSound "voice1";

Hits_Lane1 = 0;

Hits_Lane2 = 0;

Hits_Lane3 = 0;

Hits_Lane4 = 0;

if (isServer) then

{

sleep 5.5;

_i = 0;

while {_i < 30} do

{

_target = [1, 6] call CSL_GetRandomInteger;

switch (_target) do

{

case 1:

{

_eh = t100_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t100_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t100_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t100_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

t100_1 animate["terc",0];

t100_2 animate["terc",0];

t100_3 animate["terc",0];

t100_4 animate["terc",0];

};

case 2:

{

_eh = t150_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t150_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t150_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t150_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

t150_1 animate["terc",0];

t150_2 animate["terc",0];

t150_3 animate["terc",0];

t150_4 animate["terc",0];

};

case 3:

{

_eh = t200_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t200_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t200_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t200_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

t200_1 animate["terc",0];

t200_2 animate["terc",0];

t200_3 animate["terc",0];

t200_4 animate["terc",0];

};

case 4:

{

_eh = t300_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t300_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t300_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t300_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

t300_1 animate["terc",0];

t300_2 animate["terc",0];

t300_3 animate["terc",0];

t300_4 animate["terc",0];

};

case 5:

{

_eh = t350_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t350_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t350_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t350_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

t350_1 animate["terc",0];

t350_2 animate["terc",0];

t350_3 animate["terc",0];

t350_4 animate["terc",0];

};

case 6:

{

_eh = t500_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t500_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t500_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

_eh = t500_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0; _this select 0 removeAllEventHandlers "hit";}];

t500_1 animate["terc",0];

t500_2 animate["terc",0];

t500_3 animate["terc",0];

t500_4 animate["terc",0];

};

};//switch (_target) do

sleep _targetTime;

switch (_target) do

{

case 1:

{

t100_1 animate["terc",1];

t100_2 animate["terc",1];

t100_3 animate["terc",1];

t100_4 animate["terc",1];

};

case 2:

{

t150_1 animate["terc",1];

t150_2 animate["terc",1];

t150_3 animate["terc",1];

t150_4 animate["terc",1];

};

case 3:

{

t200_1 animate["terc",1];

t200_2 animate["terc",1];

t200_3 animate["terc",1];

t200_4 animate["terc",1];

};

case 4:

{

t300_1 animate["terc",1];

t300_2 animate["terc",1];

t300_3 animate["terc",1];

t300_4 animate["terc",1];

};

case 5:

{

t350_1 animate["terc",1];

t350_2 animate["terc",1];

t350_3 animate["terc",1];

t350_4 animate["terc",1];

};

case 6:

{

t500_1 animate["terc",1];

t500_2 animate["terc",1];

t500_3 animate["terc",1];

t500_4 animate["terc",1];

};

};//switch (_target) do

sleep 1;

t100_1 removeAllEventHandlers "hit";

t100_2 removeAllEventHandlers "hit";

t100_3 removeAllEventHandlers "hit";

t100_4 removeAllEventHandlers "hit";

t150_1 removeAllEventHandlers "hit";

t150_2 removeAllEventHandlers "hit";

t150_3 removeAllEventHandlers "hit";

t150_4 removeAllEventHandlers "hit";

t200_1 removeAllEventHandlers "hit";

t200_2 removeAllEventHandlers "hit";

t200_3 removeAllEventHandlers "hit";

t200_4 removeAllEventHandlers "hit";

t300_1 removeAllEventHandlers "hit";

t300_2 removeAllEventHandlers "hit";

t300_3 removeAllEventHandlers "hit";

t300_4 removeAllEventHandlers "hit";

t350_1 removeAllEventHandlers "hit";

t350_2 removeAllEventHandlers "hit";

t350_3 removeAllEventHandlers "hit";

t350_4 removeAllEventHandlers "hit";

t500_1 removeAllEventHandlers "hit";

t500_2 removeAllEventHandlers "hit";

t500_3 removeAllEventHandlers "hit";

t500_4 removeAllEventHandlers "hit";

_i = _i + 1;

}; //while {_i < 30} do

t100_1 animate["terc",1];

t100_2 animate["terc",1];

t100_3 animate["terc",1];

t100_4 animate["terc",1];

t150_1 animate["terc",1];

t150_2 animate["terc",1];

t150_3 animate["terc",1];

t150_4 animate["terc",1];

t200_1 animate["terc",1];

t200_2 animate["terc",1];

t200_3 animate["terc",1];

t200_4 animate["terc",1];

t300_1 animate["terc",1];

t300_2 animate["terc",1];

t300_3 animate["terc",1];

t300_4 animate["terc",1];

t350_1 animate["terc",1];

t350_2 animate["terc",1];

t350_3 animate["terc",1];

t350_4 animate["terc",1];

t500_1 animate["terc",1];

t500_2 animate["terc",1];

t500_3 animate["terc",1];

t500_4 animate["terc",1];

_scores = "ChatLogic = this; player sideChat '";

if ((count list Lane1ShootingArea) > 0) then {_scores = format["%1Lane 1 %2 hits. ", _scores, Hits_Lane1];};

if ((count list Lane2ShootingArea) > 0) then {_scores = format["%1Lane 2 %2 hits. ", _scores, Hits_Lane2];};

if ((count list Lane3ShootingArea) > 0) then {_scores = format["%1Lane 3 %2 hits. ", _scores, Hits_Lane3];};

if ((count list Lane4ShootingArea) > 0) then {_scores = format["%1Lane 4 %2 hits. ", _scores, Hits_Lane4];};

_scores = format["%1';", _scores];

//player sideChat _scores;

"Logic" createUnit [[random 100, random 100], TrainingGroup, _scores];

rangeRunning = false;

publicVariable "rangeRunning";

};//if (isServer) then

};//if (not rangeRunning) then

sleep 30;

deleteVehicle ChatLogic;

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  

×