Home   Help Search Login Register  

Author Topic: headcount script needed  (Read 958 times)

0 Members and 1 Guest are viewing this topic.

bobthedinosaur

  • Guest
headcount script needed
« on: 21 Jan 2004, 22:06:32 »
hi, i'm looking for a script that will give me a headcount of the units in the east and west sides left on the map, perhaps in that small box in the lefthand side of the screen or something, would be cool if the script could display detail like armored, infantry, air, etc.

could someone plz refer me to a post like this or give me a script to do it with?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:headcount script needed
« Reply #1 on: 21 Jan 2004, 22:40:57 »
Create a trigger, activated as you like, East present.  
Then its something like

On Activation:  hint format ["East - %1",count thislist]

Syntax not guaranteed.

Plenty of reviewed ArmA missions for you to play

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:headcount script needed
« Reply #2 on: 22 Jan 2004, 02:07:53 »
On Activation:  hint format ["East - %1",count thislist]
That has one minor minus... It counts vehicles (tanks, planes etc...) as one when they still may contain up to 3 'souls' inside them...

Try something like this (dunno if this counts the 'souls' inside the vehicles...):
Code: [Select]
hint format ["Men: %1\nArmor: %2\nPlanes: %3\nChoppers: %4","Soldier" countType thisList,"Tank" countType thislist,"Plane" countType thisList,"Helicopter" countType thisList]This should return the hint box with:

Men: amount
Armor: amount
Planes: amount
Choppers: amount

Quote
Syntax not guaranteed.
Same here as well...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

bobthedinosaur

  • Guest
Re:headcount script needed
« Reply #3 on: 22 Jan 2004, 17:01:42 »
kewl, both scripts display nicely but don't give any info, the numbers just stay at 0, and i've got loads of ppl on the map, is your syntax right? cos i couldn't code to save me life

thanx

CptBravo

  • Guest
Re:headcount script needed
« Reply #4 on: 22 Jan 2004, 17:21:29 »
YOu need two things:
a) A trig covering mission area.
b) a simple one lined script.

Get a triggor activated by west(or whichever side you wanna count)
Make the trig as big as the area you want counted.
Intrig activation field:

leader gw1 addAction ["Headcount","Script.sqs"];

Where leader is you the leader of your group.(can replace with player's name

and place following script in your mission folder:

hint format ["Men: %1\nArmor: %2\nPlanes: %3\nChoppers: %4","Soldier" countType thisList,"Tank" countType thislist,"Plane" countType thisList,"Helicopter" countType thisList]

Now you have an action in the action menue to headcount troops in trig area every time you click it.

There might be an easier way .. but this one works.

bobthedinosaur

  • Guest
Re:headcount script needed
« Reply #5 on: 22 Jan 2004, 17:46:05 »
cool thanx
is there a way to make the hint box stay there? cos i notice it keeps fading away

CptBravo

  • Guest
Re:headcount script needed
« Reply #6 on: 22 Jan 2004, 18:11:26 »
You can keep clicking on action menu to get an update. Other wise you will have to loop the script to say update every 3, 5 or 30 seconds. Which can laaag depending on mission.
To loop:


#loop
~3.5

hint format ["Men: %1\nArmor: %2\nPlanes: %3\nChoppers: %4","Soldier" countType thisList,"Tank" countType thislist,"Plane" countType thisList,"Helicopter" countType thisList]

goto "loop"


This will update evey3.5 seconds. Change to whatever number you want.
« Last Edit: 22 Jan 2004, 18:12:32 by CaptainBravo »

bobthedinosaur

  • Guest
Re:headcount script needed
« Reply #7 on: 22 Jan 2004, 18:25:32 »
ok cool, but the script doesn't work like it should, i set the trigger to East which has lots of soldiers and armor but it only registers 8 men, which 8 i dunno, the trigger covers the whole area i need

should the trigger condition be "this" or "true" and should it be "once" or "repeating"?
also, the addaction command doesn't seem to work when i play the mission in single player missions mode, is there a version conflict with this or something or does it only work in multiplayer?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:headcount script needed
« Reply #8 on: 22 Jan 2004, 20:52:00 »
addAction works fine in SP.   ;)

"This" means that a trigger will fire when the conditions in the activation box are true.   "True" means it will fire as soon as the mission starts.

Once or repeating depends on what you want.    Remember that repeating means that the trigger will fire every time the conditions are met:   if the are met and stay met (eg condition line true) then the trigger only fires once anyway.

Experiment.  Have a play.   Remember that it is a condition of OFPEC membership that at the end of every test run you shoot any nearby loons in the head.   Particularly if they are unarmed or civilians.  ;D
Plenty of reviewed ArmA missions for you to play

bobthedinosaur

  • Guest
Re:headcount script needed
« Reply #9 on: 22 Jan 2004, 21:51:02 »
ok i tested the script again, this time i went and did it in the desert island on a blank mission, it worked fine, it seems something in MY mission is buggering up the script, thing is my mission is a bit far to start over, could i upload it and have someone take a look at it?

i've found deleting a whole lotta stuff outta my mission (can't pinpoint anything) seems to solve the problem

thanx in advance

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:headcount script needed
« Reply #10 on: 23 Jan 2004, 00:12:09 »
OFP being a fickle mistress again.   Phantom objects do exist.     Try creating a new map and copy and paste your mission into it.   Use a unit on a spot where lines cross line everything up exactly where it was.

Alternatively, delete in different areas until you pinpoint the area of the problem unit.
Plenty of reviewed ArmA missions for you to play

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:headcount script needed
« Reply #11 on: 23 Jan 2004, 03:34:32 »
A) wait at least .5 seconds before counting the list.
B) to get the number of simulated humans, do:


MenAlive = 0
{MenAlive = MenAlive + (count (crew _x))} ForEach List TriggerName

Dinger/Cfit

bobthedinosaur

  • Guest
Re:headcount script needed
« Reply #12 on: 23 Jan 2004, 10:53:57 »
dinger where do i put that script? i tried putting it in my already existant headcount.sqs and putting in the trigger name, but i get a invalid number in expression error  :'(