Jump to content
mausAU

Spawn AI module - assign groups and waypoints?

Recommended Posts

Heya there,

I've got a Spawn AI module popping out soldiers, but I can't figure out how to get them to take up actions when they spawn. Don't know if it's possible but I'm trying to find out if there's a script or init string that will do a couple different things. Got some questions for you, any help would be greatly appreciated.

- Is it possible to assign soldiers to a group at the moment of spawning?

- Can you tell a group as it is created to head to one of three or four nearby markers, in formation & at speed?

- Is it even possible to instruct AIs via this method?

- If not, can you suggest a comparable method by which I could achieve similar results?

Tyvm for any help you can render :),

Mausau

Share this post


Link to post
Share on other sites

You shouldn't be able to spawn units unless they are assigned a group, then for the markers you could just script a waypoint based on a random marker then script in the waypoint behaviours which can give you formation and speed.

Ex randomized marker then waypoint (pseudo):

_mrk = ["mrk1","mrk2","mrk3","mrk4"] call BIS_fnc_selectRandom;

//create waypoint for the spawned units

It would help to know what module your using to spawn the units.

Share this post


Link to post
Share on other sites

Jshock this is the second post I found where you totally disregard the original question because of your lack of knowlegde of the Module in question. To find the module in the editor go to Modules(F7)>Misc>Spawn AI. MausAU to answer your question completely here is what you do.

Going off what Jshock did say about random markers though

Place your markers on the map named mrk1,mrk2,mrk3, and mrk4.

Then in your expression field use this...

_mrk = ["mrk1","mrk2","mrk3","mrk4"] call BIS_fnc_selectRandom;

wp =(_this select 0) addWaypoint [(getMarkerPos _mrk),0]

(_this select 0) is the group. you can see when you highlight the expression the 1st parameter is group.

Use this to learn about waypoints. see more info at the Command Group: Waypoints

Share this post


Link to post
Share on other sites

Well considering I haven't sat down at an actual computer in over a month it's pretty hard to reference a module. And my knowledge base is in scripting, not modules, and it seems to me that you used exactly what I was saying to do, just in the expression field instead of an outside script, so I don't see any issue...

Share this post


Link to post
Share on other sites

You gave him a partial bit of an answer without direction of how to apply what you gave him. You seemed to have answered without even looking to see if there have been an update in the last month. My recommendation is to research the question before you answer especially if you have been away for over a month. Also if you do have some info for the solution say what you know and how the OP can use it once the rest of the solution comes into play. This will make for a less confusing thread when people down the road need to find the solution.

Share this post


Link to post
Share on other sites

:confused:Is there away to customize the module,i.e spawn AI unit from a community mod instead of vanilla units?

Share this post


Link to post
Share on other sites
:confused:Is there away to customize the module,i.e spawn AI unit from a community mod instead of vanilla units?

Is there a specific reason you want to use the module instead of the functions provided by bohemia?

Share this post


Link to post
Share on other sites
Is there a specific reason you want to use the module instead of the functions provided by bohemia?

What functions?

Share this post


Link to post
Share on other sites
Is there a specific reason you want to use the module instead of the functions provided by bohemia?

Possibly because the latter involves having to learn scripting and utilising function calls which a person new to mission editing might not even know about. The modules on the other hand are there in the editor and chances are this very thread revolves around the OP's experimentations with said modules.

  • Like 1

Share this post


Link to post
Share on other sites

createPatrol.sqf

[color="#FF8040"][color="#006400"][i]// created by Revo[/i][/color]

[color="#006400"][i]//Create marker in this script, if you don't want to place them in game[/i][/color]
[color="#006400"][i]/*
createMarker ["marker0", [5000,4000,0.00143862] ];
createMarker ["marker1", [4597.35,3868.87,0.00143862] ];
createMarker ["marker2", [4654.74,3854.94,0.00143862] ];
createMarker ["marker3", [4654.59,3855.01,0.00143862] ];
createMarker ["marker4", [4697.85,3833.29,0.00143862] ];
*/[/i][/color]

[color="#006400"][i]//Creates a group with 2 soldiers at position marker0[/i][/color]
[color="#000000"]_group[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#191970"][b]getMarkerPos[/b][/color] [color="#7A7A7A"]"marker0"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]west[/color][color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"B_officer_F"[/color][color="#8B3E2F"][b],[/b][/color] [color="#7A7A7A"]"B_Soldier_F"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]180[/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]call[/b][/color] BIS_fnc_spawnGroup[color="#8B3E2F"][b];[/b][/color]

[color="#006400"][i]//creates the first waypoint at position marker1[/i][/color]
[color="#1874CD"]_wp1[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_group[/color] [color="#191970"][b]addWaypoint[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#191970"][b]getMarkerPos[/b][/color] [color="#7A7A7A"]"marker1"[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]


[color="#006400"][i]//creates the second waypoint at position marker2[/i][/color]
[color="#1874CD"]_wp2[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_group[/color] [color="#191970"][b]addWaypoint[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#191970"][b]getMarkerPos[/b][/color] [color="#7A7A7A"]"marker2"[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]


[color="#006400"][i]//creates the third waypoint at position marker3[/i][/color]
[color="#1874CD"]_wp3[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_group[/color] [color="#191970"][b]addWaypoint[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#191970"][b]getMarkerPos[/b][/color] [color="#7A7A7A"]"marker3"[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]


[color="#006400"][i]//creates the fouth waypoint at position marker4[/i][/color]
[color="#1874CD"]_wp4[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_group[/color] [color="#191970"][b]addWaypoint[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#191970"][b]getMarkerPos[/b][/color] [color="#7A7A7A"]"marker4"[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]

[color="#006400"][i]//Sets the behaviour and speed of the units to "SAFE" and "LIMITED" and the waypointType to "MOVE"[/i][/color]
[color="#8B3E2F"][b]{[/b][/color]
   [color="#000000"]_x[/color] [color="#191970"][b]setWaypointBehaviour[/b][/color] [color="#7A7A7A"]"SAFE"[/color][color="#8B3E2F"][b];[/b][/color] 
[color="#000000"]_x[/color] [color="#191970"][b]setWaypointSpeed[/b][/color] [color="#7A7A7A"]"LIMITED"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#000000"]_x[/color] [color="#191970"][b]setWaypointType[/b][/color] [color="#7A7A7A"]"MOVE"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]forEach[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_wp1[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_wp2[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_wp3[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_wp4[/color][color="#8B3E2F"][b]][/b][/color][/color]

Made with KK's SQF to BBCode Converter

Execute this script with _patrol = []execVM "createPatrol.sqf";

There you go, if you still have trouble just reply here

Share this post


Link to post
Share on other sites

Thank you R3vo..what I needed.And thanks to all of you for quick response.Presently educating myself on BI scripts.Totally different from Ghost Recon.

Share this post


Link to post
Share on other sites

hi folks.

Tried this out just now and I was really surprised with myself I actually learnt a bit of scripting. YAAY! Anyway, I'm at a hurdle right now I want the small three man group I spawn in to get into an empty Off roader(armed) then to follow the waypoint chain that is scripted.

here is the adjusted script from a previous post to suit my needs, Any advice would be appreciated;

//Creates a group with 3 soldiers at position SP1
_group = [getMarkerPos "Sp1", East, ["ISIS_Team_leader", "ISIS_Soldier", "ISIS_AR"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
_veh = "B_G_Offroad_01_armed_F" createVehicle getMarkerPos "jpsp";
//creates the first waypoint at position marker1
_wp1 = _group addWaypoint [getMarkerPos "wp1", 0];


//creates the second waypoint at position marker2
_wp2 = _group addWaypoint [getMarkerPos "wp2", 0];


//creates the third waypoint at position marker3
_wp3 = _group addWaypoint [getMarkerPos "wp3", 0];


//creates the fouth waypoint at position marker4
_wp4 = _group addWaypoint [getMarkerPos "wp4", 0];

//Sets the behaviour and speed of the units to "SAFE" and "LIMITED" and the waypointType to "MOVE"
{
   _x setWaypointBehaviour "AWARE"; 
_x setWaypointSpeed "FULL";
_x setWaypointType "GetInNearest";
_x setWaypointBehaviour "AWARE"; 
_x setWaypointSpeed "FULL";
_x setWaypointType "MOVE";

} forEach [_wp1,_wp2,_wp3,_wp4]

Share this post


Link to post
Share on other sites

Anybody got any ideas on how I can get over my hurdle of getting my spawned units into an empty vehicle. Note, I do want it to be scritped, not an editor placed event. thanks

Share this post


Link to post
Share on other sites
private["_group","_veh","_units"];

_group = [getMarkerPos "Sp1", East, ["ISIS_Team_leader", "ISIS_Soldier", "ISIS_AR"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
_veh = "B_G_Offroad_01_armed_F" createVehicle getMarkerPos "jpsp";
_group addVehicle _veh;
_units = (units _group);
(_units select 0) assignAsDriver _veh;
(_units select 0) moveInDriver _veh;

(_units select 1) assignAsGunner _veh;
(_units select 1) moveInGunner _veh;

(_units select 2) assignAsCargo _veh;
(_units select 2) moveInCargo _veh;

//creates the first waypoint at position marker1
_wp1 = _group addWaypoint [getMarkerPos "wp1", 0];


//creates the second waypoint at position marker2
_wp2 = _group addWaypoint [getMarkerPos "wp2", 0];


//creates the third waypoint at position marker3
_wp3 = _group addWaypoint [getMarkerPos "wp3", 0];


//creates the fouth waypoint at position marker4
_wp4 = _group addWaypoint [getMarkerPos "wp4", 0];

//Sets the behaviour and speed of the units to "SAFE" and "LIMITED" and the waypointType to "MOVE"
{
   _x setWaypointBehaviour "AWARE"; 
_x setWaypointSpeed "FULL";
_x setWaypointBehaviour "AWARE"; 
_x setWaypointSpeed "FULL";
_x setWaypointType "MOVE";

} forEach [_wp1,_wp2,_wp3,_wp4]

Edited by NeoArmageddon

Share this post


Link to post
Share on other sites

Is there a way to trigger this module on and off synchronized to blufor present and deactivate with the !alive command when I unit is killed. I never thought about using this module as a reinforcement script for a AO before I saw this post!

Share this post


Link to post
Share on other sites

how custom loadout for this group?

Call your loadout script from the expression field

Is there a way to trigger this module on and off synchronized to blufor present and deactivate with the !alive command when I unit is killed. I never thought about using this module as a reinforcement script for a AO before I saw this post!

From what I've seen, it just spawns units until it hits the unit cap. You can activate it via trigger, but you can't switch it off and then back on again.

Share this post


Link to post
Share on other sites

Why wouldn't it turn on and off if it's synched to a trigger, isn't that the whole point.

 

To get them to move you could use the sector control system and they would move to an area that needs capturing, I think that's how I did it once.

 

You can also get the group although you will need to make an array and keep adding the group names to it.

Share this post


Link to post
Share on other sites

@f2k sel what I was thinking is to use the site modules with the AI spawn module to populate military structures on the map. As now I have used outside scripts to populate AO's. If the AI spawn module could be link to a unit and once the unit is killed or destroyed the AI spawn module will deactivate and once you clear the units from the site module the AO secured at that point the mission is done or you move on to the next AO using the two modules activate with a trigger and so on throughout the map.

I fooled around with the defense module but it did not work out as planned lol. It never does (: This is on my list of things to try.

Share this post


Link to post
Share on other sites

Place the spawnAI module and synch to the trigger, tick repeating  and in the trigger condition put   alive myman

 

place a man on the map and name him myman

 

the base will slowly fill up with AI as setup by the spawn module, it will keep spawning until the cap is reached or the man is dead.

 

Also a good idea to add some spawn points synched around the base so they don't all group in one area.

 

Here's an idea based on the old modules but it's much the same in Eden if your using that http://www.topictimes.com/videos/games/arma-iii_-spawn-ai-%5Btutorial%5D-full-ha0wPNZF1GI.html

Share this post


Link to post
Share on other sites

@f2K sel or anyone else. I know how to do that  :) the issues is I was trying to use it with UPSMON, UPS, EOS, AISSP SLP spawn scripts. It is such a waste of time that bohemia never really finished these modules. There is no way to set the AI behaviors after they are spawned using outside scripts (maybe there is but I can't get it to work). Yes using the sector control module will make them move and engage but it seems such a waste that you can't other script with the module init to change the spawn groups behaviors like we can with the group leaders init. Time to more on unless someone can bring more light to this for me.  

Share this post


Link to post
Share on other sites

@f2K sel or anyone else. I know how to do that  :) the issues is I was trying to use it with UPSMON, UPS, EOS, AISSP SLP spawn scripts. It is such a waste of time that bohemia never really finished these modules. There is no way to set the AI behaviors after they are spawned using outside scripts (maybe there is but I can't get it to work). Yes using the sector control module will make them move and engage but it seems such a waste that you can't other script with the module init to change the spawn groups behaviors like we can with the group leaders init. Time to more on unless someone can bring more light to this for me.  

 

You can run UPS, etc, from the Expression field of the Spawn AI module:

 

nul = [leader (_this select 0),"kavala","track"] execVM "ups.sqf"

 

(Just tested in the UPS demo mission)

Share this post


Link to post
Share on other sites

I attempted that last night. I will try again. UPS or UPSMON. If that does work then very cool.

I used just zone1 and zone2 in the code I will try with nul = [leader (_this select 0),"kavala","track"] execVM "ups.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

×