Home   Help Search Login Register  

Author Topic: Move tanks 100m in front of player.  (Read 1720 times)

0 Members and 2 Guests are viewing this topic.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Move tanks 100m in front of player.
« on: 01 Jan 2017, 15:07:29 »
I have some tanks that I would like to move to 100m in front of my position via radio command. What lines should I use in my script?

James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Move tanks 100m in front of player.
« Reply #1 on: 01 Jan 2017, 15:45:40 »
I guess the command moveTo would be useful.
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline SoldierEPilot

  • Members
  • *
Re: Move tanks 100m in front of player.
« Reply #2 on: 01 Jan 2017, 21:45:28 »
Think on your sins and cosins :D

Code: [Select]
_r = 100;
_pos = getPos player;
_dir = getDir player;
_x = (_pos select 0)+_r*sin _dir;
_y = (_pos select 1)+_r*cos _dir;
CmdTank moveTo [_x, _y];

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: Move tanks 100m in front of player.
« Reply #3 on: 02 Jan 2017, 12:50:30 »
LMAO, that's maths right?

How do I add this to a handy little script?
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Move tanks 100m in front of player.
« Reply #4 on: 03 Jan 2017, 14:44:46 »
That already is a handy script :P
(although for performance's sake it's not necessary to declare so many variables).

If your tank group's leader tank is MyTank, add the following to your radio trigger on act field:
Code: [Select]
MyTank moveTo [(position player select 0)+100*sin(direction player), (position player select 1)+100*cos(direction player)].

That makes them drive to 100 meters in front of the player (or more accurately where player's chest is pointing).
Of course you need to account the horrible driving capabilities of the AI and they might not ever get there..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.