OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bobthedinosaur 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?
-
Create a trigger, activated as you like, East present.
Then its something like
On Activation: hint format ["East - %1",count thislist]
Syntax not guaranteed.
-
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...):
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
Syntax not guaranteed.
Same here as well...
-
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
-
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.
-
cool thanx
is there a way to make the hint box stay there? cos i notice it keeps fading away
-
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.
-
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?
-
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
-
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
-
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.
-
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 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 :'(