Jump to content
Sign in to follow this  
Mauser GDog

VBIED to chase BLUFOR

Recommended Posts

I would like to have a VBIED chase BLUFOR units once they have moved into a trigger area.

So far I have found other peoples scripts to:

-detonate VBIEDs inside a trigger area

-detonate VBIEDS when they take fire / damage

I see that you can give a JOIN waypoint to an OPFOR vehicle and make it follow a BLUFOR, but I'd like the VBIED to just drive towards all the BLUFOR in the trigger area, and try to get close before detonating.

Something tells me I will be attaching a trigger to the VBIED to detonte on proximity (BLUFOR present) but it's the chasing part that has me stumped?

Share this post


Link to post
Share on other sites

quick and dirty example, will drive towards any bluefor unit wich is nearest not caring if he drive on roads or offroading.

1: place in init or run on the VBIED unit.

_null = [this] execVM "scriptName.sqf";

2: save this as scriptName.sqf:

_drv = driver (_this select 0);
_noBoom = true;
_dist = 999999;
_target = _drv;
_pos = [];

while {_noBoom} do {
{
	if (side _x == west AND (_x distance (vehicle _drv)) < _dist) then {
		_pos = getPos _x;
		_target = _x;
	};
} foreach allUnits;
_drv doMove _pos;
waitUntil {sleep 1; (_target distance _pos) > 10 OR (_drv distance _target) < 3 OR unitReady _drv};
if (alive _drv AND (_drv distance _target) < 3) then {_noBoom = false};
_dist = _drv distance _target;
};

_drv execVM "yourKaboomScript";

Share this post


Link to post
Share on other sites
quick and dirty example, will drive towards any bluefor unit wich is nearest not caring if he drive on roads or offroading.

1: place in init or run on the VBIED unit.

_null = [this] execVM "[b]scriptName.sqf[/b]";

2: save this as scriptName.sqf:

_drv = driver (_this select 0);
_noBoom = true;
_dist = 999999;
_target = _drv;
_pos = [];

while {_noBoom} do {
{
	if (side _x == west AND (_x distance (vehicle _drv)) < _dist) then {
		_pos = getPos _x;
		_target = _x;
	};
} foreach allUnits;
_drv doMove _pos;
waitUntil {sleep 1; (_target distance _pos) > 10 OR (_drv distance _target) < 3 OR unitReady _drv};
if (alive _drv AND (_drv distance _target) < 3) then {_noBoom = false};
_dist = _drv distance _target;
};

_drv execVM "[b]yourKaboomScript[/b]";

Thanks Demonized, I will try this. Just to clarify the only portion of that script I need to edit is the section I've bolded ("yourKaboomScript") correct?

Optionally I could edit the other 2x sections bolded at the top "scriptName"

Does that make sense?

Thanks

MGD

Share this post


Link to post
Share on other sites
Just to clarify the only portion of that script I need to edit is the section I've bolded ("yourKaboomScript") correct?

Optionally I could edit the other 2x sections bolded at the top "scriptName"

Does that make sense?

Thanks

MGD

Yes thats correct.

Share this post


Link to post
Share on other sites

Demonized, I got it work but is there a way to either:

a) make the VBIED unit stay in place untill triggered by BLUFOR present with a Hold Waypoint & Switch trigger or

b) change the distance between the VBIED unit and the nearest BLUFOR unit to less than 99999 so that BLUFOR has to get close before the VBIED goes into action?

Right now, no matter where my units are, as soon as the mission is previewed, the VBIED begins his hunt for a target.

Share this post


Link to post
Share on other sites

A: place a trigger, name your vbied and in the bluefor present trigger on act field:

_null = [VBIED_name] execVM "scriptName.sqf";

wich will run the hunt on him when trigger is activated.

B: yes, sure, add this after the while line, before the foreach:

while {_noBoom} do {
            waitUntil {sleep 1; ({(vehicle _drv) distance _x) < 500 AND side _x == west} count allUnits) > 0};

500 is the range to be within a bluefor unit before moving.

Share this post


Link to post
Share on other sites

Thank you Demonized, will try both those today. Another observation I made is the VBIED seems to move to the starting location of the enarest BLUFOR and sit there, I don't think it's actually chasing it's targets?

Need to test this more, but noticed last night. Origianaly I thought it was working fine, but that's because I was playing as the nearest BLUFOR but was just sitting still waiting for it to arrive.

Share this post


Link to post
Share on other sites

you know the script was just created on the fly with minimal effort just to give a hint of what to work with, alot more micromanaging would go into it to get it to beheave somewhat "realistic" or more advanced.

i would personally have the VBIED drive randomly around on roads from town to town and only deviate offroad when very close target/ sure kill value could be achieved.

also i would have used a sound (roaring engine) and used setVelocity on the VBIED to make him attempt to ram his targets.

Alot more detail can be added into it, just need to to the legwork, i think armaholic had a VBIED script that were usable for MP aswell and that had all the details in it.

Edit: maybe these can work for you.

http://www.armaholic.com/page.php?id=7224&highlight=VBIED

http://www.armaholic.com/page.php?id=2386&highlight=VBIED

Share this post


Link to post
Share on other sites

I'm new to this but will stick with it, thanks for the help so far.

I will look into all those links and see what I can come up with.

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  

×