Jump to content
Sign in to follow this  
Scatoogle

DoMove not working

Recommended Posts

I have searched and searched and searched.

For some reason I have a script that won't work. The Idea is that the Suicide Bomber should run at you however he doesn't run.

I have debugged and had it return values and everything is working as it should like perfection but it won't make the AI move.

Sleep 5;
_i=0;
_Exit = 0;
Hint format ["%1 %2 %3", GetPos _Unit1,GetPos _DeadThing, _Exit];
_Unit1 = _this Select 0;
_HMMWV = [HMMWV1, HMMWV2, HMMWV3, HMMWV4, HMMWV5, HMMWV6, HMMWV7, HMMWV8, HMMWV9, HMMWV10, SOV1, SOV2, SOV3, SOV4, SOV5, SOV6, SOV7, SOV8, SOV9, SOV10];
_DeadThing = [0,0,0];

While {_Exit == 0} Do {

If (_i < 30) Then {_i=_i+1};
If (_i >= 30) Then {_i=0};
_NearUnit = (position _Unit1) nearEntities 15 Select _i;
_NearVehicle = (position _Unit1) nearObjects ["Car", 15] Select _i;

If (_NearUnit in BList) Then {
_Exit = 1;
_DeadThing = _NearUnit;
};

};
Hint "Loop Done";
_BombLocation = CreateMarker["BombLocation1", Position _DeadThing];
_Pos  = GetMarkerPos "BombLocation1";
_Unit1 Move [((_Pos)select 0), ((_Pos)select 1)];
"BombLocation1" setMarkerType "Warning";
_Exit = 0;

While {_Exit == 0} Do {
_Dist = (_Unit1 Distance (getMarkerPos "BombLocation1"));
Hint format ["%1 %2 %3 %4 %5", GetPos _Unit1,GetPos _DeadThing, _Exit, _pos, _Dist];
if (_Dist < 10) Then {

hint "Allah Hu Akbar";
Sleep 2;
_SB = "R_80mm_HE" CreateVehicle (GetPos _Unit1);

};

};

Nul = [This]execVM"SB.sqf";

Share this post


Link to post
Share on other sites

The script isn't making much sense to me.

the vehicle array doesn't seem to be used _ HMMWV = [HMMWV1, ect along with _NearVehicle = (position _Unit1) nearObjects ["Car", 15] Select _i;

BList isn't set up this script maybe it is somewhere else, does it contain list of targets?

I set it up to contain several units and the bomber runs to those units and explodes.

He also only runs to the last man in the list and that will only happen if it's within 15 meters of the bomber.

I'm a little rusty so it may be just me.

Share this post


Link to post
Share on other sites

BList has its own Game Logic and I removed the use of _HMMWV to simplify the logic.

It is designed to attack convoys so that it may not get the car infront but it will get the one in the back.

However, All of these work. I want to know how to may the bomber move.

Share this post


Link to post
Share on other sites

You're using "move" which basically requires a group and creates a waypoint. doMove should work just fine.

Share this post


Link to post
Share on other sites

How I have it set up move is working, although I may not have it set up correctly.

I still don't know if your trying to blow up cars or people.

For Vehicles you need to change BList to _HMMWV other changes are noted in the script.

Sleep 5;
_i=0;
_Exit = 0;
Hint format ["%1 %2 %3", GetPos _Unit1,GetPos _DeadThing, _Exit];
_Unit1 = _this Select 0;
_HMMWV = [HMMWV1, HMMWV2, HMMWV3, HMMWV4, HMMWV5, HMMWV6, HMMWV7, HMMWV8, HMMWV9, HMMWV10, SOV1, SOV2, SOV3, SOV4, SOV5, SOV6, SOV7, SOV8, SOV9, SOV10];
_DeadThing = [0,0,0];

While {_Exit == 0} Do {

If (_i < 10) Then {_i=_i+1}; // reducing these values stopped an error 
If (_i >= 10) Then {_i=1};   // reducing these values stopped an error, if there are less than 10 in the area you will get an error
_NearUnit = (position _Unit1) nearEntities 35 Select _i; // incresed this to see the unit move more easily
//_NearVehicle = (position _Unit1) nearObjects ["Car", 15] Select _i;  // removed this line

If (_NearUnit in _HMMWV) Then { // changed this to from BList to _HMMWV
_Exit = 1;
_DeadThing = _NearUnit;
};

};
Hint "Loop Done";
//sleep 5;
_BombLocation = CreateMarker["BombLocation1", Position _DeadThing];
_Pos  = GetMarkerPos "BombLocation1";
_Unit1 Move [((_Pos)select 0), ((_Pos)select 1)];
"BombLocation1" setMarkerType "Warning";
_Exit = 0;

While {_Exit == 0} Do {
_Dist = (_Unit1 Distance (getMarkerPos "BombLocation1"));
Hint format ["%1 %2 %3 %4 %5", GetPos _Unit1,GetPos _DeadThing, _Exit, _pos, _Dist];
if (_Dist < 10) Then {

hint "Allah Hu Akbar";
Sleep 2;
_SB = "R_80mm_HE" CreateVehicle (GetPos _Unit1);
_exit=1;// this stops it repeating 
};
sleep 0.1;// this slows it down
};

There may also be a problem with nearEntities, it may be better to specify what your looking for otherwise other objects will be detected.

_NearUnit = (position _Unit1) nearEntities ["car",35] Select _i;

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×