Jump to content
Sign in to follow this  
Aviox93

Make random AI groups respawn with random waypoints.

Recommended Posts

Hi !

 

So i'm trying to make a domination (multiple sectors) mission player vs IA. And my goal is to make a 2 hour game where the team with the most points win at the end of this timer (each sectors earn a specific number of points).

Anyways, I made a NATO base and a russian base and here is the thing :

I created three squads (Infantry, AT, Marksman) and multiples vehicles in each bases. And I wanted to know if it was possible to randomly make a squad appear and have it go to a random sector.

For example, every minutes :

- 50% chance to spawn an infantry squad

 -30% for AT

 -20% for Marksman

and the squad that just spawned has

-10% to go to sector A

-20% to sector B

etc....

 

Same with vehicles but every 5 minutes for exemple. 

 

Thanks !!! 😁

Share this post


Link to post
Share on other sites

You can do something like this for infantry:

 

Do the same thing with vehicles:

Using a trigger you can set a timer for the spawns.

 

Another way is to do something like this with waves

 

Share this post


Link to post
Share on other sites
1 hour ago, Gunter Severloh said:

You can do something like this for infantry:

 

Do the same thing with vehicles:

Using a trigger you can set a timer for the spawns.

 

Another way is to do something like this with waves

 

Hey thanks for the answer. Nice vids I learnt a lot of things but I have questions :

Can I spawn a squad with custom loadout ? (Since the squad code only consider the unit and not its loadout)

Can I instead of patrol, put a search and destroy waypoint ? Edit : The last video answered this one ^^

How can I put a timer ?

(btw I think using the init file instead of a trigger idk what do you think about it ?)

  • Like 1

Share this post


Link to post
Share on other sites

No need to quote my whole post when i was the only one that responded.

Quote

Can I spawn a squad with custom loadout ?

Cant help you there, never did custom loadouts for spawning infantry.

58 minutes ago, Aviox93 said:

How can I put a timer ?

Use the trigger that spawns the infantry and or vehicles, it has timer settings in it.

59 minutes ago, Aviox93 said:

btw I think using the init file instead of a trigger idk what do you think about it ?

You can but then you still need to call the init.sqf via trigger, if its sp then no worries, if your going to use

this on a server then use initserver.sqf.

Share this post


Link to post
Share on other sites
27 minutes ago, Gunter Severloh said:

No need to quote my whole post when i was the only one that responded.

Cant help you there, never did custom loadouts for spawning infantry.

Use the trigger that spawns the infantry and or vehicles, it has timer settings in it.

You can but then you still need to call the init.sqf via trigger, if its sp then no worries, if your going to use

this on a server then use initserver.sqf.

Alr thx man

I figured it out for the loadout thing, last question : is there a random.int function or smth like this ?

Share this post


Link to post
Share on other sites

Jebus and MGI modules are very good options. 

Share this post


Link to post
Share on other sites

that's how I do it, works perfectly.

 

init.sqf

 

if (isNil "e_spawn") then {e_spawn = true};


// Define spawn arrays
csat_infantry_spawn_array = ["OIA_InfSquad", "OIA_InfSquad_Weapons", "OIA_InfTeam", "OIA_InfTeam_AT", "OIA_InfSentry"];
csat_infantry_support_spawn_array = ["OI_support_CLS", "OI_support_EOD", "OI_support_ENG"];
csat_motorized_spawn_array = ["OIA_MotInfTeam", "OIA_MotInf_AT", "OIA_MotInf_GMGTeam"];
csat_mechanized_spawn_array = ["OIA_MechInfSquad", "OIA_MechInf_AT"];

 

Start the spawn.sqf any way you want: nul = [] execVM "spawn.sqf";

 

spawn.sqf

private ["_random1", "_random2", "_random3", "_random4", "_spawnGroup1", "_spawnGroup2", "_spawnGroup3", "_spawnGroup4"];

while {e_spawn} do 
{
    if (isServer) then {    
    
        _random1 = floor random 6;
        _random2 = floor random 4;
        _random3 = floor random 4;
        _random4 = floor random 3;
        _spawnGroup1 = csat_infantry_spawn_array select _random1;
        _spawnGroup2 = csat_infantry_support_spawn_array select _random2;
        _spawnGroup3 = csat_motorized_spawn_array select _random3;
        _spawnGroup4 = csat_mechanized_spawn_array select _random4;
        
        csat_grp1 = [getMarkerPos "spawn1", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> _spawnGroup1)] call BIS_fnc_spawnGroup;
        [csat_grp1, getMarkerPos "Radiotower", 150] call BIS_fnc_taskAttack;

        csat_grp2 = [getMarkerPos "spawn2", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Support" >> _spawnGroup2)] call BIS_fnc_spawnGroup;
        [csat_grp2, getMarkerPos "Radiotower", 150] call BIS_fnc_taskAttack;
        
        csat_grp3 = [getMarkerPos "spawn3", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> _spawnGroup3)] call BIS_fnc_spawnGroup;
        [csat_grp3, getMarkerPos "Radiotower", 150] call BIS_fnc_taskAttack;
        
        csat_grp4 = [getMarkerPos "spawn1", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Mechanized" >> _spawnGroup4)] call BIS_fnc_spawnGroup;
        [csat_grp4, getMarkerPos "Radiotower", 150] call BIS_fnc_taskAttack;
    };
         
    sleep 250;
};

You can define random groups to spawn. You can extend the waypoint radius. Instead of attacking you can use BIS_fnc_taskPatrol or BIS_fnc_taskDefend. Instead of fixed spawn points and destination points you can alter the code the way you need it. If you don't want random groups to spawn, remove _spawnGroupX and enter the desired group directly. Exit the unit spawn by setting e_spawn to false on runtime.

 

Share this post


Link to post
Share on other sites

hai guys im already done doing the waves scripts then when i play scenario anc come out script waves.sqf not found

can some one guide me how to get it work?

Share this post


Link to post
Share on other sites
4 hours ago, isky037 said:

script waves.sqf not found

Script has to be in your mission folder, so in the editor, go to the top left where it says scenario,

then follow that menu to the bottom and click on open scenario folder, thats your mission folder, put the script in there, where its supposed to be.

Welcome to BI forums btw!

  • Like 1

Share this post


Link to post
Share on other sites

Kindly thank for your reaply 🤝.... is work now and you are the best 👍

  • Like 1

Share this post


Link to post
Share on other sites

You can also define the coordinates of the spawns on small hidden objects and set the probability of the object's appearance. If the object does not appear, they do not spawn.

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  

×