Jump to content
Sign in to follow this  
Bracken

Ai group respawn

Recommended Posts

Hi,

I'm having problems with a script I have tried to put together from ideas I got from Norrins AI_foot script, but instead using groups... however I am still learning it all so its abit of a struggle.

I think it must be a basic sytax stuff up/misunderstanding because It does not give me an error.  The group does not respawn at all, once they are all dead.

Any help much appreciated.

It is exec'ed with the code

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">a=grpzA execVM "alivey1.sqf";

GrpzA being the group name

wy1,wy2,wy3 are different varibles, depending on how the battle is going.

reswn is a public varible which counts how many times they have respawned.  I would guess I probably went about it the wrong way.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (!local Server) exitWith {};

private "_grpAlive","_group","_name";

_group = _this select 0;

_name = format ["%1",_group];

_grpAlive = true;

while{_grpAlive}do

   {

    if ( {alive _x} count units _group < 1 )

then { _grpAlive = false;reswn=reswn + 1;publicvariable "reswn"}

    else {sleep 10}

   };

if (reswn > 8) exitWith {}

else {

"VIL_SOLDIEReBSTG2" createUnit [getMarkerPos "base1", _name];

"VIL_SOLDIEReBmp2" createUnit [getMarkerPos "base1", _name];

"VIL_SOLDIEReBkarzl" createUnit [getMarkerPos "base1", _name];

"VIL_SOLDIEReBkarzl" createUnit [getMarkerPos "base1", _name];

"VIL_SOLDIEReBmg2" createUnit [getMarkerPos "base1", _name];

"VIL_SOLDIEReBmg2" createUnit [getMarkerPos "base1", _name];

"VIL_SOLDIEReBkarzl" createUnit [getMarkerPos "base1", _name];

};

sleep 5;

_Waychoice= [wy1,wy2,wy3];

switch (_waychoice) do {

case 1: {_way0 = _name addWaypoint [ (getMarkerPos "A_1st"), 1];

[_way0, 1] setWaypointType "SAD";

[_way0, 1] setWaypointFormation "LINE";};

case 2: {_way1 = _name addWaypoint [ (getMarkerPos "A_2nd"), 1];

[_way1, 1] setWaypointType "SAD";

[_way1, 1] setWaypointFormation "LINE";};

case 3: {_way2 = _name addWaypoint [ (getMarkerPos "A_3rd"), 1];

[_way2, 1] setWaypointType "SAD";

[_way2, 1] setWaypointFormation "LINE";};

};

sleep 10;

if (true) exitwith {A=_name execVM "alivey1.sqf"};

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  

×