Jump to content
GodsFist

Is there an easier way for my script.

Recommended Posts

Good morning guys i have a question?

I've made a script were every 20 seconds a VC soldiers spawns out of a tunnel entrance.

 

//null = execVM"scripts\spawnSingleTask2.sqf";

_spawnVc3 = [];
_spawnVc4 = [];

if (isServer) then {

        _spawnVc3 = [getmarkerpos "spawnSingle3", EAST,
        
            ["uns_men_VC_local_RF1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;    

        _spawnSingle3Wp = _spawnVc3 addWaypoint [getmarkerpos "spawnSingle3Wp", 0];
    
        {    
            _x setSkill ["aimingspeed", 0.3];
            _x setSkill ["aimingaccuracy", 0.01];
            _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 _spawnVc3;

    _spawnSingle3Wp setWaypointType "SAD";
    _spawnSingle3Wp setWaypointSpeed "Full";
    _spawnSingle3Wp setWaypointBehaviour "AWARE";
//    _spawnSingle3Wp setWaypointFormation "LINE";
    _spawnSingle3Wp setWaypointCombatMode "RED";

sleep 20;

        _spawnVc4 = [getmarkerpos "spawnSingle4", EAST,
        
            ["uns_men_VC_local_RF1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;    

        _spawnSingle4Wp = _spawnVc4 addWaypoint [getmarkerpos "spawnSingle4Wp", 0];
    
        {    
            _x setSkill ["aimingspeed", 0.3];
            _x setSkill ["aimingaccuracy", 0.01];
            _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 _spawnVc2;

    _spawnSingle4Wp setWaypointType "SAD";
    _spawnSingle4Wp setWaypointSpeed "Full";
    _spawnSingle4Wp setWaypointBehaviour "COMBAT";
//    _spawnSingle4Wp setWaypointFormation "LINE";
    _spawnSingle4Wp setWaypointCombatMode "RED";

sleep 20;

        _spawnVc3 = [getmarkerpos "spawnSingle3", EAST,
        
            ["uns_men_VC_local_RF1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;    

        _spawnSingle3Wp = _spawnVc3 addWaypoint [getmarkerpos "spawnSingle3Wp", 0];
    
        {    
            _x setSkill ["aimingspeed", 0.3];
            _x setSkill ["aimingaccuracy", 0.01];
            _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 _spawnVc3;

    _spawnSingle3Wp setWaypointType "SAD";
    _spawnSingle3Wp setWaypointSpeed "Full";
    _spawnSingle3Wp setWaypointBehaviour "AWARE";
//    _spawnSingle3Wp setWaypointFormation "LINE";
    _spawnSingle3Wp setWaypointCombatMode "RED";

sleep 20;

        _spawnVc4 = [getmarkerpos "spawnSingle4", EAST,
        
            ["uns_men_VC_local_RF1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;    

        _spawnSingle4Wp = _spawnVc4 addWaypoint [getmarkerpos "spawnSingle4Wp", 0];
    
        {    
            _x setSkill ["aimingspeed", 0.3];
            _x setSkill ["aimingaccuracy", 0.01];
            _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 _spawnVc2;

    _spawnSingle4Wp setWaypointType "SAD";
    _spawnSingle4Wp setWaypointSpeed "Full";
    _spawnSingle4Wp setWaypointBehaviour "COMBAT";
//    _spawnSingle4Wp setWaypointFormation "LINE";
    _spawnSingle4Wp setWaypointCombatMode "RED";

};    

 

Can i copy and paste this until their are 10 VC soldiers or is their an easier way to do this?

I hope somebody can help me.

Share this post


Link to post
Share on other sites

Why are you spawning 10 groups of single unit when you can spawn 1 group of 10 units?

(the waypoint formation "line" with only 1 unit is a must!)

Share this post


Link to post
Share on other sites

Hey pierremgi.

 

"Why are you spawning 10 groups of single unit when you can spawn 1 group of 10 units?",

because it's the spiderhole from the unsung mod, it's strange if there spawn 10 vc's at the same time, now it's like they come out 1 by 1.

You can see them from far away spawning.

 

(the waypoint formation "line" with only 1 unit is a must!), so i have to put in that line?

 

Share this post


Link to post
Share on other sites

I'm a bit lost with your local variables _spawnSingle4Wp as wpt , units _spawnVc2... _spawnVc4...

 

You can write something like:

if (isServer) then {
   for "_i" from 1 to 10 do {
     private _grp = createGroup EAST;
     private _unit = _grp createUnit ["B_soldier_F", markerPos ("spawnSingle"+str _i), [],0, "none"];
     _unit setDir 180;
     [_unit] joinSilent _grp;
      { _unit setSkill _x} count [ ["aimingspeed", 0.3], ["aimingaccuracy", 0.01], ["aimingshake", 0.01], ["spottime", 0.8], ["spotdistance", 0.8], ["commanding", 1], ["general", 0.8]];
    _unit allowFleeing 0;
    private _wp = _grp addWaypoint [markerPos format ["spawnSingle%1Wp",_i], 0];
    _wp setWaypointType "SAD";
    _wp setWaypointSpeed "Full";
    _wp setWaypointBehaviour "AWARE";
    _wp setWaypointCombatMode "RED";
     sleep 20;
  };
 };


   if you have 10 spider holes and 10 wpts

     
 

   

Share this post


Link to post
Share on other sites

Did i make it to complicated?

Maybe this is better

 

//null = execVM"scripts\spawnSingleTask1.sqf";

 

_spawnVc1 = [];

 

if (isServer) then {

 

        _spawnVc1 = [getmarkerpos "spawnSingle1", EAST,  ["uns_men_VC_local_RF1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;    

        _spawnSingle1Wp = _spawnVc1 addWaypoint [getmarkerpos "spawnSingle1Wp", 0];
    
        {    
                 _x setSkill ["aimingspeed", 0.3];
                 _x setSkill ["aimingaccuracy", 0.01];
                _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 _spawnVc1;

 

    _spawnSingle1Wp setWaypointType "SAD";
    _spawnSingle1Wp setWaypointSpeed "Full";
    _spawnSingle1Wp setWaypointBehaviour "AWARE";
    _spawnSingle1Wp setWaypointFormation "LINE";
    _spawnSingle1Wp setWaypointCombatMode "RED";

 

Now I want every 30 second a VC spawning for 8 or 10 times.

I will try your script.

 

Thanks for your reply.

 

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

×