klakins 10 Posted May 15, 2019 I'm not new to making missions in Arma, but i am new to writing my own scripts. For my first attempt I'm just trying to create a simple spawn script for an ambush. I'm having a hell of a time randomizing the spawns. Here is what I have so far. if(isServer) then { _w1g1 = ["amb1","amb2","amb3"] call BIS_fnc_selectRandom; _w1g2 = ["amb1","amb2","amb3"] call BIS_fnc_selectRandom; _g1 = [getpos _w1g1, INDEPENDENT, (configfile >> "CfgGroups" >> "Indep" >> "CUP_I_TK_GUE" >> "Infantry" >> "CUP_I_TK_GUE_Group")] call BIS_fnc_spawnGroup; _wp1 = _g1 addWaypoint [getmarkerpos "w1", 50]; _wp1 setWaypointType "SAD"; _g2 = [getpos _w1g2, INDEPENDENT, (configfile >> "CfgGroups" >> "Indep" >> "CUP_I_TK_GUE" >> "Infantry" >> "CUP_I_TK_GUE_Group")] call BIS_fnc_spawnGroup; _wp1 = _g2 addWaypoint [getmarkerpos "w1", 50]; _wp1 setWaypointType "SAD"; }; amb1, amb2, and amb 3 are objects, each with a placement radius of 100. Basically what im going for is 2 groups that will spawn on 1 of 3 spawn points, that are further randomized by having a placement radius. I've tried many different things, but just cant it to work. If i use getmarkerpos instead of getpos the units do spawn, but off the edge of the map. If anyone has any idea of how to get this to work, or if you have a better idea to accomplish the same thing, I would love to hear your suggestions. I did get this same script working earlier with amb1, amb2, and amb3 being markers, but markers cant have a placement radius, so doesn't quite accomplish what I'm trying to do. Share this post Link to post Share on other sites
pierremgi 4739 Posted May 15, 2019 getpos is for objects, like amb1 amb2 amb3 which are cars or empty helipads.... or some terrain objects like houses if you know how to select them. getMarkerPos is for markers (markers are not objects) and a marker is always defined by a string "amb1", or "amb2" (but you write amb1 amb2 in the variable name). So you have to choose, object or marker (I suggest you marker) and apply the right command with the right syntax. Share this post Link to post Share on other sites
Dedmen 2588 Posted May 15, 2019 7 hours ago, klakins said: BIS_fnc_selectRandom Use https://community.bistudio.com/wiki/selectRandom 7 hours ago, klakins said: amb1, amb2, and amb 3 are objects They are strings in your code though? You probably want to remove the quotes? You are randomly selecting a string and passing it to getPos, but getPos doesn't take string https://community.bistudio.com/wiki/getPos Share this post Link to post Share on other sites
Tankbuster 1733 Posted May 15, 2019 Yes, when you refer to an object, don't put speech marks around it. Share this post Link to post Share on other sites