hellstorm77 2 Posted January 21, 2016 im trying to spawn ai on a marker pos but a random place around it ie 500m just say. My marker is named mark1 my script is this. nothing is spawning. _pos = getMarkerPos (_this select 0); _enemiesArray = [grpNull]; for "_i" from 0 to PARAMS_UpsSquadsPatrol do { _randomPos = [[[getMarkerPos "mark1", 500],_dt],["water","out"]] call BIS_fnc_randomPos; _spawnGroup = [_randomPos, EAST, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad")] call BIS_fnc_spawnGroup; [_spawnGroup, _pos, 400] call BIS_fnc_taskDefend; _enemiesArray = _enemiesArray + [_spawnGroup]; }; Share this post Link to post Share on other sites
barbolani 198 Posted January 21, 2016 Better than that I will tell you how to know what's happening. Google the following: "where is arma 3 .rpt" Go for the folder. Try the mission. Open the newest .rpt file. It will tell you what's failing (most of the times) Share this post Link to post Share on other sites
jshock 513 Posted January 21, 2016 Mark1 needs to be in quotations: getMarkerPos "Mark1"And as stated above, the rpt file should catch stuff like that and/or turn on showScriptErrors too see them in realtime. Share this post Link to post Share on other sites
hellstorm77 2 Posted January 21, 2016 i forgot to add that part 15:01:51 "Reading main init.sqf" 15:01:51 Error in expression <oup","_i","_dt"]; _pos = getMarkerPos (_this select 0); _enemiesArray = [grpNu> 15:01:51 Error position: <_this select 0); _enemiesArray = [grpNu> 15:01:51 Error Undefined variable in expression: _this Share this post Link to post Share on other sites
barbolani 198 Posted January 21, 2016 In your case it will say something like: error in getMarkerPos Mark1 expected string So you will guess you forgot to put your marker name in "string" Share this post Link to post Share on other sites
barbolani 198 Posted January 21, 2016 i forgot to add that part 15:01:51 "Reading main init.sqf" 15:01:51 Error in expression <oup","_i","_dt"]; _pos = getMarkerPos (_this select 0); _enemiesArray = [grpNu> 15:01:51 Error position: <_this select 0); _enemiesArray = [grpNu> 15:01:51 Error Undefined variable in expression: _this That means you haven't passed arguments to your script, so _this contains nothing. Seems the script you posted and the script giving error are not the same, isn't it? Share this post Link to post Share on other sites
hellstorm77 2 Posted January 21, 2016 just was updating the op Share this post Link to post Share on other sites
hellstorm77 2 Posted January 21, 2016 this is the error im getting now after adding "mark1" 16:27:56 Error in expression <ust be a Group!"; false};if ((typeName _pos) != (typeName [])) exitWith {debugL>16:27:56 Error position: <_pos) != (typeName [])) exitWith {debugL>16:27:56 Error Undefined variable in expression: _pos16:27:56 File A3\functions_f\spawning\fn_taskDefend.sqf, line 2616:27:56 Error in expression <all BIS_fnc_spawnGroup; [_spawnGroup, _pos, 400] call BIS_fnc_taskDefend;_en>16:27:56 Error position: <_pos, 400] call BIS_fnc_taskDefend;_en>16:27:56 Error Undefined variable in expression: _pos Share this post Link to post Share on other sites
barbolani 198 Posted January 21, 2016 We are very fast :) Ok, I asume you are puting this code in init.sqf Init.sqf is a script which the engine executes automatically, thus you cannot pass arguments to it. Arguments passed to any script is that _this variable So, assuming you have somewhere a marker, and has a name (let's say "myMarker") just changing _this selec 0 by "myMarker" will make the code pass that error. Share this post Link to post Share on other sites
hellstorm77 2 Posted January 21, 2016 @barbolani & jshock thank you both for the help this is what i have now, just one last question do i need if (!isServer) exitWith {} if (!isServer) exitWith {}; _pos = getMarkerPos "mark1"; for "_i" from 0 to PARAMS_UpsSquadsPatrol do { _randomPos = [[[getMarkerPos "mark1", 500]],["water","out"]] call BIS_fnc_randomPos; _spawnGroup = [_randomPos, EAST, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad")] call BIS_fnc_spawnGroup; [_spawnGroup, _pos, 400] call Bis_fnc_taskPatrol; sleep 0.5; if(DEBUG) then { _name = format ["%1%2",name (leader _spawnGroup),_i]; createMarker [_name,getPos (leader _spawnGroup)]; _name setMarkerShape "Icon"; _name setMarkerType "mil_dot"; _name setMarkerText format ["Squad %1",_i]; _name setMarkerColor "ColorRed"; [_spawnGroup,_name] spawn { private["_group","_marker"]; _group = _this select 0; _marker = _this select 1; while{count (units _group) > 0} do { _marker setMarkerPos (getPos (leader _group)); sleep 0.1; }; deleteMarker _marker; }; }; }; Share this post Link to post Share on other sites
jshock 513 Posted January 21, 2016 Yea I would recommend running this on the server only. Share this post Link to post Share on other sites
hellstorm77 2 Posted January 22, 2016 just have a simple question what does the 500 do which is next to mark1 and also the 400 next to call Bis_fnc_taskPatrol _randomPos = [[[getMarkerPos "mark1", 500]],["water","out"]] call BIS_fnc_randomPos; [_spawnGroup, _pos, 400] call Bis_fnc_taskPatrol; Share this post Link to post Share on other sites
jshock 513 Posted January 22, 2016 Check out each functions wiki page. https://community.bistudio.com/wiki/BIS_fnc_randomPos https://community.bistudio.com/wiki/BIS_fnc_taskPatrol Share this post Link to post Share on other sites