Chuc 83 Posted May 25, 2018 How would or could i get loot to fall to the ground if it spawns in a destroyed building? Looks odd having loot float in the air with no way to get to it Share this post Link to post Share on other sites
pierremgi 4641 Posted May 25, 2018 it's hard to obtain a perfect result. Use the "WeaponHolderSimulated_scripted" to spawn any weapon, item or mag inside it. Far best result with only one object per building position because the WH volumes/objects tend to be stacked onto each others. The "simulated" side makes the object falling on the nearest surface. the "scripted" is absolutely useful to keep the weapon holder, even if empty. (An empty weaponHolder disappears, sometimes before you add some scripted randomized weapon...) Yes, if you lose some loots, especially during heavy scenarios, try the WH_scripted. 2 Share this post Link to post Share on other sites
Funkdoc 3 Posted September 1, 2018 (edited) Hello i just find out that Loot spawned by "createVehicle" is also accessible without the "groundWeaponHolder" method. Has this any disadvantages? I have still problems with the "buildingpos" of a building. i tried to set the Lootposition on floor/ground level with the "lineIntersectsSurfaces" command. in most cases it works just fine, but some buildings seems to have surfaces above the ground (invisible) where it gets the wrong z zeroing when it intersects with the first surface. the items in this case are set to about 0.2-0.4m over ground. Any workaround? Thanks Edited September 1, 2018 by Funkdoc Share this post Link to post Share on other sites
pierremgi 4641 Posted September 1, 2018 No real disadvantage. If you spawn a weapon + x magazines, it's usually better to grab them all together... or not. And the fact a simulated WH is better than a "hard" createVehicle for your second problem. A WH simulated let the objects fall. So, you don't need any lineIntersectSurfaces. Yes some buildings have floor above ground... not an abnormal situation: How are you using lineIntersectSurfaces? (start stop, LODs)? Share this post Link to post Share on other sites
Funkdoc 3 Posted September 1, 2018 its not the problem that the floor is above terrain level. the problem is that there is no surface visible between "buildingpos" and "_surfaceRefPoint" in some houses but it intersects a surface anywhere between... dont know why. it works in most houses very well. i just want to spawn a single item per buildingpos. a workaround would be to set a offset for each building... just asked if there is another solution. Tested as MP server script on Chernarus Redux with problems. this is only for testing loot deployment and is executed just once by console serverside. //Spawn one loot item in next building to player at random floor position _possiblePoints = count (nearestBuilding player buildingPos -1); //count interior buildinpositions _nextLootPoint = nearestBuilding player buildingPos -1 select floor random _possiblePoints; //get random buildingposition ATLtoASL _nextLootPoint; //Translation for lineintersectsurface function _surfaceRefPoint = [_nextLootPoint select 0, _nextLootPoint select 1, (_nextLootPoint select 2) - 8]; //set a surface intersection reference point //get next surface intersection z axis downwards _surfaceList = lineIntersectsSurfaces [_nextLootPoint, _surfaceRefPoint, objNull, objNull, true, 1,"VIEW","FIRE"]; _surfaceDistance = if (count _surfaceList > 0) then [{(_surfaceList select 0 select 0) distance _nextLootPoint},{0}]; //get distance to first surface intersection _nextLootPoint set [2, ((_nextLootPoint select 2) - _surfaceDistance)]; //set z value to floor height ASLtoATL _nextLootPoint; //Backtranslation for lootspawnpoint Loot = createVehicle ["Item_optic_AMS", _nextLootPoint,[],0,"can_collide"]; //spawn loot item Loot setDir floor random 360; //set random loot direction run this in a loop for several times serverside and u will see how the ground fills up at the randomized buildingposiotons On Tanoa it works great in any house on any floor (example in multifloor house "house_big_04_f").. no problems.. tested whats the problem here Share this post Link to post Share on other sites
pierremgi 4641 Posted September 1, 2018 The reason why I asked you for lineIntersectSurfaces. you wrote: lineIntersectsSurfaces [_nextLootPoint, _surfaceRefPoint, objNull, objNull, true, 1,"VIEW","FIRE"]; that means both Fire and view LODs are checked. try with VIEW and NONE Try also the reverse line : lineIntersectsSurfaces [ _surfaceRefPoint, _nextLootPoint, objNull, objNull, true, 1,"VIEW","NONE"] 1 Share this post Link to post Share on other sites
Larrow 2732 Posted September 1, 2018 + You do not change the ASL back into ATL. 2 hours ago, Funkdoc said: ASLtoATL _nextLootPoint; //Backtranslation for lootspawnpoint Will not change the value of _nextLootPoint directly, only return an updated value. _nextLootPoint = ASLtoATL _nextLootPoint; //Backtranslation for lootspawnpoint 1 Share this post Link to post Share on other sites
Funkdoc 3 Posted September 2, 2018 53 minutes ago, Larrow said: Will not change the value of _nextLootPoint directly, only return an updated value. Yes that was it. now the loot spawns on the floor on all levels of the house... thanks alot Share this post Link to post Share on other sites
Funkdoc 3 Posted September 2, 2018 1 hour ago, pierremgi said: that means both Fire and view LODs are checked. try with VIEW and NONE also right, it only works correctly with the "view" param. thanks Share this post Link to post Share on other sites
Funkdoc 3 Posted September 9, 2018 hello again, after some lines of sqf code i 've successfully asigned loot positions to a building loot container. just one item can now randomly spawn on free buildingpositions. i do not use a permanent variable for the the "vehicle" and wont really use variables for loot. At the moment, the vehicle variable is overwritten by the next loot item spawned every execution. this sets the previous spawned item as a object with a dummyItem reference. i can access the dummyitem (with nearestObject..) with the saved position to delete it, for example. the only global variables that i have assigned is the loot container and the positions and ID's of the buildings...2 separeted arrays. these arrays will (or not) append whenever new loot spawns were triggered by a player. goals: performance, ..not too much loops and absolutly no time suspensions (sleep ; waituntil..) ...i 've also made a new timer function without the needs of use of these commands. script should work on any map with enterable buildings with defined "buildingPos" positions. adjustable spawnpoints (vector pos offset) per buildingpos for every building class adjustable limitation of loot count for every building class initial server state has no loot, everything is triggered by roaming players over time adjustable loot despawner, auto cleanup adjustable loot list loot classes like survival, weapons, ammunition, special,... questions: arrays are limited to 9,999 elements, how to expand containers for big or high density maps in a server performant manner? am i on the right way with not assigning variables to spawned loot? should there be generally persistent loot after server restarts? is it better to make my own spawn positions instead of using buildingpos? (in most buildings are enough pos for adjusting it) any thoughts, tips, opinions...welcome 2 Share this post Link to post Share on other sites