Home   Help Search Login Register  

Author Topic: M1Abrams refuses to "Move"  (Read 937 times)

0 Members and 1 Guest are viewing this topic.

Offline myke13021

  • Contributing Member
  • **
  • Myke
M1Abrams refuses to "Move"
« on: 24 Aug 2007, 20:38:00 »
Ok, slowly i'm getting mad about this one. Got this really simple patrol script (well, in fact just move around but it is good enough for what i need)..

Code: [Select]
private ["_group", "_dist", "_array", "_leader", "_gl", "_start_pos", "_pos", "_xpos", "_ypos", "_dir", "_vehicle", "_inrange"];

_group = _this select 0;
_dist = _this select 1;
_array = _this select 2;
_leader = leader _group;
_vehicle = vehicle _leader;
_inrange = false;

_gl = "logic" createvehicle [0,0,0];
_start_pos = _array select (floor (random (count _array)));
_gl setpos getmarkerpos _start_pos;
_group move getpos _gl;
while {count units _group > 0} do
{
while {!(_inrange)} do
{
_dist = _gl distance _vehicle;
if (_dist < 20) then
{
_inrange = true;
};
};
if (random 100 > 75) then
{
_start_pos = _array select (floor (random (count _array)));
_pos = getmarkerpos _start_pos;
};
_dir = random 360;
_xpos = (_pos select 0) + ((random _dist))* sin _dir;
_ypos = (_pos select 1) + ((random _dist))* cos _dir;
_pos = [_xpos, _ypos];
_gl setpos _pos;
_group move getpos _gl;
_inrange = false;
};
deletevehicle _gl;

Parameters passed:
_group = Vehicles group; check with hint shows correct group
_dist = 200; also this i checked with a hint
_array = array containing several marker names; for testing i have just one marker and a hint shows correct ["go"]

The logic i created is actually part of my tries to solve the problem.

before i tried the
while {!(_inrange)} do
i had a waituntil which had condition (_gl distance _vehicle < 20) which also didn't work.

If someone could point the problem for me...before i bite my a$$


Myke out.

- SOLVED -

The problem wasn't in this script (which had also a few glitches were Mandoble pointed me at, thx Mandoble) but in the previous from which the above script was launched...a dostop command messed it up.
« Last Edit: 25 Aug 2007, 00:14:03 by myke13021 »