Home   Help Search Login Register  

Author Topic: a question.  (Read 1269 times)

0 Members and 1 Guest are viewing this topic.

whiplash2000a

  • Guest
a question.
« on: 26 Aug 2002, 09:23:34 »
I know I have asked this before, but the old forum got hosed. So, I was wondering, what are the myriad ways of finding out the percentage of enemy troops are left?

Also, I would like to let it be known that, as of yet, I have not had to use groups in any of my own scripts.

Could someone explain to me the grouping system? How do I put certain units into the group of enemies I want to know the percentage of that are left?

Thanks guys.

BTW, nice forum format.

DeusRich

  • Guest
Re:a question.
« Reply #1 on: 26 Aug 2002, 10:07:24 »
so, you have to know if it is a percentage out of what, as in out 100 soldiers, how many are left. 10 soldiers is a nice easy number to show you the workings, and you should be able to change it to however many there really are...

first you make your trigger, with its condition somet like a radio (ie: "How many people are left" radio alpha) or somet like true, to have it constantly updated. Now, im gonna do this as if u want it to pop up on the screen, then it fades....
you have to create an array with all ur units, to do this, you have to type somwhere:

unitcountarray = [unit1,unit2,unit3,unit4,unit5,unit6,unit7,unit8,unit9,unit10]

until all of your units are in the array, and name it something relevant. then you will have to type somewhere, in the on activation of that trigger:

[10,unitcountarray] exec "trooppercent.sqs"

where 10 is your maximum number of units then alt-tab out of ofp, and create a text document in the relevant folder, type in this:

Code: [Select]
_total = _this select 0
_uca = _this select 1

_a = East countside _uca
_factor = 100/_total
_answ = _a*_factor

hint format ["There are %_answ percent of enemies left"]

exit

oh yea, make sure you rename the text document trooppercent.sqs otherwise it wont work, and you may have to view file extensions, to do this you go to tools > folder options > view > view file extensions

that's it... I think I may have messed up on the format bit, but the rest is pretty clear cut, test it out, and if it works, great!
also, the East can be west, civ, guer or logic, depending on what side the enemy is....
« Last Edit: 26 Aug 2002, 15:51:01 by DeusRich »

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:a question.
« Reply #2 on: 27 Aug 2002, 09:02:20 »
Or instead of using script, you could use a trigger ;)

Trigger

Radius: Covering battlefield
Conditions: East present <-- If your counting West units, change that to west
Condition Field: west countside thislist < (20 * 0.25)

That trigger will go off when there are less than 5 East soldiers alive in the trigger.

To modify the number and the percentages, change the 20 to the total number of East soldiers you have at the start.
Then change the 0.25 to whatever percentage of dead you are after (eg. 50% == 0.50, 12% = 0.12)

whiplash2000a

  • Guest
Re:a question.
« Reply #3 on: 27 Aug 2002, 09:47:27 »
Sui, once again you have come up with a simple way of getting this done. Thankyou.

DeusRich, thanks for the effort. I'm afraid that in this situation Sui's way would be easier, as i have to count massive numbers of troops at seperate parts of the battle.

I'm spwaning them at different moments in the battle, as it progresses. :wow:

Expect to see finished results in 1-2 months depending on college demands and the progress of SEB's nam pack.  ;D
« Last Edit: 27 Aug 2002, 09:48:07 by whiplash2000a »

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:a question.
« Reply #4 on: 02 Sep 2002, 14:15:12 »
Just want to mention here, that this kind of way to do
it, isn't really very useful.
What i mean is:

to do the percentage counting with already
specified numbers (e.g: 20 * 0.25).
You don't need to let the game calculate percentage on
already fix values.
We know there are 20 units, and we want something to
happen, once only 5 of them are left.
So why don't ask for 5 left in this case?

Here's another way, of how it would make more sense:

Save the very first count result of the west troops (or
whatever side is wanted here) in a variable (e.g: countall)


Trigger: x/y axis as big as it covers the whole battlefield
activation: west/present/once
triggername: triggerA
condition: this
activation: countall=count (list this)

and then use in a trigger's condition field:
(the size of the trigger should also be as big as it covers the
whole battlefield)

Condition Field: west countside thislist < (countall * 0.25)

instead of

Condition Field: west countside thislist < (20 * 0.25)

:note - the percentage counting can be very useful in
missions with dynamic presence of enemies, or in multiplayer
maps (because there's always the option to disable AI from
the player selection menu).

~S~ CD
« Last Edit: 02 Sep 2002, 14:16:32 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted