Bahger 11 Posted November 22, 2013 I found this great Kylania script, which, when a named trigger is fired, spawns AI and moves them from one marker to another. Obviously you need the updated A3 classnames. My question is, rather than entering single units in quotes, separated by commas, is there any way to get the script to spawn a unit, or even units, in formation that would move to the destination marker? Share this post Link to post Share on other sites
iceman77 18 Posted November 22, 2013 (edited) _grp = [getPosATL myPos, WEST, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")] call BIS_fnc_spawnGroup; _wp = _grp addwaypoint [getMarkerPos "s1",20]; _wp setWaypointType "MOVE"; or _grp = [getPosATL myPos, WEST, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")] call BIS_fnc_spawnGroup; [_grp, getMarkerPos "myMarker", random 100] call BIS_fnc_taskPatrol; The classnames for the groups can be found in the cfgViewer in the editor under cfgGroups (I believe) & here. Edited November 22, 2013 by Iceman77 Share this post Link to post Share on other sites
Bahger 11 Posted November 22, 2013 Thank you, Iceman. Apologies for being dense but do I replace the Kylania code with the code you supplied or do I combine it with Kylania's spawn AI script? If the latter, could you possibly explain what goes where? I understand the classname syntax in your code but am not sure how to integrate what you have supplied with the existing script because I notice that your code references only one player-named marker, not two, which Kylania's script calls for...unless your code is just another way of doing the same thing with only one marker? Share this post Link to post Share on other sites
iceman77 18 Posted November 22, 2013 (edited) init.sqf [spawnPosName, "myMarkername"] execVM "groupSpawn.sqf"; //[b]_this select 0[/b] (name of an object to spawn the group at - ie; empty heli pad with a name) [b]_this select 1[/b] (marker name to patrol to) groupSpawn.sqf if (isServer) then { _grp = [getPosATL (_this select 0), WEST, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")] call BIS_fnc_spawnGroup; _wp = _grp addwaypoint [getMarkerPos (_this select 1),20]; _wp setWaypointType "MOVE"; }; or if (isServer) then { _grp = [getPosATL (_this select 0), WEST, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")] call BIS_fnc_spawnGroup; [_grp, getMarkerPos (_this select 1), random 100] call BIS_fnc_taskPatrol; }; ---------- Post added at 23:50 ---------- Previous post was at 23:39 ---------- Edited it a bit. There are different ways to do it. You can use either objects or markers to spawn the group or assign a waypoint. Really up to preference. Also, here's a script that spawns a random group and has them patrol a given marker. You may find it useful. Edited November 22, 2013 by Iceman77 Share this post Link to post Share on other sites
Bahger 11 Posted November 22, 2013 (edited) Thanks again, Iceman, I really appreciate this. The script you linked is for Stratis. I'll investigate, I'm sure it can be adapted... ---------- Post added at 10:03 AM ---------- Previous post was at 08:05 AM ---------- Can someone please confirm that, to make the above code do what I want it to in my mission, in groupSpawn.sqf I substitute my marker names (Spawn01 and Move01) for the word "this", in quotes, as follows: if (isServer) then { _grp = [getPosATL (_"Spawn01" select 0), EAST, (configFile >> "CfgGroups" >> "East" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")] call BIS_fnc_spawnGroup; _wp = _grp addwaypoint [getMarkerPos (_"Move01" select 1),20]; _wp setWaypointType "MOVE";) }; Also, sorry, but I do not know the exact (execVM?) code for executing the above .sqs file in my trigger. I have done all of the above but it's not yet working. OK, well I have run out of ideas to get this to work. I'm sure it's user error, but to help narrow it down, here's what I did: - made init.sqf file in Notepad inside my mission folder, copied in the above code exactly, no substitution for "MyMarkername". - made groupSpawn.sqf file in Notepad inside my mission folder, copied in the above code but sustituted my two marker names, so: (_"spawn01" select 0) and (_"move01" select 1) - Changed all the side, faction, classification, unit info to the desired Arma3 values, so groupSpawn.sqf now looks like this: if (isServer) then { _grp = [getPosATL (_"spawn01" select 0), EAST, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad_Weapons" )] call BIS_fnc_spawnGroup; _wp = _grp addwaypoint [getMarkerPos (_"move01" this select 1),20]; _wp setWaypointType "MOVE"; }; Note I changed "west" to "east" in both instances but kept the same case. - Opened the mission: - Made a civilian player character - Made the two markers, named them as above - Made a trigger, fired by "Civilian, present" - put this in the "On activation" field": _handle = player execVM "groupSpawn.sqf"; waitUntil {scriptDone _Handle}; after trying various forms of "execVM" code combos to no avail. Nothing works. I've been at it all morning. Got to get some lunch now. Out of ideas. I know I'm a noob but can anyone help me out? Iceman77, I sent you a friend request on Steam (I'm "Strummer") in case it might be more convenient for you to talk me through this on Steam PM. Thank you. Edited November 22, 2013 by Bahger Share this post Link to post Share on other sites
iceman77 18 Posted November 23, 2013 You copy and paste the exact code I gave you into their respective .sqf files. No more & no less. After that's done, let's take a look at the init.sqf. [[b][color=#ff0000]spawnPosName[/color][/b], [b][color=#0000ff]"myMarkername"[/color][/b]] execVM "groupSpawn.sqf"; spawnPosName is the name of an object where you would like the group to spawn at. You could name the object any name. "myMarkername" is the name of an marker, where you want then units to go to. It can be any name you like. step#1: I open the editor and I place an empty heliPad (object) and name it grpPos (totally random name I just came up with). This will be the spawn position of the group you are creating. Then, I create a marker named "grpDestination" (again.. totally random name I thought up). step#2: Go back into the init.sqf and change the names accordingly, like below.. I hope you can see the correlation here. [[b][color=#ff0000]grpPos[/color][/b], [color=#0000ff][b]"grpDestination"[/b][/color]] execVM "groupSpawn.sqf"; step#3: Save & preview it. TIPS: Check out some scripting tutorials from Mikie Boy & Mr.Murray. I would suggest reading Mr.Murray's from top to bottom (experimenting along the way), and then move onto Mikie Boy's tutorials. Also, check out arrays for noobs. Share this post Link to post Share on other sites
Bahger 11 Posted November 23, 2013 Thank you for your patience. I guess one of my incorrect assumptions was that I needed code in the trigger's activation field. That function is taken care of by the init.sqf I assume. Share this post Link to post Share on other sites
iceman77 18 Posted November 23, 2013 (edited) That function is taken care of by the init.sqf I assume. With all due respect, I clearly labeled where each piece of code goes in post #4. I don't really know how to make things anymore clearer. I'd really recommend looking into MR.Murrays editing guide. It covers the very basics of mission editing and working with files. You may find it worth your time to look into that. If you don't understand the very basics IE; how to copy & paste, create new .sqf files, work with the init.sqf / description.ext, navigate your mission's directory, then it isn't very fair to the people who will potentially help you. It's one thing to provide you with code snippets, it's another to hold your hand through every trivial detail. Please don't take any of this the wrong way :). I'm glad to help you, but I think you need to take a step back and learn some very basics of building a mission. Edited November 23, 2013 by Iceman77 Share this post Link to post Share on other sites
Bahger 11 Posted November 23, 2013 You're right. I apologise. I know more than I give the impression of knowing, i.e. I'm pretty good in the editor, I';ve made some decently rated ArmA 2 missions but no matter how hard I try, I do not have the brain for scripting. I struggle hugely with it. I want to understand it but usually end up copying and pasting until I have the functionality I want. I won't bother you again and I very much appreciate your help. Share this post Link to post Share on other sites
iceman77 18 Posted November 23, 2013 I won't bother you again and I very much appreciate your help. :p It isn't about bothering me. It's about taking the time to learn the very basic fundamentals so when you do need help, it's all very seemless ;). Glad to help you in any case, I just don't know how to make things anymore clear. So I figured a simple editing guide may be of use to you =/ Share this post Link to post Share on other sites
Bahger 11 Posted November 23, 2013 I have taken the time. I have a dozen editing and scripting guides neatly filed away on my PC. My biggest asset as an ArmA scenario designer is my very advanced knowledge of military tactics and doctrine. However, my trying to master scripting and the more complex logical functions of the Editor is a bit like a tone-dead person trying to learn to sing. What I really need is a collaborator. All of my missions are pretty good once I've sweated them into existence and tested them extensively. Share this post Link to post Share on other sites