OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 28 Jun 2005, 18:54:41
-
okay if i create a trigger east present
on activation : east_units = this list
how would i check if the player or any memeber in his squad knows about any east soldier who is 'east_units' but they have to know eneough to see them as an enemy
i would like to do it with a trigger so i can set pos it over the player so im not getting messages from over 300metres away
-
Click on EDITORS DEPOT
Click on the + sign next to ONLINE REFERENCES
Click on Commands
Clickon K
Read about Knowsabout
The magic number is 0.105
-
You also might want to check out this function:
http://www.ofpec.com/editors/funcref.php?filter_func=47
-
right thnaks alot ive had a look at the function wich i dont uderstand but another read through of the description should help
also im going to have alook at the com ref now
-
I don't know if it would suit your needs (and I haven't used it for a while) but there is the low-tech option of using a trigger set up as 'East detected by West'. Might be worth experimenting with.
-
okay i tried te function wich i think has kind of worked but the group chat is getting an error something like nt expected string or something like that heres the script
_unitknown = [west_units, [east1,east2,east3,east4,east5,east6,east7,east8], true] call knownUnits
_hourdir = [player,_unitwich] call DirInhour
_distunit = [getpos _unitwich,getpos player] call distancePos
player groupchat [format ["CONTACT %1 AT %2",_distunit,_hourdir]]
it should if west units knows about anyof the east units selected and then check the direction and distance from the player to that unit then the player should group chat that the east unit is "distance" then "direction"
whats wrong here
-
player groupchat [format ["CONTACT %1 AT %2",_distunit,_hourdir]]should be
player groupchat format ["CONTACT %1 AT %2",_distunit,_hourdir]
-
Well, check again and you'll see that my function returns an ARRAY of units known. If you want the nearest known unit, then use the first element of the returned array. But first check to see if the array has ANY elements, because if it doesn't, then no units are known.
Also, you use different variable names in your script, which might be an error (unless they are defined before this).
-
hey how can i get the first ellemtent in the array ?
-
array select 0