Jump to content
Edwin de Beer

respawn group AI help please.

Recommended Posts

Hello guys.

 

Could someone please help me with my script?

I made a script for respawning a few groups of German soldiers.

In the editor i put a trigger 50 meter around the Marker were the AI spawn in script.

When a player goes in the trigger it removes the trigger were the Ai spawn. (so the spawning stops)

QUESTION: Is this also possible in the script itself. This is my script:

 

if (!isServer) exitWith {};

 

    _grpInf1 = [getmarkerpos "spawn1Inf", WEST,  

   

[    "LIB_GER_gun_unterofficer",
    "LIB_GER_mgunner",
    "LIB_GER_soldier_MP40",
    "LIB_GER_soldier_K98"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
    
    _spawn1InfWp1 = _grpInf1 addWaypoint [getmarkerpos "spawn1InfWp1", 0];        
{    
    _x setSkill ["aimingspeed", 0.3];
    _x setSkill ["aimingaccuracy", 0.1];
    _x setSkill ["aimingshake", 0.01];
    _x setSkill ["spottime", 0.8];
    _x setSkill ["spotdistance", 0.8];
    _x setSkill ["commanding", 1];
    _x setSkill ["general", 0.8];
    _x allowFleeing 0;    

}     foreach units _grpInf1;

 

    _spawn1InfWp1 setWaypointType "SAD";
    _spawn1InfWp1 setWaypointSpeed "Full";
    _spawn1InfWp1 setWaypointBehaviour "COMBAT";
    _spawn1InfWp1 setWaypointFormation "FILE";
    _spawn1InfWp1 setWaypointCombatMode "RED";
    
sleep 5;

 

    _grpInf2 = [getmarkerpos "spawn2Inf", WEST,   

 

[    "LIB_GER_gun_unterofficer",
    "LIB_GER_mgunner",
    "LIB_GER_soldier_MP40",
    "LIB_GER_soldier_K98"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
    
    _spawn2InfWp1 = _grpInf2 addWaypoint [getmarkerpos "spawn2InfWp1", 0];        
{    
    _x setSkill ["aimingspeed", 0.3];
    _x setSkill ["aimingaccuracy", 0.1];
    _x setSkill ["aimingshake", 0.01];
    _x setSkill ["spottime", 0.8];
    _x setSkill ["spotdistance", 0.8];
    _x setSkill ["commanding", 1];
    _x setSkill ["general", 0.8];
    _x allowFleeing 0;    

}     foreach units _grpInf2;

 

    _spawn2InfWp1 setWaypointType "SAD";
    _spawn2InfWp1 setWaypointSpeed "Full";
    _spawn2InfWp1 setWaypointBehaviour "COMBAT";
    _spawn2InfWp1 setWaypointFormation "FILE";
    _spawn2InfWp1 setWaypointCombatMode "RED";

   

 

Share this post


Link to post
Share on other sites

Is that script a loop? I can't really see why it should continuously spawn units.

Share this post


Link to post
Share on other sites

No it spawns 4 Ai soldiers on two differend locations, but in the original script I did this script 4x with sleep 60 and sleep 120;

 


if (!isServer) exitWith {};

 

    _grpInf1 = [getmarkerpos "spawn1Inf", WEST,     

[    "LIB_GER_gun_unterofficer",
    "LIB_GER_mgunner",
    "LIB_GER_soldier_MP40",
    "LIB_GER_soldier_K98"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
    
    _spawn1InfWp1 = _grpInf1 addWaypoint [getmarkerpos "spawn1InfWp1", 0];        
{    
    _x setSkill ["aimingspeed", 0.3];
    _x setSkill ["aimingaccuracy", 0.1];
    _x setSkill ["aimingshake", 0.01];
    _x setSkill ["spottime", 0.8];
    _x setSkill ["spotdistance", 0.8];
    _x setSkill ["commanding", 1];
    _x setSkill ["general", 0.8];
    _x allowFleeing 0;    

}     foreach units _grpInf1;

 

    _spawn1InfWp1 setWaypointType "MOVE";
    _spawn1InfWp1 setWaypointSpeed "Full";
    _spawn1InfWp1 setWaypointBehaviour "COMBAT";
    _spawn1InfWp1 setWaypointFormation "FILE";
    _spawn1InfWp1 setWaypointCombatMode "RED";
    
sleep 60;


    _grpInf2 = [getmarkerpos "spawn2Inf", WEST,     

[    "LIB_GER_gun_unterofficer",
    "LIB_GER_mgunner",
    "LIB_GER_soldier_MP40",
    "LIB_GER_soldier_K98"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
    
    _spawn2InfWp1 = _grpInf2 addWaypoint [getmarkerpos "spawn2InfWp1", 0];        
{    
    _x setSkill ["aimingspeed", 0.3];
    _x setSkill ["aimingaccuracy", 0.1];
    _x setSkill ["aimingshake", 0.01];
    _x setSkill ["spottime", 0.8];
    _x setSkill ["spotdistance", 0.8];
    _x setSkill ["commanding", 1];
    _x setSkill ["general", 0.8];
    _x allowFleeing 0;    

}     foreach units _grpInf2;

 

    _spawn2InfWp1 setWaypointType "MOVE";
    _spawn2InfWp1 setWaypointSpeed "Full";
    _spawn2InfWp1 setWaypointBehaviour "COMBAT";
    _spawn2InfWp1 setWaypointFormation "FILE";
    _spawn2InfWp1 setWaypointCombatMode "RED";
    
sleep 120;

    _grpInf1 = [getmarkerpos "spawn1Inf", WEST,     

[    "LIB_GER_rifleman",
    "LIB_GER_rifleman",
    "LIB_GER_rifleman"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
    
    _spawn1InfWp1 = _grpInf1 addWaypoint [getmarkerpos "spawn1InfWp1", 0];        
{    
    _x setSkill ["aimingspeed", 0.3];
    _x setSkill ["aimingaccuracy", 0.1];
    _x setSkill ["aimingshake", 0.01];
    _x setSkill ["spottime", 0.8];
    _x setSkill ["spotdistance", 0.8];
    _x setSkill ["commanding", 1];
    _x setSkill ["general", 0.8];
    _x allowFleeing 0; 
  

}     foreach units _grpInf1;

 

    _spawn1InfWp1 setWaypointType "MOVE";
    _spawn1InfWp1 setWaypointSpeed "Full";
    _spawn1InfWp1 setWaypointBehaviour "COMBAT";
    _spawn1InfWp1 setWaypointFormation "FILE";
    _spawn1InfWp1 setWaypointCombatMode "RED";
    
sleep 60;

    _grpInf1 = [getmarkerpos "spawn2Inf", WEST,     

[    "LIB_GER_rifleman",
    "LIB_GER_rifleman",
    "LIB_GER_rifleman"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
    
    _spawn2InfWp1 = _grpInf1 addWaypoint [getmarkerpos "spawn2InfWp1", 0];        
{    
    _x setSkill ["aimingspeed", 0.3];
    _x setSkill ["aimingaccuracy", 0.1];
    _x setSkill ["aimingshake", 0.01];
    _x setSkill ["spottime", 0.8];
    _x setSkill ["spotdistance", 0.8];
    _x setSkill ["commanding", 1];
    _x setSkill ["general", 0.8];
    _x allowFleeing 0;    

}     foreach units _grpInf1;

 

    _spawn2InfWp1 setWaypointType "MOVE";
    _spawn2InfWp1 setWaypointSpeed "Full";
    _spawn2InfWp1 setWaypointBehaviour "COMBAT";
    _spawn2InfWp1 setWaypointFormation "FILE";
    _spawn2InfWp1 setWaypointCombatMode "RED";

    
sleep 60;

 

    _grpInf1 = [getmarkerpos "spawn1Inf", WEST,     

[    "LIB_GER_gun_unterofficer",
    "LIB_GER_mgunner",
    "LIB_GER_soldier_MP40",
    "LIB_GER_soldier_K98"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
    
    _spawn1InfWp1 = _grpInf1 addWaypoint [getmarkerpos "spawn1InfWp1", 0];        
{    
    _x setSkill ["aimingspeed", 0.3];
    _x setSkill ["aimingaccuracy", 0.1];
    _x setSkill ["aimingshake", 0.01];
    _x setSkill ["spottime", 0.8];
    _x setSkill ["spotdistance", 0.8];
    _x setSkill ["commanding", 1];
    _x setSkill ["general", 0.8];
    _x allowFleeing 0;    

}     foreach units _grpInf1;

 

    _spawn1InfWp1 setWaypointType "MOVE";
    _spawn1InfWp1 setWaypointSpeed "Full";
    _spawn1InfWp1 setWaypointBehaviour "COMBAT";
    _spawn1InfWp1 setWaypointFormation "FILE";
    _spawn1InfWp1 setWaypointCombatMode "RED";

 

_________________________ Here i want a scriptline that if people are close to the spawnmarker (spawn1Inf, spawn2Inf) the marker disapears.

So the AI doesn't spawn infront of the players.

 

 

Share this post


Link to post
Share on other sites
_mrkPos1 = getMarkerPos "spawn1Inf";
_mrkPos2 = getMarkerPos "spawn2Inf";
if (
    allPlayers findIf {
        _mrkPos1 distance _x < 50 OR 
        _mrkPos2 distance _x < 50
    } != -1
) then {
    // Whatever
};

This condition will execute the "then" statement when at least one player is closer than 50m to either one of the markers.

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

×