OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: GW on 07 May 2010, 08:30:37
-
I always get stuck in missions,so iam intresting in know about a script for get info about west or east units which still alive.
-
This should be moved to editing and scripting -- general. This board is for people to submit scripts for download at OFPEC.
Anyway, the way I would do this would be to place a trigger with conditions of "EAST--PRESENT" (assuming that east is the enemy, otherwise use west or resistance). The trigger radius must cover all possible enemy units. Give the trigger a name (like "alleast"). Now execute the following code to give you a hint about how many enemies are left:
hint format ["There are %1 enemies left",count (list alleast)]
Where alleast is the name you gave to your trigger.
Look up the commands in the COMREF to see what they do.
Does it work for you? :cool2:
-
Moved to the correct board, carry on.. :)
-
Script work once .I want to use it as a radio again and again,
-
Check the attached missionette.
-
Getting number is not worth as i learn.I want to use it to know about how much member of enemy squad are alive.like squad A member how much alive and squad B member how much.
-
From your first post:
... iam intresting in know about a script for get info about west or east units which still alive.
That's what you got. From your second post:
... I want to use it as a radio again and again
That's what you got.
If you don't explain your problem clearly and fully, you cannot expect to get the help you need. Also, some "please" and "thankyou" wouldn't go amiss. :dry:
-
If you don't explain your problem clearly and fully, you cannot expect to get the help you need. Also, some "please" and "thankyou" wouldn't go amiss. :dry:
I second this.
Anyway, assuming that I understand your question correctly, what you want is the count command combined with "alive _x" .
"alive _x" count (units someGroup)
will return (that is, result in) the number of alive soldiers in a group called someGroup. Use the format command again, just like before, to put the results of this calculation into a hint or other text command.
-
First i tried all enemy alive script,but it did't work well.as in missions enemy always in groups,so information about how much in a group is very useful.
Can anyone help please.
-
As RKurtzDmitriyev has already said:
"alive _x" count (units someGroup)
will return (that is, result in) the number of alive soldiers in a group called someGroup. Use the format command (http://www.ofpec.com/COMREF/index.php?action=details&id=141&game=OFP) again, just like before, to put the results of this calculation into a hint or other text command.
-
a demo mission will be very useful with 3 to 4 enemy squad,help
-
The answers are already here.
You have a demo mission in which a radio action can be triggered repeatedly to report how many East units are still alive on the map.
You have the code to determine how many units in a group (of any side) are still alive.
{alive _x} count (units groupName)
Open the demo mission. Add some named groups. Look at the On Activation field of the radio trigger. Modify the code in the trigger using the code above.
In the beginning, everyone must put forth effort in order to learn editing. Don't expect the answers to be simply handed to you.
-
Riffleman, it sounds like you could benefit greatly from learning basic OFP scripting. It isn't too difficult. This tutorial is how I got started:
http://www.ofpec.com/ed_depot/index.php?action=details&id=42&game=OFP
The scripting exercises probably will make no sense at first. Type in the example scripts by hand, and tinker with them to find out how they work. There's no magic or supernatural powers required to write scripts in OFP's little scripting language. Also, the COMREFs (dictionaries of commands) at OFPEC and the Bohemia Interactive wiki are indispensable.
You could easily answer for yourself most of your questions in this thread if you just had some more experience with scripting. From looking at your Patrolling Party mission, I see you've already gotten off to a good start. So give it a try. :clap: