Home   Help Search Login Register  

Author Topic: the most finite waypoint for domove command  (Read 949 times)

0 Members and 1 Guest are viewing this topic.

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
the most finite waypoint for domove command
« on: 28 May 2006, 17:30:57 »
hello and ty in advance,

                          i am currently making a mission that involves an ai moving around a truck, but i cannot make it move in a very precise manner. i.e waypoints are too big and getmarker pos also, i came up with the idea to place an object on the map, get its position co ordinates from the mission.sqsm and code it as follows. guard1 domove [(10609.662109,19.980000,2125.488770)].  unfortunately the ai dosent go to where those cordinates point to,lol. so have i completely misunderstood , that the position reference in mission.sqsm does not actually correspond to where he object is on the map ? any help aprreciated , ( i am alittle suspect at the 3 lots of numbers , lat,lon,height ??)
I love ofp

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: the most finite waypoint for domove command
« Reply #1 on: 28 May 2006, 18:05:58 »
vehicles driven by ai can be problematic at the best of times. they'll sometimes veer off the road to avoid a bush nowhere near them. however, waypoints are the easiest way to go, as you have discovered telling the ai to go someplace using specific coordinates is just as bad.

the best i can offer is to make the skill of the ai driving the truck maximum, set the waypoint speed to either limited or normal and make sure there are no obstructions on the route to be taken.

and yes, positional arrays are [west/east, north/south, height]. height is optional.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: the most finite waypoint for domove command
« Reply #2 on: 30 May 2006, 00:00:13 »
I understand that you have a soldier walking around a truck, not inside the truck. If so, you may use the following:
Code: [Select]
;Walkaround.sqs by Mandoble
;Arguments
;Walking unit
;Number of steps/2 in initial direction and reverse
;Number of steps/2 in perpendicular direction and reverse
;Number of rounds*2
;
;Example:
;Unit 16 steps forward, turning right,then 8 steps, right, 16 steps, right 8 steps 50 times
;[this,8,4,100]exec"walk.sqs"
_unit = _this select 0
_stepsv = _this select 1
_stepsh = _this select 2
_rounds = _this select 3

_unit setBehaviour "SAFE"
_dir = getDir _unit
_posini = getPos _unit
_r = 0
#round
_i = 0
#govert
_unit playMove "CivilWalkF"
~1
?behaviour _unit != "SAFE":exit
_i = _i + 1
?_i < _stepsv: goto "govert"
_dir = _dir + 90
_unit doWatch [(getPos _unit select 0)+2*sin(_dir),(getPos _unit select 1)+2*cos(_dir), 1.7]
~2
_unit setDir (_dir)

_i = 0
#gohoriz
_unit playMove "CivilWalkF"
~1
?behaviour _unit != "SAFE":exit
_i = _i + 1
?_i < _stepsh: goto "gohoriz"
_dir = _dir + 90
_unit doWatch [(getPos _unit select 0)+2*sin(_dir),(getPos _unit select 1)+2*cos(_dir), 1.7]
~2
_unit setDir (_dir)
_r = _r + 1
;Each 3 rounds the unit is placed at original pos
?_r % 6 == 0:_unit setPos _posini
?_r < (_rounds*2): goto "round"
exit

An example:
Put an ural heading N
Put a soldier heading N at the lower left corner of the Ural, 1.5 meters or so far from the ural's back and from the ural's left side.
Put the following in the soldier's init field:
Code: [Select]
[this,7,2,50]exec"walkaround.sqs"

The soldier will keep walking around the ural until 100 rounds completed or until he switch from SAFE to anyother behaviour.

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Re: the most finite waypoint for domove command
« Reply #3 on: 01 Jun 2006, 00:39:06 »
thank you very much, that will work a treat :)

 much apreciated. :).
I love ofp