Cold Evil 13 Posted September 29, 2013 I actually have a problem with the simpleCache script i want the AI to only spawn when playable unit is near, the basic function of the script. :) I've have allot of gamelogics that look similar to these: nul = [this,2,true,2,[8,2],200,[0.5,0.6,0.8,1,0.8,0.6,0.9,1,0.8,0.8],nil,nil,1] execVM "LV\fillHouse.sqf"; nul = [this,0,200,[true,false],[true,false,false],false,[10,2],[3,2],"default",nil,nil,2] execVM "LV\militarize.sqf"; There are 20 gamelogics like this. And then i have the simpleCache: nul = [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],[player],400,true,true] execVM "LV\LV_functions\LV_fnc_simpleCache.sqf"; Have i done somthing wrong here? I also use the Ambient combat. Share this post Link to post Share on other sites
na_palm 19 Posted September 29, 2013 hi cold Evil, your calls for fillHouse and militarize script look ok. simpleCache call seems also ok. (as you use the MP switch you could empty the player array but thats no error, only redundant) so what kind of error do you get? Share this post Link to post Share on other sites
Cold Evil 13 Posted September 29, 2013 AI spawning anyway causing FPS lag from hell due to the amount of areas. Controlled it by adding a hint on the custom init. Should i type nil for player? Share this post Link to post Share on other sites
na_palm 19 Posted September 29, 2013 You can pass an empty array '[]' thats suffice. The lag on mission start lies in the design as you first have to create all groups and then tell simpleCache to erase them again and watch for near players. It would "MAYBE" be really nice if spunFIN could provide a version of simpleCache that accepts a long list of all manageable calls and then does its magic :). (@spunFIN this is dev. no demand i would made, take it maybe as an alt view!!) If you want you can try my little changes i made in post #24. they dev. don't erase the unresponsiveness but lessen it to a good degree. greetings Na_Palm ---------- Post added at 01:31 ---------- Previous post was at 01:26 ---------- I forgot to mention the testmission above is for SP. If you take this init.sqf it works for multiplayer... //functions for the div patrolscripts if(isNil("LV_CloseDoors"))then{LV_CloseDoors = compile preprocessFile "addons\LV\LV_functions\LV_fnc_closeDoors.sqf";}; if(isNil("LV_nearestBuilding"))then{LV_nearestBuilding = compile preprocessFile "addons\LV\LV_functions\LV_fnc_nearestBuilding.sqf";}; //new ones if(isNil("LV_patrol_vD"))then{LV_patrol_vD = compile preprocessFile "addons\LV\patrol-vD.sqf";}; if(isNil("LV_patrol_vH"))then{LV_patrol_vH = compile preprocessFile "addons\LV\patrol-vH.sqf";}; if(isNil("LV_patrol_vE"))then{LV_patrol_vE = compile preprocessFile "addons\LV\patrol-vE.sqf";}; //------------------------------------------ //functions for militarize if(isNil("LV_ACskills"))then{LV_ACskills = compile preprocessFile "addons\LV\LV_functions\LV_fnc_ACskills.sqf";}; if(isNil("LV_vehicleInit"))then{LV_vehicleInit = compile preprocessFile "addons\LV\LV_functions\LV_fnc_vehicleInit.sqf";}; if(isNil("LV_fullLandVehicle"))then{LV_fullLandVehicle = compile preprocessFile "addons\LV\LV_functions\LV_fnc_fullLandVehicle.sqf";}; if(isNil("LV_fullAirVehicle"))then{LV_fullAirVehicle = compile preprocessFile "addons\LV\LV_functions\LV_fnc_fullAirVehicle.sqf";}; if(isNil("LV_fullWaterVehicle"))then{LV_fullWaterVehicle = compile preprocessFile "addons\LV\LV_functions\LV_fnc_fullWaterVehicle.sqf";}; if(isNil("LV_militarize"))then{LV_militarize = compile preprocessFile "addons\LV\militarize.sqf";}; //------------------------------------------ //functions for simpleCache if(isNil("LV_GetPlayers"))then{LV_GetPlayers = compile preprocessFile "addons\LV\LV_functions\LV_fnc_getPlayers.sqf";}; if(isNil("LV_fnc_simpleCache"))then{LV_fnc_simpleCache = compile preprocessFile "addons\LV\LV_functions\LV_fnc_simpleCache.sqf";}; //------------------------------------------ //chript for changing gear on spawned troopers if(isNil("LV_chGearfMPs"))then{LV_chGearfMPs = compile preprocessFile "addons\LV\LV_chGearfMPs.sqf";}; //------------------------------------------ _side_list = [1, 2, 3]; //blue, red, green _mrkrText = "Patrol_Mrkr"; //text in mission placed markers to check for PatrolSpawnMarkers_list = []; _sCmilID_list = []; _usedLVgroupCnt = 0; _UsedmilID = 0; createCenter civilian; createCenter west; createCenter east; createCenter resistance; //get all Patrolmarkers and count them { if (_mrkrText == markerText _x) then { PatrolSpawnMarkers_list set [count PatrolSpawnMarkers_list, _x]; _usedLVgroupCnt = _usedLVgroupCnt + 1; //diag_log format["%1", _x]; sleep 0.001; }; }forEach allMapMarkers; //sleep 1; //diag_log format["%1", _usedLVgroupCnt]; //get randomness for militarize script and spawn each { _UsedtargetMrkr = getMarkerPos _x; _Usedside = _side_list select (floor(random(count _side_list))); _Usedradius = 200 + floor(random 300); _UsedspwnMen = [true, true]; _UsedspwnVeh = [false, false, false]; _Usedstill = false; _UsedMenRatio = [6, floor(random 5)]; _UsedVehRatio = [0, 0]; // [aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, // courage, commanding, general, endurance, reloadSpeed] _UsedSkill = [(0.6 + random 0.025), (0.3 + random 0.025), (0.5 + random 0.1), (0.6 + random 0.1), (0.4 + random 0.1), (0.6 + random 0.2), (0.8 + random 0.1), (0.5 + random 0.1), 0.7, 0.5]; //_UsedGroup = Nil; _UsedInit = "nul = [this] call LV_chGearfMPs;"; _UsedmilID = _UsedmilID + 1; _hndl = [_UsedtargetMrkr, _Usedside, _Usedradius, _UsedspwnMen, _UsedspwnVeh, _Usedstill, _UsedMenRatio, _UsedVehRatio, _UsedSkill, nil, _UsedInit, _UsedmilID] spawn LV_militarize; waitUntil {scriptDone _hndl}; _sCmilID_list set [count _sCmilID_list, _UsedmilID]; diag_log format["LV Militarize ready: %1", _UsedmilID]; }forEach PatrolSpawnMarkers_list; //set vars for simpleCache and call it _sCplayer_list = []; _sCdistance = 1800; _sCkpCnt = false; _sCMP = true; diag_log format["LV simpleCache starting..."]; nul = [_sCmilID_list, _sCplayer_list, _sCdistance, _sCkpCnt, _sCMP] spawn LV_fnc_simpleCache; Share this post Link to post Share on other sites
Cold Evil 13 Posted September 29, 2013 Ok, But it seams that all units stay spawned. Confirmed by using flight cam to the area. I gona look at your little change there and see what i can do :) Share this post Link to post Share on other sites
na_palm 19 Posted September 29, 2013 i begin to think that i need more coffee... :) You need to make sure to run this only on the server with isServer check. the spawning of groups/units take it time to easily 1-2 mins before simpleCache kicks in and manages all of them but then only the once your players are near are there for me. Share this post Link to post Share on other sites
spunfin 34 Posted September 29, 2013 Sorry that I've been a bit away, it's been crazy week! @supergruntsb78, Currently no without modifying classname arrays in scripts itself or/and parameters, but this feature is definitely coming! :) @Cold Evil, Yes, currently the lag at start of mission is enermous when you have many places where it first spawns units and then despawns them, so like Na_Palm stated, it takes minutes and causes bad strutter for a while. But this will also be changed soon! @Na_Palm, Thank you very much for your effort, those are excellent ideas and some of them are things I already should have done, but here we are.. :P About #24; 1. I know the original way is unnecessarily ugly way, and I've been struggling with myself on the idea of having somekind of combined init-file for these scripts to make it simplier and smoother, and you're probably right, it will make things better! 2. Ah, that explains. I've seen many people using marginally small sleeps on loops, and that some people dont use them, so I have just left it in "I'll think about it some day"-category. Yeah, now should be the day. :) 3. Good and reasonable idea. 4. Can't imagine why I havent done that already.. :P It will slow down simpleCache a lot, but I'm sure it will make a huge difference for the starting lag. 5. That call compile stuff.. I think it just stayed that way from earlier version where I really needed it for something, some of the parameters were causing errors without format. But better indeed if it works just with straight spawn! :) No worries, I dont see this as complaining, only as constructive feedback. Reason for <1.0 version numbering is exactly this lack of optimization, so maybe it's time for that step now. :) -SPUn Share this post Link to post Share on other sites
Cold Evil 13 Posted September 29, 2013 While i'm here i noticed that the helicopter reinforcements in the ambient combat sometimes drop ONLY pilots. No effect yet but i will try the opt file Na_Palm provided and see if it helps. Share this post Link to post Share on other sites
MANTIA 55 Posted September 29, 2013 @spunFIN Did you have a chance yet to take a look at the file I posted the other day? I still haven't been able to figure it out. Share this post Link to post Share on other sites
Cold Evil 13 Posted September 29, 2013 (edited) @Na_Palm So how do your modification work exactly. I understand so much the script recognize Patrol_Mrkr and Patrol_Mrkr_1 and adds militarize to this sector. and under: _side_list = [1, 2, 3]; you can change team spawning for example only Oppfor _side_list = [2]; and under: //get randomness for militarize script and spawn each you can set the parameters for the spawning. Set me straight if i am off now; IF i copy the full and paste the text, modify it for and change all _side_list to _side_list_b etc. and change the _mrkrText = "CivMarker"; i may be able to add civilian spawns right? Side 0 for civ right? EDIT: Or can i divide it to different files save the code as it is and call it from the init file with less changes then described above? EDIT2: And make it like: MilitaryBase.sqf, City.sqf etc. So i can get different spawns depending on city. Edited September 29, 2013 by Cold Evil Share this post Link to post Share on other sites
na_palm 19 Posted September 30, 2013 So how do your modification work exactly. I understand so much the script recognize Patrol_Mrkr and Patrol_Mrkr_1 and adds militarize to this sector. In the first forEach loop it runs through all markers placed on the map and scans in each of them for the text "Patrol_Mrkr". The name of the placed markers is not relevant! Only the text field counts. If matching the markername is been added to the array "PatrolSpawnMarkers_list" and the counter is increased. { if (_mrkrText == markerText _x) then { PatrolSpawnMarkers_list set [count PatrolSpawnMarkers_list, _x]; _usedLVgroupCnt = _usedLVgroupCnt + 1; //diag_log format["%1", _x]; sleep 0.001; }; }forEach allMapMarkers; this second forEach runs then through all before found matching markers in "PatrolSpawnMarkers_list" and extract there position and does fill all needed vars. for the militarize script. As this vars. will be filled for each viable marker anew. Look at the "floor(random xx)" parts. Also it fills each round another list "_sCmilID_list" with the used IDs for simpleCache. { _UsedtargetMrkr = getMarkerPos _x; _Usedside = _side_list select (floor(random(count _side_list))); _Usedradius = 200 + floor(random 300); _UsedspwnMen = [true, true]; _UsedspwnVeh = [false, false, false]; _Usedstill = false; _UsedMenRatio = [6, floor(random 5)]; _UsedVehRatio = [0, 0]; // [aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, // courage, commanding, general, endurance, reloadSpeed] _UsedSkill = [(0.06 + random 0.025), (0.3 + random 0.025), (0.5 + random 0.1), (0.6 + random 0.1), (0.4 + random 0.1), (0.6 + random 0.2), (0.8 + random 0.1), (0.5 + random 0.1), 0.7, 0.5]; //_UsedGroup = Nil; _UsedInit = "nul = [this] call LV_chGearfMPs;"; _UsedmilID = _UsedmilID + 1; _hndl = [_UsedtargetMrkr, _Usedside, _Usedradius, _UsedspwnMen, _UsedspwnVeh, _Usedstill, _UsedMenRatio, _UsedVehRatio, _UsedSkill, nil, _UsedInit, _UsedmilID] spawn LV_militarize; waitUntil {scriptDone _hndl}; _sCmilID_list set [count _sCmilID_list, _UsedmilID]; diag_log format["LV Militarize ready: %1", _UsedmilID]; sleep 0.001; }forEach PatrolSpawnMarkers_list; and under:_side_list = [1, 2, 3]; you can change team spawning for example only Oppfor _side_list = [2]; correct and under: //get randomness for militarize script and spawn each you can set the parameters for the spawning. correct Set me straight if i am off now; IF i copy the full and paste the text, modify it for and change all _side_list to _side_list_b etc. and change the _mrkrText = "CivMarker"; i may be able to add civilian spawns right?Side 0 for civ right? correct, also you could lessen the copy/pasting and introduce only a few new vars. or change the first forEach to account for both. But thats maybe something for later... EDIT:Or can i divide it to different files save the code as it is and call it from the init file with less changes then described above? correct, thats also possible. I know you dont want to hear it so often :) EDIT2:And make it like: MilitaryBase.sqf, City.sqf etc. So i can get different spawns depending on city. correct, which you then call per execVM or first use compile preprocessFile and then call directly execVM "server\MilitaryBase.sqf"; execVM "server\City.sqf"; ... I hope i lifted the curtain a bit, if not dont hesitate to ask more greetings Na_Palm Share this post Link to post Share on other sites
spunfin 34 Posted September 30, 2013 (edited) @DoRo, I'm using dev build so I didnt get that mission open in editor, but looked in sqm and spotted ""nul = [this] execVM 'RPKsoldier.sqf'"" as custom init in first fillHouse calling line. I think here's extra " " on it (but it might be just becouse I'm looking at it in text editor) and semicolon missing, so try: "nul = [this] execVM 'RPKsoldier.sqf';" Otherwise it looks ok to me. :) Edited September 30, 2013 by spunFIN Share this post Link to post Share on other sites
MANTIA 55 Posted September 30, 2013 (edited) @DoRo,I'm using dev build so I didnt get that mission open in editor, but looked in sqm and spotted ""nul = [this] execVM 'RPKsoldier.sqf'"" as custom init in first fillHouse calling line. I think here's extra " " on it (but it might be just becouse I'm looking at it in text editor) and semicolon missing, so try: "nul = [this] execVM 'RPKsoldier.sqf';" Otherwise it looks ok to me. :) I'm also on DEV Build But I made that change and now its working perfectly! Thanks a ton for the tool! Edited September 30, 2013 by DoRo Share this post Link to post Share on other sites
Cold Evil 13 Posted September 30, 2013 @Na_Palm: It works perfectly. But is there a way to efficiency this a lite more and calling the files at the main text. Instead of reading the code one by one. And maybe instead read the files one by one and at the end. The setup look like this at the moment: init.sqf /*---------------------------------------------------------------------------- Mission ----------------------------------------------------------------------------*/ execVM "LV_Related\Civilian_City_Mrkr.sqf"; execVM "LV_Related\Civilian_Town_Mrkr.sqf"; execVM "LV_Related\Civilian_Village_Mrkr.sqf"; execVM "LV_Related\Civilian_Industry_Mrkr.sqf"; execVM "LV_Related\Military_Outpost_Mrkr.sqf"; Civilian_Village_Mrkr.sqf (exsample): //functions for the div patrolscripts if(isNil("LV_CloseDoors"))then{LV_CloseDoors = compile preprocessFile "LV\LV_functions\LV_fnc_closeDoors.sqf";}; if(isNil("LV_nearestBuilding"))then{LV_nearestBuilding = compile preprocessFile "LV\LV_functions\LV_fnc_nearestBuilding.sqf";}; //new ones if(isNil("LV_patrol_vD"))then{LV_patrol_vD = compile preprocessFile "LV\patrol-vD.sqf";}; if(isNil("LV_patrol_vH"))then{LV_patrol_vH = compile preprocessFile "LV\patrol-vH.sqf";}; if(isNil("LV_patrol_vE"))then{LV_patrol_vE = compile preprocessFile "LV\patrol-vE.sqf";}; //------------------------------------------ //functions for militarize if(isNil("LV_ACskills"))then{LV_ACskills = compile preprocessFile "LV\LV_functions\LV_fnc_ACskills.sqf";}; if(isNil("LV_vehicleInit"))then{LV_vehicleInit = compile preprocessFile "LV\LV_functions\LV_fnc_vehicleInit.sqf";}; if(isNil("LV_fullLandVehicle"))then{LV_fullLandVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullLandVehicle.sqf";}; if(isNil("LV_fullAirVehicle"))then{LV_fullAirVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullAirVehicle.sqf";}; if(isNil("LV_fullWaterVehicle"))then{LV_fullWaterVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullWaterVehicle.sqf";}; if(isNil("LV_militarize"))then{LV_militarize = compile preprocessFile "LV\militarize.sqf";}; //------------------------------------------ //functions for simpleCache if(isNil("LV_GetPlayers"))then{LV_GetPlayers = compile preprocessFile "LV\LV_functions\LV_fnc_getPlayers.sqf";}; if(isNil("LV_fnc_simpleCache"))then{LV_fnc_simpleCache = compile preprocessFile "LV\LV_functions\LV_fnc_simpleCache.sqf";}; //------------------------------------------ //chript for changing gear on spawned troopers if(isNil("LV_chGearfMPs"))then{LV_chGearfMPs = compile preprocessFile "LV\LV_chGearfMPs.sqf";}; //------------------------------------------ _side_list = [0]; //blue, red, green _mrkrText = "Village_Mrkr"; //text in mission placed markers to check for PatrolSpawnMarkers_list = []; _sCmilID_list = []; _usedLVgroupCnt = 0; _UsedmilID = 0; waitUntil {player == player}; createCenter civilian; createCenter west; createCenter east; createCenter resistance; //get all Patrolmarkers and count them { if (_mrkrText == markerText _x) then { PatrolSpawnMarkers_list set [count PatrolSpawnMarkers_list, _x]; _usedLVgroupCnt = _usedLVgroupCnt + 1; hint format["%1", _x]; sleep 0.001; }; }forEach allMapMarkers; sleep 1; hint format["%1", _usedLVgroupCnt]; //get randomness for militarize script and spawn each { _UsedtargetMrkr = getMarkerPos _x; _Usedside = _side_list select (floor(random(count _side_list))); _Usedradius = 100; //+ floor(random 300); _UsedspwnMen = [true, false]; //Land, Water _UsedspwnVeh = [true, false, false]; //Land, Water, Air _Usedstill = true; _UsedMenRatio = [4, floor(random 2)]; _UsedVehRatio = [1, floor(random 1)]; // [aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, // courage, commanding, general, endurance, reloadSpeed] _UsedSkill = [(0.5 + random 0.1), (0.3 + random 0.025), (0.5 + random 0.1), (0.6 + random 0.1), (0.4 + random 0.1), (0.6 + random 0.2), (0.8 + random 0.1), (0.3 + random 0.025), 0.7, 0.5]; _UsedGroup = Nil; _UsedInit = "nul = [this] call LV_chGearfMPs;"; _UsedmilID = _UsedmilID + 1; _hndl = [_UsedtargetMrkr, _Usedside, _Usedradius, _UsedspwnMen, _UsedspwnVeh, _Usedstill, _UsedMenRatio, _UsedVehRatio, _UsedSkill, nil, _UsedInit, _UsedmilID] spawn LV_militarize; waitUntil {scriptDone _hndl}; _sCmilID_list set [count _sCmilID_list, _UsedmilID]; hint format["Civ ready: %1", _UsedmilID]; }forEach PatrolSpawnMarkers_list; //set vars for simpleCache and call it _sCplayer_list = [player1]; _sCdistance = 500; _sCkpCnt = false; _sCMP = false; nul = [_sCmilID_list, _sCplayer_list, _sCdistance, _sCkpCnt, _sCMP] spawn LV_fnc_simpleCache; hint format["simpleCache ready!"]; ----------------------------------- An example of what I'm talking about: Init.sqf //functions for the div patrolscripts if(isNil("LV_CloseDoors"))then{LV_CloseDoors = compile preprocessFile "LV\LV_functions\LV_fnc_closeDoors.sqf";}; if(isNil("LV_nearestBuilding"))then{LV_nearestBuilding = compile preprocessFile "LV\LV_functions\LV_fnc_nearestBuilding.sqf";}; //new ones if(isNil("LV_patrol_vD"))then{LV_patrol_vD = compile preprocessFile "LV\patrol-vD.sqf";}; if(isNil("LV_patrol_vH"))then{LV_patrol_vH = compile preprocessFile "LV\patrol-vH.sqf";}; if(isNil("LV_patrol_vE"))then{LV_patrol_vE = compile preprocessFile "LV\patrol-vE.sqf";}; //------------------------------------------ //functions for militarize if(isNil("LV_ACskills"))then{LV_ACskills = compile preprocessFile "LV\LV_functions\LV_fnc_ACskills.sqf";}; if(isNil("LV_vehicleInit"))then{LV_vehicleInit = compile preprocessFile "LV\LV_functions\LV_fnc_vehicleInit.sqf";}; if(isNil("LV_fullLandVehicle"))then{LV_fullLandVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullLandVehicle.sqf";}; if(isNil("LV_fullAirVehicle"))then{LV_fullAirVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullAirVehicle.sqf";}; if(isNil("LV_fullWaterVehicle"))then{LV_fullWaterVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullWaterVehicle.sqf";}; if(isNil("LV_militarize"))then{LV_militarize = compile preprocessFile "LV\militarize.sqf";}; //------------------------------------------ //functions for simpleCache if(isNil("LV_GetPlayers"))then{LV_GetPlayers = compile preprocessFile "LV\LV_functions\LV_fnc_getPlayers.sqf";}; if(isNil("LV_fnc_simpleCache"))then{LV_fnc_simpleCache = compile preprocessFile "LV\LV_functions\LV_fnc_simpleCache.sqf";}; //------------------------------------------ //chript for changing gear on spawned troopers if(isNil("LV_chGearfMPs"))then{LV_chGearfMPs = compile preprocessFile "LV\LV_chGearfMPs.sqf";}; //------------------------------------------ execVM "LV_Related\Civilian_Village_Mrkr.sqf"; //set vars for simpleCache and call it _sCplayer_list = [player1]; _sCdistance = 500; _sCkpCnt = false; _sCMP = false; nul = [_sCmilID_list, _sCplayer_list, _sCdistance, _sCkpCnt, _sCMP] spawn LV_fnc_simpleCache; hint format["simpleCache ready!"]; Civilian_Village_Mrkr.sqf (Exsample) _side_list = [0]; //blue, red, green _mrkrText = "Village_Mrkr"; //text in mission placed markers to check for PatrolSpawnMarkers_list = []; _sCmilID_list = []; _usedLVgroupCnt = 0; _UsedmilID = 0; waitUntil {player == player}; createCenter civilian; createCenter west; createCenter east; createCenter resistance; //get all Patrolmarkers and count them { if (_mrkrText == markerText _x) then { PatrolSpawnMarkers_list set [count PatrolSpawnMarkers_list, _x]; _usedLVgroupCnt = _usedLVgroupCnt + 1; hint format["%1", _x]; sleep 0.001; }; }forEach allMapMarkers; sleep 1; hint format["%1", _usedLVgroupCnt]; //get randomness for militarize script and spawn each { _UsedtargetMrkr = getMarkerPos _x; _Usedside = _side_list select (floor(random(count _side_list))); _Usedradius = 100; //+ floor(random 300); _UsedspwnMen = [true, false]; //Land, Water _UsedspwnVeh = [true, false, false]; //Land, Water, Air _Usedstill = true; _UsedMenRatio = [4, floor(random 2)]; _UsedVehRatio = [1, floor(random 1)]; // [aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, // courage, commanding, general, endurance, reloadSpeed] _UsedSkill = [(0.5 + random 0.1), (0.3 + random 0.025), (0.5 + random 0.1), (0.6 + random 0.1), (0.4 + random 0.1), (0.6 + random 0.2), (0.8 + random 0.1), (0.3 + random 0.025), 0.7, 0.5]; _UsedGroup = Nil; _UsedInit = "nul = [this] call LV_chGearfMPs;"; _UsedmilID = _UsedmilID + 1; _hndl = [_UsedtargetMrkr, _Usedside, _Usedradius, _UsedspwnMen, _UsedspwnVeh, _Usedstill, _UsedMenRatio, _UsedVehRatio, _UsedSkill, nil, _UsedInit, _UsedmilID] spawn LV_militarize; waitUntil {scriptDone _hndl}; _sCmilID_list set [count _sCmilID_list, _UsedmilID]; hint format["Civ ready: %1", _UsedmilID]; }forEach PatrolSpawnMarkers_list; Share this post Link to post Share on other sites
tortuosit 486 Posted September 30, 2013 (edited) Thanks for your work... Guys, I'm not competent in ArmA scripting at all. My questions my be somewhat basic... So lets say I want to have ambient combat simply all over Altis, simply around the player at any time and anywhere: // Combat nul = [200,900,20 + floor(random 10),200 + floor(random 100),6,[random 0.5 + 0.2, 1, random 0.5 + 0.5],player,[random 0.4 + 0.1,random 0.4 + 0.1,random 0.4 + 0.1,random 0.4 + 0.1,random 0.4 + 0.1,random 1,random 1,random 1,random 1,random 1],1,2500,nil,["CARELESS","MOVE"],false] execVM "LV\ambientCombat.sqf"; How do I call it? Do I always need a trigger? I mean, I always want it. The trigger should be the start of the mission. I am not at my ArmA rig now; can I put the above code into the player init field? Or is there a misunderstanding on my side, i.e. if I put code into the player init, it will only spawn it's stuff once and then nevetr again? So I need to make triggers all over the map? TIA :) Edited September 30, 2013 by tortuosit Share this post Link to post Share on other sites
na_palm 19 Posted September 30, 2013 (edited) @tortuosit: i cant say much here so wait for spunFIN to answer this @Cold Evil: have had only one coffee so far... maybe this will run out of the box or trow a lot of errors init.sqf //functions for the div patrolscripts if(isNil("LV_CloseDoors"))then{LV_CloseDoors = compile preprocessFile "LV\LV_functions\LV_fnc_closeDoors.sqf";}; if(isNil("LV_nearestBuilding"))then{LV_nearestBuilding = compile preprocessFile "LV\LV_functions\LV_fnc_nearestBuilding.sqf";}; if(isNil("LV_patrol_vD"))then{LV_patrol_vD = compile preprocessFile "LV\patrol-vD.sqf";}; if(isNil("LV_patrol_vH"))then{LV_patrol_vH = compile preprocessFile "LV\patrol-vH.sqf";}; if(isNil("LV_patrol_vE"))then{LV_patrol_vE = compile preprocessFile "LV\patrol-vE.sqf";}; //------------------------------------------ //functions for militarize if(isNil("LV_ACskills"))then{LV_ACskills = compile preprocessFile "LV\LV_functions\LV_fnc_ACskills.sqf";}; if(isNil("LV_vehicleInit"))then{LV_vehicleInit = compile preprocessFile "LV\LV_functions\LV_fnc_vehicleInit.sqf";}; if(isNil("LV_fullLandVehicle"))then{LV_fullLandVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullLandVehicle.sqf";}; if(isNil("LV_fullAirVehicle"))then{LV_fullAirVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullAirVehicle.sqf";}; if(isNil("LV_fullWaterVehicle"))then{LV_fullWaterVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullWaterVehicle.sqf";}; if(isNil("LV_militarize"))then{LV_militarize = compile preprocessFile "LV\militarize.sqf";}; //------------------------------------------ //functions for simpleCache if(isNil("LV_GetPlayers"))then{LV_GetPlayers = compile preprocessFile "LV\LV_functions\LV_fnc_getPlayers.sqf";}; if(isNil("LV_fnc_simpleCache"))then{LV_fnc_simpleCache = compile preprocessFile "LV\LV_functions\LV_fnc_simpleCache.sqf";}; //------------------------------------------ //chript for changing gear on spawned troopers if(isNil("LV_chGearfMPs"))then{LV_chGearfMPs = compile preprocessFile "LV\LV_chGearfMPs.sqf";}; //------------------------------------------ private["_sCplayer_list","_sCdistance","_sCkpCnt","_sCMP","_hndle"]; //set vars for simpleCache _sCplayer_list = [player1]; _sCdistance = 500; _sCkpCnt = false; _sCMP = false; //don't make "sCmilID_list" private, it is referred to in the other scripts sCmilID_list = []; //wait to player initialise waitUntil {player == player}; //Centers need only be placed once createCenter civilian; createCenter west; createCenter east; createCenter resistance; //only run these scripts after another //if run concurrently they will break as they rely on correct filled "sCmilID_list" _hndle = [] execVM "LV_Related\Civilian_City_Mrkr.sqf"; waitUntil {scriptDone _hndle}; _hndle = [] execVM "LV_Related\Civilian_Town_Mrkr.sqf"; waitUntil {scriptDone _hndle}; _hndle = [] execVM "LV_Related\Civilian_Village_Mrkr.sqf"; waitUntil {scriptDone _hndle}; _hndle = [] execVM "LV_Related\Civilian_Industry_Mrkr.sqf"; waitUntil {scriptDone _hndle}; _hndle = [] execVM "LV_Related\Military_Outpost_Mrkr.sqf"; waitUntil {scriptDone _hndle}; //call simpleCache hint format["simpleCache starting..."]; nul = [sCmilID_list, _sCplayer_list, _sCdistance, _sCkpCnt, _sCMP] spawn LV_fnc_simpleCache; exsample for Civilian_Village_Mrkr.sqf private["_side_list","_mrkrText","_PatrolSpawnMarkers_list","_UsedmilID","_x","_UsedtargetMrkr","_Usedside","_Usedradius","_UsedspwnMen","_UsedspwnVeh","_Usedstill","_UsedMenRatio","_UsedVehRatio","_UsedSkill","_UsedGroup","_UsedInit","_UsedmilID","_hndl"]; _side_list = [0]; //blue, red, green _mrkrText = "Village_Mrkr"; //text in mission placed markers to check for _PatrolSpawnMarkers_list = []; //"_Used milID" is now based on the count of IDs in now global "sCmilID_list" _UsedmilID = count sCmilID_list; //get all Patrolmarkers and count them { if (_mrkrText == markerText _x) then { _PatrolSpawnMarkers_list set [count _PatrolSpawnMarkers_list, _x]; hint format["%1", _x]; sleep 0.001; }; }forEach allMapMarkers; //get randomness for militarize script and spawn each { _UsedtargetMrkr = getMarkerPos _x; _Usedside = _side_list select (floor(random(count _side_list))); _Usedradius = 100; //+ floor(random 300); _UsedspwnMen = [true, false]; //Land, Water _UsedspwnVeh = [true, false, false]; //Land, Water, Air _Usedstill = true; _UsedMenRatio = [4, floor(random 2)]; _UsedVehRatio = [1, floor(random 1)]; // [aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, // courage, commanding, general, endurance, reloadSpeed] _UsedSkill = [(0.5 + random 0.1), (0.3 + random 0.025), (0.5 + random 0.1), (0.6 + random 0.1), (0.4 + random 0.1), (0.6 + random 0.2), (0.8 + random 0.1), (0.3 + random 0.025), 0.7, 0.5]; _UsedGroup = Nil; _UsedInit = "nul = [this] call LV_chGearfMPs;"; _UsedmilID = _UsedmilID + 1; _hndl = [_UsedtargetMrkr, _Usedside, _Usedradius, _UsedspwnMen, _UsedspwnVeh, _Usedstill, _UsedMenRatio, _UsedVehRatio, _UsedSkill, nil, _UsedInit, _UsedmilID] spawn LV_militarize; waitUntil {scriptDone _hndl}; sCmilID_list set [count sCmilID_list, _UsedmilID]; hint format["Civ ready: %1", _UsedmilID]; sleep 0.001; }forEach _PatrolSpawnMarkers_list; Edited September 30, 2013 by Na_Palm corrected the code Share this post Link to post Share on other sites
Von Quest 1163 Posted September 30, 2013 @tortuosit Sometimes I think people get a little too myopic with the scripting, and forget all the clever tricks you can do with the editor. I love love this pack. Can't play without it! Just some thoughts off the top of my head. Not tested. Should work (famous last words). 1. Place Trigger; name it trigX and attachto player named P1. trigX attachto[P1,[0,0,0]]; 2. Setup the Trigger to PRESENT and then REPEATEDLY. Set Condition: player in thislist Set your Min,Mid,Max Times to whatever: 600,1200,2400 (all 600s would be every 10 mins) 3. Set the On Act: execVM "LV\ambientCombat.sqf"; Just a thought, you will be carrying your own trigger everywhere and keep tripping it. Keep in mind this great script pack is highly customizable. You can spawn anything. Share this post Link to post Share on other sites
Cold Evil 13 Posted September 30, 2013 (edited) @Na_Palm trying it out now. EDIT: Ive tried it out BUT it seams that it only reads one group of civilians. EDIT2: Do you think it might conflict that the military town has the same marker name? Edited September 30, 2013 by Cold Evil Share this post Link to post Share on other sites
spunfin 34 Posted September 30, 2013 @tortuosit, You can set that in players init and it will run forever. :) So basicly now when you have 6 as group amount parameter, it will spawn 6 "groups" and as soon as anyone of them is dead it will start min-max delay -counter and spawn new group, so there's always that 6 ambient groups in total. And now when you have player as center unit and multiplayer mode disabled, it will work in SP like you wanted; groups will be spawned always around player and their waypoints will also be around player, so you can move where ever you want and war will follow you. To get it a bit more intense, make dissapearDistance a bit smaller, maybe like 50m larger than max distance is (=950 in that example). That way ambientCombat moves faster with you since it deletes far away groups in 950m and starts to spawn new ones, instead of that default 2500m. :) Share this post Link to post Share on other sites
tortuosit 486 Posted September 30, 2013 (edited) Guys, thanks for your replies. I'll check it @spunFIN... So it runs timers itself... @Goblin I think with your solution we would have double timers :) EDIT: Still a question. Lets say I call your script once in the player init. Lets say I called a script as I mentioned with random function: Is it correct: will it spawn units always with the same values then? But if I for instance set new triggers all over the map (i.e. it is called freshly) the values will vary? With Goblins solution (triggering your scripts endlessly with a timer), will I get numerous instances of your script running? I get confused :) Edited September 30, 2013 by tortuosit Share this post Link to post Share on other sites
na_palm 19 Posted September 30, 2013 EDIT:Ive tried it out BUT it seams that it only reads one group of civilians. have you changed the vars "_side_list" and "_UsedInit" in your different scripts? That's the only thing i can think of with could cause that. Or does i dont get the question? EDIT2:Do you think it might conflict that the military town has the same marker name? that should be irrelevant as the markers are only used to get the position for 'militarize' Share this post Link to post Share on other sites
Cold Evil 13 Posted September 30, 2013 have you changed the vars "_side_list" and "_UsedInit" in your different scripts? That's the only thing i can think of with could cause that. Or does i dont get the question? I copied your code you wrote and used that as a template when redoing them. Share this post Link to post Share on other sites
spunfin 34 Posted September 30, 2013 @tortuosit, Yes, it will make those randomizations at first time and uses selected values on each, so it wont randomize them again. And yes, repeating trigger would make it execute new instance of ambientCombat, so after some time there would be a lot off them and that would get messy. :P Unless if you use also LV_fnc_removeAC.sqf to make "old" AC groups to flee & get deleted, wait until it has ran and then execute new ambientCombat. But that Goblin's idea indeed gave me some new ideas! :) Share this post Link to post Share on other sites
na_palm 19 Posted September 30, 2013 @Cold Evil If you have changed the gear replacement script and use different versions of it in the other "gather" scripts you would have to compile them too in the init.sqf. somehow i think i don't get it strait..... If this was no help maybe you could upload the mission so i can have a look at it and what goes wrong.... Share this post Link to post Share on other sites
Cold Evil 13 Posted September 30, 2013 @Na_Palm i use all the files you provided in your change. The only modification i have done to the file is from "addon\LV\..." to "LV\..." Uploading the mission yo your PM Share this post Link to post Share on other sites