Home   Help Search Login Register  

Author Topic: Who's the daddy? Come to daddy!  (Read 533 times)

0 Members and 1 Guest are viewing this topic.

B-2-0

  • Guest
Who's the daddy? Come to daddy!
« on: 01 Jul 2003, 11:01:26 »
Ok, here's what i need to do......when a trigger is flipped, i need a script to run that detects who is the group leader at the time and setpos's another soldier 1m in front of him so that they are facing eachother.....any ideas ???

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Who's the daddy? Come to daddy!
« Reply #1 on: 01 Jul 2003, 11:32:11 »
shudnt b a prob realy ;) :P

find group leader

(leader groupname)

setposing unit in relative position2 oder unit

unitname setpos  [(getpos (leader groupname) select 0) + sin (getdir (leader groupname) + bearing) * distance, (getpos (leader groupname)  select 1) + cos (getdir (leader groupname) + bearing) * distance, 0]

(getpos unit select 0)
Gets the X co-ord of the unit you want to place your object around

sin (getdir unit + bearing) * distance
Here's the business end of it... Using a bit of trig, it gets the sin of the direction the unit is facing, adds any bearing you want, and moves the object out to the distance you specify. So:
unit - The unit you are placing the object relative to
bearing - The offset in relative bearing from the unit where you want the object placed.
Eg. 0 = directly in front of the unit
180 = directly behind the unit
90 = to the unit's right.
Try to imagine a circle of degrees around the unit, with 0 at the top and 180 at the bottom...
distance  - the distance from the unit you want the object to be placed.

serding dir

unitname setdir number

da whole code ?

unitname setpos  [(getpos (leader groupname) select 0) + sin (getdir (leader groupname)+ 0) * 1, (getpos (leader groupname)  select 1) + cos (getdir (leader groupname) + 0) * 1, 0]

unitname setdir ((getdir (leader groupname))-180)

shud work ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta