phronk 898 Posted November 14, 2017 DESCRIPTION: This is a script which dynamically spawns furniture in houses around players. Easy to setup! VIDEO: SCREENSHOTS: Spoiler ALTIS / MALDEN / STRATIS: Coming Soon... TANOA: Coming Soon... LIVONIA: Spoiler FEATURES: No mods required! No DLCs required! Compatible with all maps which use buildings from Altis, Malden, Stratis, and Tanoa Compatible with single-player, client-hosted, and dedicated servers Nearly no performance impact Spawns furniture in random houses within town, when player enters it Furniture layouts are built with AI pathing / buildingPositons in mind Despawns the furniture when there are no players within that town Includes an easy to configure script file TO DO LIST: (Upcoming Change-Log) Finish support for Tanoa buildings Include furniture layouts for abandoned buildings Create up to 5 possible furniture layouts for each individual unique building KNOWN BUGS: Bug free! CREDITS: Phronk: Script Creator Bohemia Interactive: Furniture models, textures, and configs CONTRIBUTORS: Metalman10 optimized the initialization of functions TESTERS: Chaser (ATCAG) PRYMSUSPEC Sjakal INSTALLATION: Copy & paste the "PF" folder into your mission's root folder EXAMPLE: C:\Users\<MyUsername>\Documents\Arma 3 - Other Profiles\missions\<myMissionName.mapName> Copy & paste this line of code into your mission's init.sqf:if(isServer)then{PFrun=false;[]spawn compileFinal(preprocessFile"PF\init.sqf")}; Done! (OPTIONAL) - The "CFG.sqf" file in the "PF" folder is the settings file. PF_On = TRUE; //TRUE enables furniture, FALSE disables it (Default = TRUE) PF_Range = 60; //Activation range on buildings to spawn furniture (Default = 60) PF_BlacklistObj = [""]; //List of building CLASSNAMES to avoid spawning furniture in (Example: ["land_slum_01_f"]) v0.7 (20.JUN.2021) DOWNLOAD LINK - (Google Drive) DOWNLOAD LINK - (Steam Workshop)DOWNLOAD LINK - (Armaholic) CHANGE-LOGS: Spoiler (06MAR2018) v0.6 Added: New furniture layout for Land_i_Addon_03_V1_F Added: New furniture layout for Land_Slum_House01_F Added: New furniture layout for Land_Slum_House02_F Added: New furniture layout for Land_Slum_House03_F Added: New furniture layout for Land_Shed_02_F Added: New furniture layout for Land_House_Big_01_F Added: New setting in 'CFG.sqf' to toggle "Optimization Mode" Added: Playable unit to player's group in demo mission for MP testing Tweaked: Invisible helipads on each building have a "PF" variable set on them Tweaked: Enabled simulation for invisible helipads on each building Fixed: Furniture wouldn't rotate on dedicated servers Fixed: Only 2 of the 7 supported Tanoa houses would actually spawn furniture Fixed: Invisible helipads not spawned by furniture script could get deleted Fixed: Sofa objects were mixed up in Land_i_House_Small_02_V1_F Fixed: Missing bucket object script error, in h1_4.sqf Fixed: Tanoa furniture script h1_1 incorrectly defined _H variable Fixed: Some floating furniture Optimized: Reduced sleep delays to 0.2 seconds, down from 1 second Optimized: Removed _blanket variable which selectRandom'd array (23DEC2017) v0.5 Added: New furniture layout for Land_i_House_Small_02_V1_F Added: New furniture layout for Land_i_Addon_02_V1_F Added: New setting to blacklist specific locations, in the CFG.sqf Added: New setting to blacklist specific building classnames, in the CFG.sqf Added: New unhide function which unhides furniture within 150m of player Added: Code now repositions/resizes some map specific locations (WIP) Tweaked: Increased furniture spawn chance setting to 75%, up from 50% Tweaked: Added more furniture to a couple houses which still felt too empty Tweaked: Slightly moved some furniture to be less intrusive in a couple houses Tweaked: Wooden table in Land_i_Stone_HouseBig_V1_F is now larger Tweaked: Replaced getPosATL with getPosASL in some instances Fixed: Blacklist markers system Fixed: Fireplaces wouldn't despawn upon trigger deactivation Fixed: Some triggers/markers which spawned in water didn't behave correctly Optimized: Furniture is hidden globally after spawning Optimized: Furniture is revealed to client when he is within 150m of furniture Optimized: Replaced some forEach commands with count Optimized: Renamed _tempH variable to _H, in spawn.sqf Optimized: Renamed _house variable to _B, in spawn.sqf Optimized: Renamed _house variable to _H, in furniture scripts Optimized: Code no longer pointlessly checks for location types Optimized: Removed useless _housePos variable from garage layout script Removed: Useless array of location types Removed: Redundant _townType check / variable (30NOV2017) v0.4 Added: New setting to adjust % chance for furniture to spawn per house Added: Electronics store furniture layout for one of the Altis shops Added: Script now supports all A3 location types Added: Script now supports all A2 location types Added: MissionEventHandler to delete furniture in ruined houses Changed: Rewrote location finder code: + Trigger/marker size scales with town size + Trigger/marker angle taken into account Changed: Trigger deactivation deletes objects attached to invisible helipads Changed: Color of debug markers to ColorCiv, from ColorWest Tweaked: Merged Arma 2 location types with Arma 3 location types Tweaked: Increased trigger's max elevation activation to 99m, up from 0m Tweaked: Disabled simulation of invisible helipads on houses, instead of deleted Tweaked: Reduced damage check of buildings to 0.6, down from 0.9 Optimized: Script initialization (Thanks to Metalman10) Optimized: All instances of the createVehicle[] command now use "can_collide" Optimized: Invisible helipads are created only on buildings with furniture Optimized: Trigger calls code for PF supported houses only Optimized: Trigger deactivation deletes a couple specific objects Optimized: Triggers are only created in locations with PF supported houses Optimized: Blacklist marker code Optimized: Replaced BIS_fnc_inTrigger, with inArea Optimized: Significantly reduced script delays Optimized: Naming of furniture trigger markers Optimized: HelipadEmpty is created on the house's position, instead of setPos Optimized: Replaced a couple forEach commands, with count Optimized: Removed some unneeded occurrences of the setDir command Fixed: Overlapping triggers could cause furniture to spawn more than once Fixed: Blacklisted markers system Fixed: All buildings in trigger would spawn an invisible helipad Fixed: Trigger deactivation should no longer delete loot Fixed: Locations with 0 PF supported houses in them no longer spawn a trigger Fixed: A specific house type did not have its functions initialized Fixed: Undefined variable reference for bucket object caused a script error Fixed: Undefined variable reference for radio object caused a script error Fixed: Undefined variable reference for table object caused a script error Fixed: Tanoa flag paths were defined incorrectly Fixed: Reduced sleep delays to help fix the delayed object rotation issues Fixed: Removed most sleep delays to help fix the delayed object rotation issues (22NOV2017) v0.3 Fixed: Objects in blacklisted markers are no longer deleted upon trigger deactivation Fixed: Incorrect classname reference caused an invisible sack Fixed: Incorrect classname reference caused an invisible flag Fixed: Incorrect classname reference caused an invisible plastic table (18NOV2017) v0.2 Fixed: Incorrect classname reference caused an invisible desk Optimized: Blacklist code is more efficient Optimized: If PF_Blacklist = [] or [""], the script will skip blacklist code (17NOV2017) v0.1 Initial release 24 2 Share this post Link to post Share on other sites
code34 248 Posted November 14, 2017 simple and nice idea Share this post Link to post Share on other sites
HazJ 1289 Posted November 14, 2017 Very nice! Good job! @phronk Share this post Link to post Share on other sites
johnnyboy 3793 Posted November 14, 2017 Goddamn Phronk, that's brilliant. Now we know your true calling: Interior Decorator. There's room for all people in the ArmaVerse. Questions: Is this a mod? Does it support color schemes? I want only pastels in my furniture selection. Is your algorithm considering the Feng Shui of furniture placement? All kidding aside, this is really cool and will be used in a mission I'm working on. Thanks for caring about ambience. Its important for immersion! One Suggestion: It would be cool if there is a way to blacklist a building using a marker or something. A mission editor may need to custom decorate a particular building tailored to the scenario's story line. 2 2 Share this post Link to post Share on other sites
HazJ 1289 Posted November 14, 2017 Quote One Suggestion: It would be cool if there is a way to blacklist a building using a marker or something. A mission editor may need to custom decorate a particular building tailored to the scenario's story line. Yup, that would be useful indeed. 1 Share this post Link to post Share on other sites
phronk 898 Posted November 14, 2017 I haven't added blacklisting yet, but it definitely is on my To Do List. It'll most likely be a system where you can blacklist a building(s) classname and/or blacklist all buildings within a marker. Haven't started on that yet, been just working on the layouts. It's really tedious and takes hours, mostly because I'm testing the AI pathing in each house to make sure they don't walk through the furniture too much or at all. Some of the current layouts will probably need to be redone, but I just want to get the rest of the houses done. Only about 8 or so buildings left and all residential buildings will be done for Altis, Malden, and Stratis. Additionally, most of these layouts will have small randomizatons: Rotation of chairs may be a little random, pillow covers, blankets, poster(s) on the wall(s), flag, etc. Oh yeah, I didn't mention this anywhere and I'll do a video on it, but there will also be a chance for a lightsource to spawn if a "Man" is found within 6 meters of the building. 3 1 Share this post Link to post Share on other sites
pierremgi 4853 Posted November 14, 2017 Is this simple object oriented? Do you spawn them when a player is close to a town, then despawn them or all the map stay filled with objects in deserted town ? or all the map is treated at start? (sorry didn't see the line) Share this post Link to post Share on other sites
HazJ 1289 Posted November 14, 2017 7 minutes ago, pierremgi said: Is this simple object oriented? Do you spawn them when a player is close to a town, then despawn them or all the map stay filled with objects in deserted town ? or all the map is treated at start? (sorry didn't see the line) Spawns furniture in random houses within town, when player enters it Do you mean using createSimpleObject or? Share this post Link to post Share on other sites
phronk 898 Posted November 14, 2017 Quoted myself responding to a commenter on YouTube, who asked about AI colliding with objects and if it's worth the optimization. Quote 95% of the furniture in the script is composed of simpleObjects for the best performance. They have no complex physics simulations and AI can practically see and walk through them. Right now, most of the furniture is placed along/against the walls, out of AI pathways. Whether these are simpleObjects or not, a lot of scripts/AI mods use the "doMove" command which will often cause the AI to disregard collision and ghost through objects anyway. I can always edit a layout to be less problematic, if major AI ghosting issues arise. It's bound to happen regardless how I build it, but as long as they don't walk through walls and hide inside of couches, I'm a happy guy. Share this post Link to post Share on other sites
EO 11275 Posted November 15, 2017 Hey phronk this all looks pretty neat dude.... 12 hours ago, phronk said: It's really tedious and takes hours, mostly because I'm testing the AI pathing in each house to make sure they don't walk through the furniture too much or at all. I feel your pain buddy, I've been working on a bunch of compositions for a similar upcoming feature for the Ravage mod. Regarding AI pathfinding, as long as there are no objects in and around doorways, AI are, for the most part, okay. I also made sure to leave full access to all windows, this is mostly to optimize gameplay. One thing haleks has mentioned, there are a bunch of objects that have an inventory, which may cause some issues in certain scenarios. Best of luck with your script mate! 1 Share this post Link to post Share on other sites
joostsidy 685 Posted November 15, 2017 6 minutes ago, Evil Organ said: Regarding AI pathfinding, as long as there are no objects in and around doorways, AI are, for the most part, okay. It depends.. putting objects in some other positions may lead to soldiers standing on chairs, beds etc. not mission breaking, but looks weird. If I go into a house then leave town and return again, will there be other posters hanging on the wall or different chairs in the house? You would have to build a kind of house memory for this to remember the specific randomization for that house. Maybe a bit too much.. 2 Share this post Link to post Share on other sites
phronk 898 Posted November 15, 2017 There's actually more to it than entering and exiting rooms; because the furniture is comprised mostly of simpleObjects, AI are more likely to walk through them, whereas if it were a simulated object, they'd try to navigate around it. The reason why interior pathing is important to make sure they don't clip through shit is because if you're using an indoors patrol script, civilians wandering through houses, a guy spawned in a house tries to leave the building to chase you, or while you're shooting out of a window an AI comes into the building to find you, the AI is likely to walk through stuff if I place the objects in their pathways. Sometimes their pathways make no god damn sense and they will avoid certain parts of the house, which tells me where I should place stuff. If they won't walk there, it's safe for me to put an object there. In this process, I'm realizing how bugged the AI pathing is indoors. I'm no expert on that sort of stuff, but the AI will outright walk through walls to exit specific building classnames or become totally confused as to how to move to his next waypoint. It's mind boggling and frustrating as hell. With that said, the script is coming along well and should be ready for a release maaaaybe this weekend. Tanoa / CUP compatibility will not be included by then. 2 Share this post Link to post Share on other sites
pierremgi 4853 Posted November 15, 2017 @phronk Your script is fine anyway! You are not supposed to correct all Arma weaknesses. 1 Share this post Link to post Share on other sites
Muzzleflash 111 Posted November 15, 2017 7 hours ago, joostsidy said: You would have to build a kind of house memory for this to remember the specific randomization for that house. Maybe a bit too much. I recently wrote a hash function as a proof of concept for how to apply the same random global state changes using only local efficient commands. For example: using the same "key" -- an input value to the hash function -- I could apply damage to some the buildings on map without having to transmit over the network. This could be one way to handle randomization, and ensure it is always the same, without storing a lot of data or doing a lot of synchronizing (only the key - basically a number - would be synchronized to clients). 2 Share this post Link to post Share on other sites
phronk 898 Posted November 15, 2017 @joostsidy Didn't see your post when I posted; the furniture layouts are unique to each building model (All reskins of that building will get the same layout) and so they are predetermined. Some buildings already have a couple other possible layouts they can get, but on top of that, just about all layouts have some extra randomization in the objects placed: posters on walls will look different, rotation of chairs may be different, a small dim lightsource may spawn at night (if a man is nearby), blanket color, pillow case cover, etc. It definitely is too much. I've spent way more time on these layouts than I should, but in the long-run I just want to build the layouts to look good and function well with AI/players. If other people don't like the setup, oh well. I made this for myself and the guys I play with to enhance our immersion in my missions, but figured maybe people can learn how easy it is to do this sort of thing and make spin-off scripts or whatever. I'm sure other people can think of better ways to do it than I do anyway. @Muzzleflash So far, this is being handled through server-side scripts on a server-side trigger. When the server detects more than one player inside of the trigger, the code runs. Upon deactivation, it cleans up (for now) allSimpleObjects, all !simulated objects, #lightpoints, and a couple other specific objects within the radius of the trigger. The better way to go about it would be to add all spawned objects into an array, unique to that trigger, and delete all elements upon deactivation. It'll work like that later on™. Share this post Link to post Share on other sites
joostsidy 685 Posted November 15, 2017 13 minutes ago, phronk said: @joostsidy Didn't see your post when I posted; the furniture layouts are unique to each building model (All reskins of that building will get the same layout) and so they are predetermined. Some buildings already have a couple other possible layouts they can get, but on top of that, just about all layouts have some extra randomization in the objects placed: posters on walls will look different, rotation of chairs may be different, a small dim lightsource may spawn at night (if a man is nearby), blanket color, pillow case cover, etc. That sounds like a good solution. I have much respect for your endeavour, I made a similar script for only three or four building types that I used a lot, and already I was fed up :-) I like Muzzleflash's suggestion of a hash key for 'fixed randomization'. It's not necessary but would be a cool proof-of-concept! Maybe someone would pick up this challenge in the future. I would not take CQB aspects to much into account. Like you say, indoor movement is bugged. I consider CQB (almost) non-existing for Arma 3. And I don't mind. It's not (yet) that kind of game. I put enemies in buildingpos at the start of the game. Sometimes I let them run out of the building for fleeing, but that's about it. You can't do some kind of SWAT assault on a building with AI. 2 Share this post Link to post Share on other sites
Nichols 243 Posted November 15, 2017 @phronk Will this work on any map or just Altis and Stratis for the time being? Share this post Link to post Share on other sites
johnnyboy 3793 Posted November 15, 2017 1 hour ago, Nichols said: Will this work on any map or just Altis and Stratis for the time being? As the man said: "Only about 8 or so buildings left and all residential buildings will be done for Altis, Malden, and Stratis...maybe this weekend" "Tanoa / CUP compatibility will not be included by then." @phronk: You might want to list the maps supported in your original post. 2 Share this post Link to post Share on other sites
EO 11275 Posted November 15, 2017 The way I read it, the script works on buildings, not maps per se, so any community made maps that use vanilla A3 buildings will spawn the furniture compositions. Compatible with all maps which use buildings from Altis, Malden, Stratis, or Tanoa 2 Share this post Link to post Share on other sites
phronk 898 Posted November 17, 2017 Correct, the script which spawns the furniture looks for Altis, Malden, and Stratis buildings within towns. As the script develops further over time, I plan to also support CUP and Tanoa buildings. I'll be honest, I'm pretty burnt out on building furniture layouts for now, so I'm just gonna finish up the script, release it, and see if people like it or not. It's a decent proof-of-concept, at least. I initially wanted to write a system which "procedurally" generated "random" furniture in the houses; I'd designate certain points of the house to spawn a bed, a chair, a table, whatever. The problem is, the center position of buildings seems inconsistent -- this also goes for objects you're attaching to the center position of the house (We're actually attaching them to an invisible helipad on the house's position). Maybe I'm wrong. It could've been the fact that a lot of the houses are different shapes and sizes, but I couldn't figure out a way to write a script which worked universally across all buildings that spawned randomized furniture, without them colliding through the house, spawning under/over the floor, colliding with other objects, etc. Anyway, a release will be made some time this weekend. I wrote a quick blacklist setting as requested: Create area markers and add them to a blacklist array in the CFG file. This will blocks the script from spawning furniture in buildings within that marker. Right now, it works best with Ellipse markers, rather than Rectangles. 1 Share this post Link to post Share on other sites
Tankbuster 1746 Posted November 17, 2017 This looks great , defo going to use it. My mission already has the town limits defined, would I be saving anything by adapting your script to use my data rather than finding the towns itself? Ps. Really looking forward to Tanoa support Share this post Link to post Share on other sites
phronk 898 Posted November 17, 2017 My current way of finding locations isn't perfect; the radius of every town trigger is 250x250. I need to rewrite it to take the dimensions into consideration and scale the triggers that way. With that said, sure, I suppose if you already have code that does that, you could rewrite parts of the script to make it better. Share this post Link to post Share on other sites
Tankbuster 1746 Posted November 17, 2017 Cool. Next (unfair) question.. ETA on Tanoa houses? :) Share this post Link to post Share on other sites
Tankbuster 1746 Posted November 17, 2017 1 hour ago, phronk said: I initially wanted to write a system which "procedurally" generated "random" furniture in the houses; I'd designate certain points of the house to spawn a bed, a chair, a table, whatever. The problem is, the center position of buildings seems inconsistent -- this also goes for objects you're attaching to the center position of the house (We're actually attaching them to an invisible helipad on the house's position). Maybe I'm wrong. It could've been the fact that a lot of the houses are different shapes and sizes, but I couldn't figure out a way to write a script which worked universally across all buildings that spawned randomized furniture, without them colliding through the house, spawning under/over the floor, colliding with other objects, etc. It's extremely hard to do it procedurally for the reasons you've found. A procedural method works fast, you don't have to hand-code positions within the building and it, theoretically, can cope with new building objects without much tweaking, but in reality, it never looks as good as handcoding the positions. Suggestion. If you are happy to show your method, and perhaps release the tools you use (I assume it's modeltoWorld or fnc_objectsgrabber/mapper) then I'm sure the community would help with the position/object data for Tanoa buildings. From what I've seen your furniture arrangements have a particular style that is yours. Having the stylistic variation that would come from using other contributors might add some varation. Last thing, is this script able to support wall posters/paintings? 1 Share this post Link to post Share on other sites