OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 28 Jun 2005, 18:54:41

Title: knows about any east side
Post 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
Title: Re:knows about any east side
Post by: THobson on 28 Jun 2005, 22:51:58
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
Title: Re:knows about any east side
Post by: General Barron on 28 Jun 2005, 23:08:35
You also might want to check out this function:

http://www.ofpec.com/editors/funcref.php?filter_func=47
Title: Re:knows about any east side
Post by: 456820 on 29 Jun 2005, 16:15:19
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
Title: Re:knows about any east side
Post by: ACF on 29 Jun 2005, 16:36:09
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.
Title: Re:knows about any east side
Post by: 456820 on 29 Jun 2005, 18:09:46
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

Code: [Select]
_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
Title: Re:knows about any east side
Post by: h- on 29 Jun 2005, 20:46:20
Code: [Select]
player groupchat [format ["CONTACT %1 AT %2",_distunit,_hourdir]]should be
Quote
player groupchat format ["CONTACT %1 AT %2",_distunit,_hourdir]
Title: Re:knows about any east side
Post by: General Barron on 30 Jun 2005, 01:49:43
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).
Title: Re:knows about any east side
Post by: 456820 on 30 Jun 2005, 16:15:45
hey how can i get the first ellemtent in the array ?
Title: Re:knows about any east side
Post by: qqqqqq on 30 Jun 2005, 17:09:25
array select 0