Home   Help Search Login Register  

Author Topic: Script to know about number of enemy.  (Read 1934 times)

0 Members and 1 Guest are viewing this topic.

Offline GW

  • ofp cadet
  • Members
  • *
  • The great Himalaya
Script to know about number of enemy.
« 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.
Be happy.
ofp die-hard fan for whole life

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Script to know about number of enemy.
« Reply #1 on: 07 May 2010, 14:16:41 »
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:

Code: [Select]
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:
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Script to know about number of enemy.
« Reply #2 on: 07 May 2010, 14:26:14 »
Moved to the correct board, carry on.. :)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline GW

  • ofp cadet
  • Members
  • *
  • The great Himalaya
Re: Script to know about number of enemy.
« Reply #3 on: 08 May 2010, 10:27:13 »
Script work once .I want to use it as a radio again and again,
Be happy.
ofp die-hard fan for whole life

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Script to know about number of enemy.
« Reply #4 on: 08 May 2010, 12:10:36 »
Check the attached missionette.

Offline GW

  • ofp cadet
  • Members
  • *
  • The great Himalaya
Re: Script to know about number of enemy.
« Reply #5 on: 09 May 2010, 11:48:09 »
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.
Be happy.
ofp die-hard fan for whole life

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Script to know about number of enemy.
« Reply #6 on: 09 May 2010, 12:06:36 »
From your first post:

Quote
... 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:

Quote
... 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:

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Script to know about number of enemy.
« Reply #7 on: 09 May 2010, 13:29:34 »
Quote
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" .

Code: [Select]
"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.
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline GW

  • ofp cadet
  • Members
  • *
  • The great Himalaya
Re: Script to know about number of enemy.
« Reply #8 on: 09 May 2010, 19:52:52 »
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.
Be happy.
ofp die-hard fan for whole life

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Script to know about number of enemy.
« Reply #9 on: 09 May 2010, 19:57:54 »
As RKurtzDmitriyev has already said:

Code: [Select]
"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.

Offline GW

  • ofp cadet
  • Members
  • *
  • The great Himalaya
Re: Script to know about number of enemy.
« Reply #10 on: 11 May 2010, 03:21:53 »
a demo mission will be very useful with 3 to 4 enemy squad,help
Be happy.
ofp die-hard fan for whole life

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Script to know about number of enemy.
« Reply #11 on: 11 May 2010, 08:46:51 »
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.

Code: [Select]
{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.

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Script to know about number of enemy.
« Reply #12 on: 11 May 2010, 14:37:03 »
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:
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)