Forum Jump :

Author Message


Posts: 2
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2009-07-03 23:43        
     
I have a Target Range setup in ArmA2 for my Battlions Bootcamp, in ArmA1 we could shoot the targets and after the cycle of targets it would tell us each lanes score. In arma2 it cycles the targets we shoot them now it won't post the scores in sideChat any ideas why?

_targetTime = _this select 0;
if (not RangeRunning) then
{
	rangeRunning = true;

	playSound "voice1";

	Hits_Lane1 = 0;
	Hits_Lane2 = 0;
	Hits_Lane3 = 0;
	Hits_Lane4 = 0;
	Hits_Lane5 = 0;
	Hits_Lane6 = 0;

	if (isServer) then
	{
		sleep 5.5;

		_i = 0;
		while {_i < 10} do
		{
			_target = [1, 6] call CSL_GetRandomInteger;

			switch (_target) do
			{
				case 1:
				{
					_eh = t50_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t50_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t50_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t50_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t50_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t50_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

					t50_1  animate["terc",0];
					t50_2  animate["terc",0];
					t50_3  animate["terc",0];
					t50_4  animate["terc",0];
					t50_5  animate["terc",0];
					t50_6  animate["terc",0];
				};
				case 2:
				{
					_eh = t75_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t75_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t75_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t75_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t75_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t75_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

					t75_1  animate["terc",0];
					t75_2  animate["terc",0];
					t75_3  animate["terc",0];
					t75_4  animate["terc",0];
					t75_5  animate["terc",0];
					t75_6  animate["terc",0];
				};
				case 3:
				{
					_eh = t100_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t100_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t100_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t100_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t100_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t100_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

					t100_1 animate["terc",0];
					t100_2 animate["terc",0];
					t100_3 animate["terc",0];
					t100_4 animate["terc",0];
					t100_5 animate["terc",0];
					t100_6 animate["terc",0];
				};
				case 4:
				{
					_eh = t125_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t125_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t125_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t125_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t125_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t125_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

					t125_1 animate["terc",0];
					t125_2 animate["terc",0];
					t125_3 animate["terc",0];
					t125_4 animate["terc",0];
					t125_5 animate["terc",0];
					t125_6 animate["terc",0];
				};
				case 5:
				{
					_eh = t150_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t150_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t150_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t150_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t150_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t150_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

					t150_1 animate["terc",0];
					t150_2 animate["terc",0];
					t150_3 animate["terc",0];
					t150_4 animate["terc",0];
					t150_5 animate["terc",0];
					t150_6 animate["terc",0];
				};
				case 6:
				{
					_eh = t200_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t200_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t200_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t200_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t200_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t200_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

					t200_1 animate["terc",0];
					t200_2 animate["terc",0];
					t200_3 animate["terc",0];
					t200_4 animate["terc",0];
					t200_5 animate["terc",0];
					t200_6 animate["terc",0];
				};
			};//switch (_target) do

			sleep _targetTime;

			switch (_target) do
			{
				case 1:
				{
					t50_1  animate["terc",1];
					t50_2  animate["terc",1];
					t50_3  animate["terc",1];
					t50_4  animate["terc",1];
					t50_5  animate["terc",1];
					t50_6  animate["terc",1];
				};
				case 2:
				{
					t75_1  animate["terc",1];
					t75_2  animate["terc",1];
					t75_3  animate["terc",1];
					t75_4  animate["terc",1];
					t75_5  animate["terc",1];
					t75_6  animate["terc",1];
				};
				case 3:
				{
					t100_1 animate["terc",1];
					t100_2 animate["terc",1];
					t100_3 animate["terc",1];
					t100_4 animate["terc",1];
					t100_5 animate["terc",1];
					t100_6 animate["terc",1];
				};
				case 4:
				{
					t125_1 animate["terc",1];
					t125_2 animate["terc",1];
					t125_3 animate["terc",1];
					t125_4 animate["terc",1];
					t125_5 animate["terc",1];
					t125_6 animate["terc",1];
				};
				case 5:
				{
					t150_1 animate["terc",1];
					t150_2 animate["terc",1];
					t150_3 animate["terc",1];
					t150_4 animate["terc",1];
					t150_5 animate["terc",1];
					t150_6 animate["terc",1];
				};
				case 6:
				{
					t200_1 animate["terc",1];
					t200_2 animate["terc",1];
					t200_3 animate["terc",1];
					t200_4 animate["terc",1];
					t200_5 animate["terc",1];
					t200_6 animate["terc",1];
				};
			};//switch (_target) do

			sleep 1;

			t50_1  removeAllEventHandlers "hit";
			t50_2  removeAllEventHandlers "hit";
			t50_3  removeAllEventHandlers "hit";
			t50_4  removeAllEventHandlers "hit";
			t50_5  removeAllEventHandlers "hit";
			t50_6  removeAllEventHandlers "hit";
			t75_1  removeAllEventHandlers "hit";
			t75_2  removeAllEventHandlers "hit";
			t75_3  removeAllEventHandlers "hit";
			t75_4  removeAllEventHandlers "hit";
			t75_5  removeAllEventHandlers "hit";
			t75_6  removeAllEventHandlers "hit";
			t100_1 removeAllEventHandlers "hit";
			t100_2 removeAllEventHandlers "hit";
			t100_3 removeAllEventHandlers "hit";
			t100_4 removeAllEventHandlers "hit";
			t100_5 removeAllEventHandlers "hit";
			t100_6 removeAllEventHandlers "hit";
			t125_1 removeAllEventHandlers "hit";
			t125_2 removeAllEventHandlers "hit";
			t125_3 removeAllEventHandlers "hit";
			t125_4 removeAllEventHandlers "hit";
			t125_5 removeAllEventHandlers "hit";
			t125_6 removeAllEventHandlers "hit";
			t150_1 removeAllEventHandlers "hit";
			t150_2 removeAllEventHandlers "hit";
			t150_3 removeAllEventHandlers "hit";
			t150_4 removeAllEventHandlers "hit";
			t150_5 removeAllEventHandlers "hit";
			t150_6 removeAllEventHandlers "hit";
			t200_1 removeAllEventHandlers "hit";
			t200_2 removeAllEventHandlers "hit";
			t200_3 removeAllEventHandlers "hit";
			t200_4 removeAllEventHandlers "hit";
			t200_5 removeAllEventHandlers "hit";
			t200_6 removeAllEventHandlers "hit";

			_i = _i + 1;

		}; //while {_i < 10} do

		t50_1  animate["terc",1];
		t50_2  animate["terc",1];
		t50_3  animate["terc",1];
		t50_4  animate["terc",1];
		t50_5  animate["terc",1];
		t50_6  animate["terc",1];
		t75_1  animate["terc",1];
		t75_2  animate["terc",1];
		t75_3  animate["terc",1];
		t75_4  animate["terc",1];
		t75_5  animate["terc",1];
		t75_6  animate["terc",1];
		t100_1 animate["terc",1];
		t100_2 animate["terc",1];
		t100_3 animate["terc",1];
		t100_4 animate["terc",1];
		t100_5 animate["terc",1];
		t100_6 animate["terc",1];
		t125_1 animate["terc",1];
		t125_2 animate["terc",1];
		t125_3 animate["terc",1];
		t125_4 animate["terc",1];
		t125_5 animate["terc",1];
		t125_6 animate["terc",1];
		t150_1 animate["terc",1];
		t150_2 animate["terc",1];
		t150_3 animate["terc",1];
		t150_4 animate["terc",1];
		t150_5 animate["terc",1];
		t150_6 animate["terc",1];
		t200_1 animate["terc",1];
		t200_2 animate["terc",1];
		t200_3 animate["terc",1];
		t200_4 animate["terc",1];
		t200_5 animate["terc",1];
		t200_6 animate["terc",1];


		_scores = "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];};
		if ((count list Lane5ShootingArea) > 0) then {_scores = format["%1Lane 5 %2 hits. ", _scores, Hits_Lane5];};
		if ((count list Lane6ShootingArea) > 0) then {_scores = format["%1Lane 6 %2 hits. ", _scores, Hits_Lane6];};

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

		//player sideChat _scores;

		ChatLogic = "Logic" createVehicle [random 100, random 100];
		ChatLogic setVehicleInit _scores;

		processInitCommands;

		rangeRunning = false;
		publicVariable "rangeRunning";

	};//if (isServer) then




};//if (not rangeRunning) then


sleep 30;

deleteVehicle ChatLogic;

[modedit]Moved to right forums[/modedit]

This post was edited by Big (2009-07-04 04:39, ago)


Author Message

Myke  

Mc Script


Posts: 1034
Rank:


Level: Member

Country: ch
Location: St. Gallen
Occupation: Armaholic addon tester
Age: 50
In-game name: Myke

 
#2 Posted at 2009-07-04 10:59        
     
Hard to test it without having the mission itself, i'm not in the mood to put down dozens of object just to test a script righ now, sorry. You should provide a sample mission with such problems (delete all non-relevant stuff) so people can quickly open the editor to test it out.

So the following rework is untested and i don't know if my solutions will work as intended. Give it a try though.

_targetTime = _this select 0;
_array_one = [t50_1, t50_2, t50_3, t50_4, t50_5, t50_6];
_array_two = [t75_1, t75_2, t75_3, t75_4, t75_5, t75_6];
_array_three = [t100_1, t100_2, t100_3, t100_4, t100_5, t100_6];
_array_four = [t125_1, t125_2, t125_3, t125_4, t125_5, t100_6];
_array_five = [t150_1, t150_2, t150_3, t150_4, t150_5, t150_6];
_array_six = [t200_1, t200_2, t200_3, t200_4, t200_5, t200_6];
_scores = "";

//Get player group leader(s)
_humans = [];
{if (isPlayer _x) then {_humans = _humans + [_x]}} foreach (playableUnits);
		

if (! RangeRunning) then {
	rangeRunning = true;
	publicVariable "rangeRunning";
	playSound "voice1";

	Hits_Lane1 = 0;
	Hits_Lane2 = 0;
	Hits_Lane3 = 0;
	Hits_Lane4 = 0;
	Hits_Lane5 = 0;
	Hits_Lane6 = 0;

	if (isServer) then {
		sleep 5.5;

		_i = 0;
		while {_i < 10} do {
			_target = ceil (random 6)
			switch (_target) do {
				case 1: {
					_eh = t50_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t50_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t50_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t50_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t50_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t50_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

					{_x animate["terc",0]} foreach _array_one;
				};
				case 2: {
					_eh = t75_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t75_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t75_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t75_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t75_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t75_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];
					{_x animate["terc",0]} foreach _array_two;
				};
				case 3: {
					_eh = t100_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t100_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t100_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t100_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t100_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t100_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];
					{_x animate["terc",0]} foreach _array_three;
				};
				case 4: {
					_eh = t125_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t125_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t125_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t125_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t125_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t125_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];
					{_x animate["terc",0]} foreach _array_four;
				};
				case 5: {
					_eh = t150_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t150_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t150_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t150_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t150_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t150_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];
					{_x animate["terc",0]} foreach _array_five;
				};
				case 6: {
					_eh = t200_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
					_eh = t200_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
					_eh = t200_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
					_eh = t200_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
					_eh = t200_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
					_eh = t200_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];
					{_x animate["terc",0]} foreach _array_six;
				};
			};
			sleep _targetTime;

			switch (_target) do {
				case 1: {
					{_x animate["terc",1]} foreach _array_one;
				};
				case 2: {
					{_x animate["terc",1]} foreach _array_two;
				};
				case 3: {
					{_x animate["terc",1]} foreach _array_three;
				};
				case 4: {
					{_x animate["terc",1]} foreach _array_four;
				};
				case 5: {
					{_x animate["terc",1]} foreach _array_five;
				};
				case 6: {
					{_x animate["terc",1]} foreach _array_six;
				};
			};
			sleep 1;
			{_x removeAllEventHandlers "hit"} foreach (_array_one + _array_two + _array_three + _array_four + _array_five + _array_six);
			_i = _i + 1;
		};
		{_x animate["terc",1]} foreach (_array_one + _array_two + _array_three + _array_four + _array_five + _array_six);

		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];};
		if ((count list Lane5ShootingArea) > 0) then {_scores = format["%1Lane 5 %2 hits. ", _scores, Hits_Lane5];};
		if ((count list Lane6ShootingArea) > 0) then {_scores = format["%1Lane 6 %2 hits. ", _scores, Hits_Lane6];};

		//Display chat in each group once
		{if (_x == leader group _x) then {_x groupChat _scores}} foreach _humans;

		rangeRunning = false;
		publicVariable "rangeRunning";

	};
};


Advertisement


Author Message


Posts: 2
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2009-07-05 04:41        
     
Here the mission to test with the script you provided did not work, the original was given to me by my Ex Clan Leader Colonel Sanders Lite and he don't have ArmA2 so he can't help me out but I know his has to do with the chat part of the script.

http://arma2.7thcavalry.us/BootCamp.utes.pbo

This post was edited by Soldat20 (2009-07-11 04:34, ago)


Author Message

Morts  



Posts: 66
Rank:


Level: Member

Country: en
Location:
Occupation: Morts
Age:
In-game name:

 
#4 Posted at 2009-11-29 17:40        
     
can anyone tell me how to get this script in game so i can use for my unit?

<a href="http://www.3para-gu.co.uk?do=home&fromid="><img src="http:/www.3para-gu.co.uk" width="468" height="60" alt="Forumlinks" border="0" /></a>