Jump to content
Sign in to follow this  
Hinny

Appearing friendly to enemy units

Recommended Posts

Okay, I want to set up a script where if me or my team are in a captured enemy vehicle we'll appear friendly to them unless we get too close.

The questions I need answering is how can I make a script that checks this (bearing in mind there can will be loads of possible enemy vehicles).

Also how do I then check distance from an enemy unit? I could do this if it were a specific enemy unit but what about them in general?

Share this post


Link to post
Share on other sites

This has some serious potential.

I'd like to see a script like this made.

Share this post


Link to post
Share on other sites

Aha, try this script.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;;Make a trigger, activated by East present, on activation should be EList = thislist

~3

_list = EList

_x = 0

_max = count _list

#loop

~0.05

?_X >= _max : _X = 0

_y = _list select _x

;hint format ["%1",player distance _y]

?vehicle player distance _y <5 : goto "spotted"

_x = _x + 1

goto "loop"

#spotted

hint "You got to close to the enemy!"

player setcaptive false

exit

Share this post


Link to post
Share on other sites

hmm - checking the distance amongst each unit from

a trigger's list can become a bit odd.

Why not check if the number of units from that trigger's list,

closer than 5 meters to the player's vehicle is more than 0.

#loop

?"(vehicle player distance _x < 5)" count Elist > 0: goto "discovered"

~3

goto "loop"

:note - i wouldn't use 5 meters, as it's very close, and it would

be no problem for the player to overrun each enemy, before

he's even able to target the player.

::note - Also i wouldn't use: goto "enemy", as enemy is a reserved variable.

:::note - vehicle player is necessary, as the distance

check will be useless, in case of the player is inside a vehicle.

~S~ CD

Share this post


Link to post
Share on other sites

Er, no, actually.

It works perfectly fine, I went in a UAZ, ran teh script, went to 5 metres and I got detected and got fired apon.

Enemy reserved? It's not a public variable, it's only a "goto" part, those arn't public.. I don't see what you want me to do.

Share this post


Link to post
Share on other sites

errm - how comes you think i want you to do anything  rock.gif

OK, player distance object (in a vehicle) works in singleplayer and now.

As i'm editing missions for a long time now + a lot of multiplayer stuff, all i can tell you is:

unit distance unit (when having been inside a vehicle) did not

work 1 1/2 year ago in multiplayer on a dedicated server.

I can't tell you right now, if it's been an issue with a previous

version of OFP, or with multiplayer, but it's always been my

goal, not to run twice into the same mistake. Therefore i haven't tried unit distance unit without the vehicle unit a second time from there.

I know nobody was talking about mp here, but ppl tend to use

working techniques from sp in mp editing aswell, just to not

have a clue later then, why it doesn't work anymore, as the

syntax looks so fine. Therefore i started to use and to suggest

rather methods, which will work for both (sp/mp), than only

in sp.

Now the goto "enemy" thingy;

Reserved variables or command-names will cause not a problem when being used for goto's so:

feel free to use reserved variables in goto statements, but

i very often noticed that ppl also tend to screw their command functionality up by using reserved variables in another way than it's supposed to be. This will start with

harmless goto's, and then when they don't think about it

anymore, they will use same var-names for other stuff like

global variables.

At least it should be told to ppl, that enemy is a reserved

variable, when suggesting to use it in another way.

Ya know, i've been supporting a lot of ppl by solving probs for

their missions in ofp now, and i've seen a lot of mistakes being

made because of theories, which did work here, but not there.

Sorry if you felt my post offense to you, that wasn't my intension here  smile_o.gif

:edit - ah yeah, one thing i forgot:

5 meters distance is not enough for sure

The only noise i could hear when doing that was: aaaaargh,

when i drove over them guys - no time for any of these

enemies standing around to even think about killing me.

Maybe it'll work when riding on a bycicle biggrin_o.gif

~S~ CD

Share this post


Link to post
Share on other sites

Yes you can run em over, BUT you don't want to because all the enemies up ahead will shoot at you, right?

I think he wants to steal a vehicle and sneak past them.

Share this post


Link to post
Share on other sites

Thanks both of you.

About the distance - that's easy enough to edit, depending on your purposes. I wouldn't argue about that point.

Question - (I haven't had time to test). After you are detected by one person, would all enemy's be aware that you are an enemy at that point? Or does each enemy have to detect you individually?

Share this post


Link to post
Share on other sites

Not sure if this will help, but: Here's a lo-tech solution I tested. Wait until dusk. I drove right past gate guards and into a base at about 6:30 pm in May on Nogova. It was dark but not pitch black. I was able to get out of the truck, too.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×