{"action":"created","issue":{"url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/issues/1","repository_url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11","labels_url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/issues/1/comments","events_url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/issues/1/events","html_url":"https://github.com/tbeswick96/UKSF-SR5-7-11/issues/1","id":174923612,"number":1,"title":"Spawning script","user":{"login":"Alwandy","id":5923107,"avatar_url":"https://avatars.githubusercontent.com/u/5923107?v=3","gravatar_id":"","url":"https://api.github.com/users/Alwandy","html_url":"https://github.com/Alwandy","followers_url":"https://api.github.com/users/Alwandy/followers","following_url":"https://api.github.com/users/Alwandy/following{/other_user}","gists_url":"https://api.github.com/users/Alwandy/gists{/gist_id}","starred_url":"https://api.github.com/users/Alwandy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alwandy/subscriptions","organizations_url":"https://api.github.com/users/Alwandy/orgs","repos_url":"https://api.github.com/users/Alwandy/repos","events_url":"https://api.github.com/users/Alwandy/events{/privacy}","received_events_url":"https://api.github.com/users/Alwandy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/labels/mod","name":"mod","color":"bfd4f2"},{"url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/labels/script","name":"script","color":"c5def5"},{"url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/labels/SR11","name":"SR11","color":"fbca04"},{"url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/labels/SR5","name":"SR5","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"Alwandy","id":5923107,"avatar_url":"https://avatars.githubusercontent.com/u/5923107?v=3","gravatar_id":"","url":"https://api.github.com/users/Alwandy","html_url":"https://github.com/Alwandy","followers_url":"https://api.github.com/users/Alwandy/followers","following_url":"https://api.github.com/users/Alwandy/following{/other_user}","gists_url":"https://api.github.com/users/Alwandy/gists{/gist_id}","starred_url":"https://api.github.com/users/Alwandy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alwandy/subscriptions","organizations_url":"https://api.github.com/users/Alwandy/orgs","repos_url":"https://api.github.com/users/Alwandy/repos","events_url":"https://api.github.com/users/Alwandy/events{/privacy}","received_events_url":"https://api.github.com/users/Alwandy/received_events","type":"User","site_admin":false},"assignees":[{"login":"Alwandy","id":5923107,"avatar_url":"https://avatars.githubusercontent.com/u/5923107?v=3","gravatar_id":"","url":"https://api.github.com/users/Alwandy","html_url":"https://github.com/Alwandy","followers_url":"https://api.github.com/users/Alwandy/followers","following_url":"https://api.github.com/users/Alwandy/following{/other_user}","gists_url":"https://api.github.com/users/Alwandy/gists{/gist_id}","starred_url":"https://api.github.com/users/Alwandy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alwandy/subscriptions","organizations_url":"https://api.github.com/users/Alwandy/orgs","repos_url":"https://api.github.com/users/Alwandy/repos","events_url":"https://api.github.com/users/Alwandy/events{/privacy}","received_events_url":"https://api.github.com/users/Alwandy/received_events","type":"User","site_admin":false},{"login":"tbeswick96","id":11049179,"avatar_url":"https://avatars.githubusercontent.com/u/11049179?v=3","gravatar_id":"","url":"https://api.github.com/users/tbeswick96","html_url":"https://github.com/tbeswick96","followers_url":"https://api.github.com/users/tbeswick96/followers","following_url":"https://api.github.com/users/tbeswick96/following{/other_user}","gists_url":"https://api.github.com/users/tbeswick96/gists{/gist_id}","starred_url":"https://api.github.com/users/tbeswick96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbeswick96/subscriptions","organizations_url":"https://api.github.com/users/tbeswick96/orgs","repos_url":"https://api.github.com/users/tbeswick96/repos","events_url":"https://api.github.com/users/tbeswick96/events{/privacy}","received_events_url":"https://api.github.com/users/tbeswick96/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/milestones/2","html_url":"https://github.com/tbeswick96/UKSF-SR5-7-11/milestones/SR5%20mods","labels_url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/milestones/2/labels","id":1981930,"number":2,"title":"SR5 mods","description":"Mods for SR5 mission makers.","creator":{"login":"tbeswick96","id":11049179,"avatar_url":"https://avatars.githubusercontent.com/u/11049179?v=3","gravatar_id":"","url":"https://api.github.com/users/tbeswick96","html_url":"https://github.com/tbeswick96","followers_url":"https://api.github.com/users/tbeswick96/followers","following_url":"https://api.github.com/users/tbeswick96/following{/other_user}","gists_url":"https://api.github.com/users/tbeswick96/gists{/gist_id}","starred_url":"https://api.github.com/users/tbeswick96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbeswick96/subscriptions","organizations_url":"https://api.github.com/users/tbeswick96/orgs","repos_url":"https://api.github.com/users/tbeswick96/repos","events_url":"https://api.github.com/users/tbeswick96/events{/privacy}","received_events_url":"https://api.github.com/users/tbeswick96/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2016-09-03T23:56:42Z","updated_at":"2016-09-04T00:55:05Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2016-09-03T23:56:43Z","updated_at":"2016-09-07T07:41:47Z","closed_at":null,"body":"Spawns units directly on headless client.\r\nDynamic waypoints etc"},"comment":{"url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/issues/comments/245201015","html_url":"https://github.com/tbeswick96/UKSF-SR5-7-11/issues/1#issuecomment-245201015","issue_url":"https://api.github.com/repos/tbeswick96/UKSF-SR5-7-11/issues/1","id":245201015,"user":{"login":"Alwandy","id":5923107,"avatar_url":"https://avatars.githubusercontent.com/u/5923107?v=3","gravatar_id":"","url":"https://api.github.com/users/Alwandy","html_url":"https://github.com/Alwandy","followers_url":"https://api.github.com/users/Alwandy/followers","following_url":"https://api.github.com/users/Alwandy/following{/other_user}","gists_url":"https://api.github.com/users/Alwandy/gists{/gist_id}","starred_url":"https://api.github.com/users/Alwandy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alwandy/subscriptions","organizations_url":"https://api.github.com/users/Alwandy/orgs","repos_url":"https://api.github.com/users/Alwandy/repos","events_url":"https://api.github.com/users/Alwandy/events{/privacy}","received_events_url":"https://api.github.com/users/Alwandy/received_events","type":"User","site_admin":false},"created_at":"2016-09-07T07:41:47Z","updated_at":"2016-09-07T07:41:47Z","body":"Updated tiny bit, \r\nWill now spawn per group (4,6,8,10) and change their behavior per dice roll. \r\nTo do: \r\n*Garrison if building nearby if unit has a garrison task. \r\n*Offer parameter to select faction you want to spawn. \r\n\r\n```\r\n/*\r\n    Author:\r\n        Julian Alwandy & Tim Beswick\r\n\r\n    Description:\r\n        Spawns AI based on max amount at any time and pool size, remotely on random headless client\r\n\r\n    Parameters:\r\n        0: Marker Name (default: \"\") <STRING>\r\n        1: Max enemy spawned at once (default: 50) <SCALAR>\r\n        2: Enemy pool size (default: 200) <SCALAR>\r\n        3: Debug (default: false) <BOOLEAN>\r\n\r\n    Return value:\r\n        Nothing\r\n\r\n    Called from:\r\n        _nul = [\"MyMarker\", 40, 100, false] execVM \"spawnMethod.sqf\";\r\n*/\r\nparams [[\"_markerName\", \"\"], [\"_maxAmount\", 50], [\"_poolSize\", 200], [\"_debug\", false]];\r\npublicVariable \"spawnAndTask\";\r\nif(_markerName == \"\") exitWith {};\r\nif(!isServer) exitWith {};\r\n\r\n//Set poolsize for marker as mission variable\r\nmissionNamespace setVariable [format [\"%1_poolsize\", _markerName], _poolSize, true];\r\n\r\n_markerName setMarkerAlpha 0;\r\n//Headless clients - offload this to init later down the line\r\nHCs = [];\r\n{\r\n    _id = owner _x;\r\n    HCs = HCs + [_id];\r\n} forEach (entities \"HeadlessClient_F\");\r\n\r\nspawnAndTask = {\r\n    params [\"_markerName\"];\r\n\r\n    //Spawn units in random place within marker\r\n    _markerScale = getMarkerSize _markerName;\r\n    _randomSpawn = [_markerName, (_markerScale select 0)] call CBA_fnc_randPos;\r\n    _randomUnit = selectRandom [\"Laraka_4\",\"Laraka_6\",\"Laraka_8\",\"Laraka_10\"]; // Gives the array for units to be chosen, use example: _x = selectRandom [[Array1],[Array2],[Array3],[Array4]];\r\n    _group = [_randomSpawn, EAST, (cofigFile >> \"cfgGroups\" >> \"East\" >> \"UKSF_Laraka\" >> \"Infantry\" >> _randomUnit)] call BIS_fnc_spawnGroup; //Spawns Unit\r\n\r\n    //Automatically assign task type\r\n    _taskType = floor(random 3);\r\n    switch (_taskType) do {\r\n        case 0: {[_group, _markerName] call CBA_fnc_taskSearchArea;}; // Will search area\r\n        case 1: {[_group, _markerName, (_markerScale select 0)] call CBA_fnc_taskPatrol;}; // Calls patrol movement\r\n        case 2: {[_group, _markerName, (_markerScale select 0)] call CBA_fnc_taskPatrol;}; // Will search area\r\n        //case 2: {[_group,(_markerScale select 0), 2, true] call CBA_fnc_taskDefend;}; // Will fortify a position - Commented out due of not working as of now.\r\n        default {[_group, _markerName, (_markerScale select 0)] call CBA_fnc_taskPatrol;}; // Default value is to patrol.\r\n    };\r\n\t    _aiBehaviour = floor(random 2);\r\n\t\tswitch ( _aiBehaviour) do {\r\n        case 0: {\r\n\t\t\t_group setBehaviour \"SAFE\";\r\n\t\t\r\n\t\t}; // Will Patrol Road\r\n        case 1: {\r\n\t\t\t_group setBehaviour \"AWARE\";\r\n\t\t\r\n\t\t}; // Will run / be aware of presence\r\n        default {\r\n\t\t_group setBehaviour \"AWARE\";\r\n\t\t}; // Default value is to patrol.\r\n    };\r\n\t\r\n\t\r\n    //Set latest count\r\n    missionNamespace setVariable [format [\"%1_count\", _markerName], count (units _group), true];\r\n};\r\n\r\n[{\r\n\r\n    params [\"_args\", \"_idPFH\"];\r\n    _args params [\"_markerName\", \"_maxAmount\", \"_debug\"];\r\n\r\n    //Update poolsize\r\n    _poolSize = missionNamespace getVariable [format [\"%1_poolsize\", _markerName], 0];\r\n    _poolSize = _poolSize - (missionNamespace getVariable [format [\"%1_count\", _markerName], 0]);\r\n    missionNamespace setVariable [format [\"%1_poolsize\", _markerName], _poolSize, true];\r\n\r\n    //If pool is empty, remove PFH\r\n    if(_poolSize <= 0) exitWith {\r\n        [_idPFH] call CBA_fnc_removePerFrameHandler;\r\n    };\r\n\r\n    //Count number of current enemy. If less than threshold, spawn more.\r\n    _totalEnemy = {alive _x && side _x == EAST} count allUnits;\r\n    if(_totalEnemy <= _maxAmount) then {\r\n        //Execute code on one of the headless clients\r\n        [_markerName] remoteExec [\"spawnAndTask\", selectRandom HCs, false];\r\n    };\r\n\r\n    //If debug is on, add markers to each area\r\n    if(_debug) then {\r\n        {_markerstr = createMarker [format [\"%1\", floor (random 9999)], leader _x]; _markerstr setMarkerShape \"ICON\"; _markerstr setMarkerType \"hd_dot\";} forEach allGroups;\r\n        _markerName setMarkerAlpha 1;\r\n    };\r\n}, 10, [_markerName, _maxAmount, _debug]] call CBA_fnc_addPerFrameHandler;\r\n```"}}
{"actor":{"display_login":"Alwandy"}}