OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Javaman on 19 Jan 2004, 01:36:01

Title: how would i get a list of everyone on the map?
Post by: Javaman on 19 Jan 2004, 01:36:01
how would i get a list of everyone on the map?

what i am trying to do in whole is this

i want to make a script to be used only when your making a mission...

i want to use addaction to meplayer(theplayer) that would give me a list of all ai so i can then switch to there cam view to see what there doing ...

here is what im using so far...



Code: [Select]
_unit = units (_this select 0)
_count = count _unit
_i=0
#loop
_u=_unit select _i

? _u == leader _u : titletext [format ["\n\n\n\n\n\n\nFollowing Group Leader %1.", _u],"plain",1]
? _u != leader _u : titletext [format ["\n\n\n\n\n\n\nFollowing Target %1.", _u],"plain",1]

_u addAction ["Player View","callplayer.sqs"]

_u switchCamera "external"
~20

_i=_i+1

?_i<_count:goto "loop"


Player switchCamera "external"



Exit

but this will only work with a group and i guess i could hand code all ai's name in the script but i would hope theres an easier way


thanks
Javaman
Title: Re:how would i get a list of everyone on the map?
Post by: LCD on 19 Jan 2004, 01:57:40
best way 2 use list of every1 in a map is a triger ;)

covers all da map nd activateed by every1 ;)

LCD OUT
Title: Re:how would i get a list of everyone on the map?
Post by: Chris Death on 19 Jan 2004, 07:46:38
Trigger way as LCD described is the easiest way, but not
the best IMHO.

Those big triggers, covering a large area require a lot of
CPU.

If i would want to have everyone on the map in a list, i would
put them into an array.

When you place your very first unit onto the map, put into it's
init field:

list_of_all = [units this]

And into each other group leaders init fields put that:

list_of_all = list_of_all + units this

~S~ CD
Title: Re:how would i get a list of everyone on the map?
Post by: LCD on 19 Jan 2004, 07:57:35
lol

Quote
but not
the best IMHO.

:P ;D

Quote
list_of_all = [units this]

shudnt dat b

list_of_all = units this

?

LCD OUT
Title: Re:how would i get a list of everyone on the map?
Post by: Chris Death on 19 Jan 2004, 08:45:54
Quote
shudnt dat b

list_of_all = units this


Yeah - off course it should be like that  

I was thinking about another way of creating the array before, and forgot to remove da braggads then.  :-[

~S~ CD
Title: Re:how would i get a list of everyone on the map?
Post by: macguba on 19 Jan 2004, 11:51:52
"One all!"
Title: Re:how would i get a list of everyone on the map?
Post by: Javaman on 19 Jan 2004, 20:21:34
ok well the trigger will be fine i only need to call it once everytime i want to use this cam script to see what my men are doing....

and to have to put all that in there int box would be more then i wanted to do...but i will use that later im sure for something


but now if i use a trigger just what would my code have to be..

sry but i am new at this

and unit countFriendly array just gives me a number



thanks in advance

and if theres a tut for this by all means point me to it...:)

Javaman