Jump to content
Sign in to follow this  
Guest

Can some1 pleez help me with count friendly/enemy

Recommended Posts

Guest

Can someone help me with making a script that counts how many Friendly and Enemy units that are on the map.

When Soviet forces only have 50% of what us have the game will go to my cutscene.

Eks: If US have 100 men and Soviet have 50 or less the game goes to my cutscene.

It would be nice if the result was shown in a hint box so i have control under testing, but can take it out in the finnished version.

Also does the count friendly/Enemy counts the persons inside the wehicles also, or only foot soldiers?

I want it to count all persons on each side no mather if they're i a vehicle or not.

Pleez help me:)

Share this post


Link to post
Share on other sites

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

_people = _this select 0

_peoplecount = count _people

_i = 0

_freindly = 0

_enemy = 0

_playerside = side player

#loop

_unit = _people select _i

?side _unit != _playerside: _enemy = _enemy + 1

?side _unit == _playerside: _freindly = _freindly + 1

_i = _i + 1

?_i => _peoplecount: goto "display"

goto "loop"

#display

hint format ["%1 Freindly units, %2 Enemy units", _freindly, _enemy]

<span id='postcolor'>

Make a trigger with anyone present, make it big enough to cover the map.

Put this in the onactivation field:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">[thislist] exec "scriptname.sqs"<span id='postcolor'>

I have not tested the script so it probably won't work.

RED

Share this post


Link to post
Share on other sites
Guest

No it dident work, not that i coud see anyway, but thanx anyway. I have done it this way instead:

Script:

#ss

hint format ["There us %1", count (list triggerA)]

~1

hint format ["There Ru %1", count (list triggerb)]

~1

goto "ss"

and in condition fiel for the soviet trigger:

this and "alive _x" count thislist <=5

This works, but it counts a tank for 1 but i would like it to count persons, so a tank is 3 persons

A easy way to do this??

Thanx for you're help.

Share this post


Link to post
Share on other sites

Sorry I would have tested it but OFP is not installed at the moment, I had to do a format.

I guess you could could use the typeof command to find out if the unit is a tank, if it is add 3 to the number to be output.

RED

Share this post


Link to post
Share on other sites

Not every vehicle has a crew of 3 and wath about the passengers in the cargo of for example a BMP use the crew command instead

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  

×