Home   Help Search Login Register  

Author Topic: Dead count. Who won, who lost.  (Read 609 times)

0 Members and 3 Guests are viewing this topic.

Wolf

  • Guest
Dead count. Who won, who lost.
« on: 05 Jul 2003, 06:29:32 »
Hey guys, me again.
I was wondering, is it possible, to detect how many units on each side was killed, and determine who won?

Ex.
Your playing as a West soldier and the mission ends with 26 East killed, and 32 West killed.
Now, since East had fewer casualties your debriefing would be a loss. But if it were reveresed, the debriefing would say you won.
Is it possible at all to do this?
I'm trying to make a mission using an excellent createunit script and the player will be thrown into the fray to do what he can, so if you manage to make a big enough difference, you get a mission accomplished.

Got another question also, is it at all possible to respawn the Player somewhere in an SP mission, or is that only possible in MP.

Thanks.

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Dead count. Who won, who lost.
« Reply #1 on: 05 Jul 2003, 11:24:44 »
Rather than counting dead bodies of one side, i collect the ratings of the various units in a eastpool and westpool. (After 'reading' somebody's rating set it to 0, of course)

These pools can give you an idea how many enemies units one side has killed. A big advantage is that it doesn't matter exactly what was killed (soldiers, tanks etc).

However, a pool sum can get very high pretty fast - how big can a normal integer variable go in OpF ?

Here is an example code i used to test ratings. To get it to work, save this code as 'init.sqs', make a group grp1 and have other enemy groups (maybe without ammo) going to them with waypoints. A message will tell you how much rating grp1 has collected every second.

Note: grp1 will always have 0 rating, as the sum is collected in _ratings.

Code: [Select]
_grp = grp1
_ratings = 0

#big_loop
_grparray = units grp1
_grpsize = count units grp1
_xc = 0

#loop
_guy = _grparray select _xc

? (rating _guy > 0): _ratings = _ratings + (rating _guy);
? (rating _guy > 0): _guy addRating (- (rating _guy));

_xc = _xc + 1
?(_xc == _grpsize): goto "exit_loop"
goto "loop"

#exit_loop
hint format ["Group Rating: %1",_ratings]
~1
goto "big_loop"
« Last Edit: 05 Jul 2003, 11:25:57 by DrStrangelove »

Offline Tomb

  • Contributing Member
  • **
  • in2 Metal? Go 2 my sig
Re:Dead count. Who won, who lost.
« Reply #2 on: 05 Jul 2003, 12:37:15 »

...is it at all possible to respawn the Player somewhere in an SP mission...



Hey wolfy!


nope!  :-\ :) sorry, you'd have to loop a "player SetDammage 0" command, I'm afraid.