Jump to content
Sign in to follow this  
MrZig

New script a friend just made! interesting

Recommended Posts

Hi, I was trying to keep a trigger constantly in front of a chopper, like it's searchlight, and "revealing" all that was in it, but it wouldn't follow in front, so Korax made this script, but he is too lazy to post it smile_o.gif

Here it is, also useful for an MG on a vehicle.

Activated via [man1,man2] exec "setpos.sqs"

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

_unit2 = _this select 1

#loop

_dir = getdir _unit

_sin = sin (_dir) *50

_cos = cos (_dir) *50

_posX = (getpos _unit select 0)

_posY = (getpos _unit select 1)

_Xpos = (_posX)+(_sin)

_Ypos = (_posY)+(_cos)

_unit2 setpos [_Xpos,_Ypos,3.5]

_unit2 setdir getdir _unit

~.01

goto "loop"

Change the *50 to how far you want it, and <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit2 setpos [_Xpos,_Ypos,3.5] would mean it is 3.5 metres high, change that to whatever you want, and whatever is _unit2, be it a flying plane, it'll stay right in front of you, no matter which way you turn, and it'll face your direction.

Take out the setdir and you can almost make a matrix style movie ;-)

MADE BY KORAX

Share this post


Link to post
Share on other sites

Sounds like the firelord script I helped Devilchaser with. It was the same concept, except it was a round trigger which was kept directly on top of the firelord. The script would grab all of the items in the trigger and pick out the ones that were in a triangle shaped area of the trigger facing out from the firelord/center of the trigger. This simulated a realistic view area, and enable the firelord to detect enemies that were anywhere from 1 meter to the end of the trigger, as long as they were in his virtual 'line of sight'. The end result was that if you were the firelord an you could see an enemy on your screen, the trigger would detect it and you could use your magic firelord powers on it. :P

Share this post


Link to post
Share on other sites

you guys are smart. and the programmability of ofp through scripts is awesome. it is a very kool engine.

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  

×