OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bigcheese on 24 Jan 2004, 21:22:30
-
how would i go about counting all the people on a particular side and listing there names
also how do you find out what inventory a person has using scripts
thanks in advance
-
Make a trigger covering the whole map. Activation east present or whatever. In the on activation box you need something like
[thislist] exec "myscript.sqs"
Syntax not guaranteed, but in principle this will pass the array thislist (which is an array of all the units that would activate the trigger) to your script, where you can play with them as you will. Use the command count to count them.
Or directly in the on activation field:-
hint format ["East loons - %1", count thislist]
For kit use commands:-
weapons
magazines
ammo
hasweapon
-
Sorry,
I forgot to mention that the script im using relies on the fact that you dont have to put a trigger down,
I think i remember a while back that there is already a default trigger that is on every map that covers the whole map - can anyone remember what its called - if not is there a command that does it.
Thanks
-
well without using a trigger, what you could do is create an array for all west players and all east players
eg lets say its a 24 player game
E_array = [E1,E2,E3,E4,E5,E6,E7,E8,E9,E10,E11,E12]
W_array = [W1,W2,W3,W4,W5,W6,W7,W8,W9,W10,W11,W12]
E1, would be the name you gave to one of the east units in the editor view
you could then count how many units are alive in each array
remove all elements of the array that are not alive
resize the array
and then return the list of all name _x in the array
if you needed to do this further into the mission than right at the very start, then you would have to update the arrays every time a player respawns, remove the older elements of the array that the dead player element became and replace itr with the newer element
See kegety's spectator script for some ideas on what the script lines look like to do some of this
I know its a bit vague, but without specifics as to when and why you need to do this, then the answers are vague
-
I think i remember a while back that there is already a default trigger that is on every map that covers the whole map - can anyone remember what its called - if not is there a command that does it.
:o wow - u must have encountered one of the greatest news
in OFP's history, and then you can't remember it anymore >:(
nah - forget it, there's no such a "default trigger", as you could
be sure BIS would have been using it in some of their maps, if
there were one.
The most cpu friendly way is to put the guys manually into arrays, as there wouldn't be a large trigger, stressing cpu and
even harder: network performance.
For the "lazy" ppl (forgive me that u lazy ppl u ;D ), there's still
the other method, where you have a large trigger to capture
everybody into an array.
~S~ CD
-
For the "lazy" ppl (forgive me that u lazy ppl u ), there's still
the other method, where you have a large trigger to capture
everybody into an array.
m lazy :P nd proud of it ;) ;D
::)
nywayz i think dat if u make da triger a 1 tamer (once thingy)
den even tho it wil use lotsa CPU 1 time - it wil take bout 0.5 sec (or less ::)) nd den stop efectin ? if so den it isnt dat CPU stresin :P or do da triger continue efectin after it done it job ? ny1 got answer ?
LCD OUT
-
nywayz i think dat if u make da triger a 1 tamer (once thingy)
den even tho it wil use lotsa CPU 1 time - it wil take bout 0.5 sec (or less ::)) nd den stop efectin ? if so den it isnt dat CPU stresin :P or do da triger continue efectin after it done it job ? ny1 got answer ?
I'd like to know the answer to this as well...
Me and my crappiest computer of all time need every single lag reducing gimmick there is... :(
-
I don't think so for the reason that:
You can always access the list of a trigger (one timer or not).
You should be able to test it that way:
Create a large trigger, and make it a one timer.
Now make da condition: true, so that it shoots right from
start.
Now start a script, and make a display for anything inside
that trigger's list, which hasn't been in there when the mission
started.
Now find a way to check the time, it took from the display
command 'till the display was shown.
If it takes long, we can assume that the trigger list get's
created new.
If there's no time-delay, then the trigger list may have been
updated instantly. (that's my theory btw).
btw - i forgot to mention, that when testing that, it would
be required that there's no current active condition, waiting
for something inside the trigger list.
Just start a script by radio-gaga or so.
~S~ CD
-
i think it wont update didnt test tho (nd not gonna do :P)
btw
Now make da condition: true
look
he said da :P ;) ::)
LCD OUT
-
Updating does it for sure, the quessy is only:
Does it update instantly, or does it update upon request?
Dat technique is used very often in multiplay games, to
check areas for somebody's presence or absence.
If you gonna display the list of a trigger, you will always
see the actual list, containing all objects matching to the trigger's activation conditions like: west present (not the condition field i mean).
Sorry, but it wasn't even me, who said that such triggers
eat alot of performance, it's been da man: SUMA
it's been da man: SUMA
:-X oops i did it again ;D
~S~ CD
-
The command "@"
and triggers
are basically very fast looping scripts, that check to see if their conditions have been met
The speed of their loop check is dependant on the fps i believe
so unless it is absolutely necessary, always use a looping script, even a ~0.1 wait period is less stressful on a cpu than either triggers or @ commands
ideally script loops should be 0.5 or slower, not contain too many lines in the loop, certainly no commented out lines, and there is nothing that can be done with a trigger that cant be done with a script
as Chris said, use an array for your list of players
-
If you gonna display the list of a trigger, you will always
see the actual list, containing all objects matching to the trigger's activation conditions like: west present (not the condition field i mean).
i think dat in MP u use ;ots timer trigz 4 dat (one timer - lots timer ::)) not one timer - but i never needed dat so i cant realy tel ya - so did u try it ? or... ? :P
Does it update instantly, or does it update upon request?
dats rights - nd i need str8 answe 4 dat ;) ;D
but ma guess is request - nd in da MP thingyit updates upon request : wen i use lots timer it keeps updating
@ terox - i know dat... 4 vey long time (im scripter 4 about 2 yrz i shud know som thigz bout wat i do ;)) ;D dats not wat we talkin bout :P ;D
LCD OUT
-
@ terox - i know dat... 4 vey long time (im scripter 4 about 2 yrz i shud know som thigz bout wat i do ;)) ;D dats not wat we talkin bout :P ;D
LCD OUT
apologies, it wasn't aimed at you, sorry u thought it was