Jump to content
Sign in to follow this  
JacobJ

This calculation does weird things?

Recommended Posts

Hey

I have these script:

Points.sqf:

if (!isServer) exitWith {};
//starting points
_points = 1600;

while {true} do {
_humres = 0;
_humdes = 0;
_tower = 0;

//The triggers
if !(alive tower) then {_tower = 250};
if !(alive hummer) then {_humdes = 100};
if (triggerActivated humrescue) then {_humres = 250};

//The calculation
mst = _points + ((blufor) * -100) + ((opfor) * 50) + (_humdes + _humres + _tower) + (cyw * -400);
publicVariable "mst";
//hint str mst
sleep 1;
};

The blufor and opfor variables do I get from these two scripts:

blufor.sqf

private
[
"_bluLista"
];

blufor = 0;
_bluLista = _this select 0; // list of all blufor

{
if (_x isKindOf "SoldierWB") then 
{
	_x AddEventHandler ["killed", {blufor = blufor + 1;}];

};

} forEach _bluLista; 

publicVariable "blufor";

opfor.sqf

private
[
"_opLista"
];

opfor = 0;
_opLista = _this select 0; // list of all opfor

{
if (_x isKindOf "SoldierEB") then 
{
	_x AddEventHandler ["killed", {opfor = opfor + 1;}];

};

} forEach _opLista; 

publicVariable "opfor";

I have 3 triggers, one covering the blufors I want to be in their list, one covering the opfors I want to be in their list and one for the civilist I want to be counted on. In those triggers I have:

trigblufor

Blufor Present, Once

Timeout: 1, 1, 1

condition: this

OnAct: nul = [thislist] execVM "blufor.sqf";

trigopfor

opfor Present, Once

Timeout: 1, 1, 1

condition: this

OnAct: nul = [thislist] execVM "opfor.sqf";

trigcivil

Civil Present, Once

Timeout: 29, 29, 29

condition: this

OnAct: nul = [thislist, west] execVM "civil.sqf";

The problem is, that when I shoot a blufor it counts down alright, but after some seconds it then counts down another 100 (thats the value for each dead blufor) and it keeps on duing this.

I have a respawn area, but that isnt covered by the triggerareas.

Whats wrong with my calculation?

/Jacob

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  

×