dreadedentity 278 Posted October 20, 2014 pps.: How about turning it into a real framework that calls a list of functions that can then be easily rewritten / adjusted based on the current requirements. Got a new bun in the oven as we speak :) Yeah it'd be cool to have a loot system that spawned random furniture, tables and the like, and then weapons and stuff ontop. Got an idea for this too :p You don't use an init.sqf as I think you are calling it via the functions.hpp with the postInit=1 ? Correct ? Actually all you have to do is save the code in a script posted by either me or iceman, then just execVM that script in init.sqf Hey guys, just stumbled upon this thread and I really like what I see.I also started my own loot-system but for multiplayer use and with somekind of persistence but I was very busy the last and couldn't continue with my own script. But maybe I can help you guys with some stuff I already archieved: First: Persistence would be cool. You check a house, see a magazine you don't need and go on. Later you find a weapon for this mag and want to get it... but it was already despawned. For this you could create a array with all spawned items, or even better: one Array for every house with all of it's (cached) positions and spawned items. If a house is out of range, the list of items gets updated (maybe a player took soemthing). If a house is "activated" the scripts checks the array for objects. If there are no objects yet, objects get spawned by the script above. Of there are objects in the array, the objects are respawned". To accelerate the checks for the buildings and the corresponding array, I would divide the arrays into larger arrays for every mapgrid. Like somekind of hashing. This can accelerate the looping through all houses in the distance. Also the cleanup could be designed much more ressource friendly :D Another nice trick: Remove the "while(true)"-loop and but the call in a trigger that activated itself every second. The script is called in non-scheduled environment and is much faster. If you want I can try to merge your spawning with my persistence system or we can create a repository at github or something for this. Thanks! If you want to set something up go ahead, and PM me the details. Actually you can PM everyone :p The part I put in bold: I think this would be a bad idea for really intense functions. Being in a non-scheduled environment means that the code will run all the way through, without any other scripts/functions being able to run. The main problem here, is that this could cause extreme fps drops if the processes are intensive enough. For a practical example: Anybody remember that one DayZ mod update where the players would lose 20-40 fps every few seconds? Share this post Link to post Share on other sites
iceman77 18 Posted October 20, 2014 Got an idea for this too :p... Actually all you have to do is save the code in a script posted by either me or iceman, then just execVM that script in init.sqf #1 Good good! Interested. #2 For spitfire, I've did a whole custom code utilizing a bit of your framework and put it into an example for him. I loaded it as a function too. I re-directed him to the proper thread as to not confuse anyone. Since different parameters are being passed, more arguments etc etc, for his custom doo dad. Don't want confusion in your main thread and sorry if I've already caused some haha. :p Share this post Link to post Share on other sites
NeoArmageddon 958 Posted October 20, 2014 I think this would be a bad idea for really intense functions Just make your function small and without a loop. You could part the function in multiple processes. Works like a charm for me. I used it to make checks in a large octree strcutures: I created 1000 objects in a 500m radius and checked every 1 sec which objects are 10m or less from the player to render an icon at there position (This was going to be a debugging tool for my loot-system). Of course a "waituntil" for every object in this scenario won't work very well. In my optionion scripts have to be written for non-scheduled execution. I always prefer good old non-scheduled script. If I remember correct, OFP and A1 script were always non-scheduled. Share this post Link to post Share on other sites
jshock 513 Posted October 20, 2014 (edited) I always prefer good old non-scheduled script. If I remember correct, OFP and A1 script were always non-scheduled. The only issue doing only non-scheduled is that you can't run scripts in parallel (or at least not as well), which for some situations, could be an unexpected end result. Such as exampled in this thread. Edited October 20, 2014 by JShock Share this post Link to post Share on other sites
csk222 23 Posted October 23, 2014 I see what you've done with the "Find Garage", could this be turned into something involving IEDs and the road? Just an idea. Share this post Link to post Share on other sites
jshock 513 Posted October 23, 2014 (edited) I see what you've done with the "Find Garage", could this be turned into something involving IEDs and the road? Just an idea. It would and could be possible, but you could also simply use something along the lines of BIS_fnc_findNearestRoad (may be just nearestRoad) to accomplish the same thing. You would also have to add in triggers of course. And there is the Roadside IED script already out there :p. Edited October 23, 2014 by JShock Share this post Link to post Share on other sites
dreadedentity 278 Posted October 23, 2014 I see what you've done with the "Find Garage", could this be turned into something involving IEDs and the road? Just an idea. Yes, this is entirely possible. You'd just have to scan for road sections, then do some modelToWorld magic Share this post Link to post Share on other sites
iceman77 18 Posted October 23, 2014 (edited) Here's some crappy mine script I wrote ages ago. Put's mines onto the road. Uses near roads. I'm sure it can be improved and all that jazz, but I'm just posting to lend ideas. That's all. :) Cheers. /* --------------------------------------------------------------------------------------------------------- Parameter(s): _this select 0 <object> Center of the mine area _this select 1 <number> distance to search for positions _this select 2 <array> - array of mine types _this select 3 <number> Minimum distance mines can spawn from one another _this select 4 <bool> Debug Mode _this select 5 <bool> Random mine generation Usage: _nul = [player, 50, ["APERSBoundingMine"], 10, true, false] execVM "mines.sqf"; ---------------------------------------------------------------------------------------------------------*/ private []; if (!isServer) exitWith {}; _center = _this select 0; _centerDist = _this select 1; _typeOfMine = _this select 2; _spread = _this select 3; _debug = _this select 4; _randomGen = _this select 5; _list = _center nearRoads _centerDist; _posArray = []; _trash = false; _mine = objNull; for "_i" from 0 to (count _list - 1) do { if (_trash) then {_trash = false;}; _position = getPosATL (_list select _i); for "_i" from 0 to count _posArray - 1 do { if (_position distance (_posArray select _i) < _spread) exitWith {_trash = true;}; }; if (! _trash) then { _posArray set [count _posArray, _position]; if (_randomGen) then { _random = [1,2] call BIS_fnc_selectRandom; if (_random == 1) then {//50% chance to generate the mine _mine = createMine [_typeOfMine call BIS_fnc_selectRandom, _position, [], 0]; }; } else { _mine = createMine [_typeOfMine call BIS_fnc_selectRandom, _position, [], 0]; }; if (!isNull _mine && {_debug}) then { _mrk = createMarker [format ["%1", random 10000], _mine]; _mrk setMarkerShape "ICON"; _mrk setMarkerType "mil_dot"; _mrk setMarkerSize [1,1]; _mrk setMarkerColor "colorRed"; }; }; }; Edited November 3, 2014 by Iceman77 Share this post Link to post Share on other sites
Nexusmax 16 Posted November 2, 2014 That's a evil script Iceman. I like it Sent from my SM-N900A using Tapatalk Share this post Link to post Share on other sites