Home   Help Search Login Register  

Advertisement

Author Topic: Problem with setting a direction of the AI.  (Read 1814 times)

0 Members and 1 Guest are viewing this topic.

Offline Rytuklis

  • Members
  • *
Problem with setting a direction of the AI.
« on: 27 Aug 2014, 19:10:33 »
Good evening,

I'm making a scene where I want the civilian to approach a checkpoint with a vehicle and disembark it. Then I want to teleport the civilian infront of the CSAT Soldier so they have a conversation, however I can't make the civilian facing the CSAT Soldier. I tried several methods, one is setting the azimuth of the marker I use to teleport the civilian to face the CSAT Soldier  and then use civilian1 setdir getdir "tpciv" (marker name is tpciv). Does not work, he's facing away. Then I try to add another civlian in the distance and name him "dirforciv" and set the azimuth that would face the soldier. Then again I try to do civilian1 setdir getdir "dirforciv" and still can't get it to work. Can you tell me what's the problem? This is my entire code here:

Code: [Select]
; ****************************************************************
; Script file for Armed Assault
; Created by: TODO: Author Name
; ****************************************************************

showcinemaBorder false
_camera = "camera" camCreate [9292.85,20328.67,134.92];
_camera cameraEffect ["internal","back"]

;comment "19:26:23";
_camera camPrepareTarget [82711.22,-46332.73,13038.85];
_camera camPreparePos [9292.85,20328.67,134.92];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 4
titleCut ["Abderos, Altis. Present..","PLAIN DOWN"]
@camCommitted _camera

;comment "19:28:01";
_camera camPrepareTarget [82711.22,-46332.73,13038.91];
_camera camPreparePos [9285.59,20335.21,40.75];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 8
titleCut ["Abderos, Altis. Present..","PLAIN DOWN"]
@camcommitted _camera

cdrive = true

_camera = "camera" camCreate [9466.24,20100.10,0.58];
_camera cameraEffect ["internal","back"]

;comment "19:30:36";
_camera camPrepareTarget [-88646.07,742.99,113.76];
_camera camPreparePos [9466.24,20100.10,0.58];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 0
@camcommitted _camera

;comment "19:32:00";
_camera camPrepareTarget civguer1
_camera camsettarget civguer1
_camera camPreparePos [9464.11,20097.19,0.90];
_camera camPrepareFOV 0.306;
_camera camCommitPrepared 12
@camcommitted _camera

civguer1 action ["eject", vehicle gcar1]
titleCut ["","BLACK OUT",3]
~3
civguer1 disableAI "MOVE"
civguer1 setdir getdir "dirforciv"
civguer1 setpos getmarkerpos "tpciv"
grd2 dotarget civguer1
titleCut ["","BLACK FADED",4]
~4

_camera = "camera" camCreate [9458.96,20098.70,1.59];
_camera cameraEffect ["internal","back"]

titleCut ["","BLACK IN",3]

;comment "19:45:56";
_camera camPrepareTarget [-25328.32,-69637.05,-27039.82];
_camera camPreparePos [9458.96,20098.70,1.59];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 0
grd1 switchMove "Acts_ComingInSpeakingWalkingOut_5"
titlecut ["Show me your papers.","PLAIN DOWN"]
@camcommitted _camera

;comment "19:47:12";
_camera camPrepareTarget [-53012.51,96890.88,-14005.83];
_camera camPreparePos [9459.88,20093.61,1.76];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 8
@camcommitted _camera

« Last Edit: 27 Aug 2014, 19:12:40 by Rytuklis »

Offline Rytuklis

  • Members
  • *
Re: Problem with setting a direction of the AI.
« Reply #1 on: 27 Aug 2014, 19:15:35 »
EDIT: Nope... Still occurs..
« Last Edit: 27 Aug 2014, 19:39:04 by Rytuklis »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Problem with setting a direction of the AI.
« Reply #2 on: 29 Aug 2014, 10:04:22 »
sqs?... sqs!?... SQS!!!!

 :D

Anyway, have you tried lookAt ? At least in my quick test it made unit turn to look another. Would look a bit more natural than setdir.

EDIT:
Also, you can't get the marker's dir with getDir, you need markerDir.
« Last Edit: 29 Aug 2014, 10:16:46 by h- »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Re: Problem with setting a direction of the AI.
« Reply #3 on: 31 Aug 2014, 22:18:26 »
unit1 setDir [unit1, unit2] call BIS_fnc_dirTo

 Did you try tge DirTo function ?

  https://community.bistudio.com/wiki/BIS_fnc_dirTo

 Also make sure the anination itself doesnt turn the unit in tge first keyframes , if it does offset it :)

 
I love ofp

Offline Rytuklis

  • Members
  • *
Re: Problem with setting a direction of the AI.
« Reply #4 on: 01 Sep 2014, 15:41:58 »
LookAt worked for me, thanks!