Jump to content
phronk

[Released] Phronk's Furniture Script

Recommended Posts

As @Tankbuster said, modelToWorld is OK. The best reference I found for the reliable "center" of an object/building whatever its direction/elevation is:

 

 _bbr = boundingBoxReal _yourObject;
 _p1 = _bbr select 0;
 _p2 = _bbr select 1;
 _pos = _yourObject modelToWorld (_p1 vectorAdd _p2 vectorMultiply 0.5);

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

I've been fiddling with modeltoworldworld because I am doing similar stuff, but over water. I found that setpos'ing the object in script was flakey because modeltoworldworld returns worldpos, so had to use setposworld instead. This may or may not be relevent here, just thought I'd mention it just in case.

Share this post


Link to post
Share on other sites

Just beat me to this - I've been working on a Eden/Zeus module-based implementation to use in making missions.

 

You could assign the building a variable to identify it as processed, which would fix your overlapping trigger issue.

 

Is there an easy way you check the pathways in the assets?

 

Feel free to edit or use any of the layouts I've made for the Altis buildings, hopefully we use the same coordinate layouts.

https://github.com/LISTINGS09/ZEI/blob/master/ZEI/functions/fn_interiorCiv.sqf

 

I'm currently working on the Apex buildings but it's slow going.

 

 

  • Like 3

Share this post


Link to post
Share on other sites

DOWNLOAD LINK - (Google Drive)

DOWNLOAD LINK - (Steam Workshop)

Version: 0.1

 

  • INITIAL RELEASE

_____________________________________________________


NOTE: The CFG.sqf included in the PF folder is the configuration file; there's currently only two settings you can change, debug mode (true/false) and an array of markers to blacklist from spawning furniture in.  The script doesn't feature up to 3 random layouts for any houses, but I just wanted to release this so I can work on other shit.  Enjoy.

  • Like 4

Share this post


Link to post
Share on other sites

You deserve a medal for the tedious grunt work dude.  Thanks much.

Share this post


Link to post
Share on other sites

@HazJ Thanks, didn't reference correct classname for the desk.  Fixed it now.  Will upload an update later.

  • Thanks 1

Share this post


Link to post
Share on other sites

Would be great if you made a detailed description of your process in making those "templates". We have a large community here and all of us can easily outbeat you in both originality and production speed in making a much much larger pack of those templates.

 

Making a some sort of a tool that allows you to simple export those templates from a 3den Editor made mission would be quite handy. For example if we simply had a VR map with the building in question set at 0,0,0 from the world of that map. Then you fill up that building with w/e you want using the 3den controls and easy to use interface. Export it and have your relative xyz to that source building??? would that work? who knows....

 

I would recommend you convert this into a MOD, scrips and mods are the same thing anyways, and it would allow consistent versions to be pushed w/o having to consistently redo mission templates. Would also make your mod some sort of a "Must have" across the whole community imo, fill the void in my Arma.

Share this post


Link to post
Share on other sites

It's a bit more complicated than just playing doll-house in the editor and "placing" furniture around the house.  Here's the process I go through to do it:

1. Go into Virtual Reality map
2. Place a house (Name the house "myHouse")
3. Place an invisible helipad (Name the helipad "house")
4. Put code into helipad init: house setPos(getPosATL myHouse)

Now for every single piece of furniture you want to put into that house, I execute an attachTo command in the editor's debug and mess with the offsets until it looks good enough in the house.  Not only that, but I have another AI unit in my group whom I give move orders to all the building positions in the building and see what paths he takes.  No tools involved.  Just boring tedious mundane work and patience.  Here's an example of attaching an object to the invisible helipad:

5. Place a piece of furniture, like a couch, and name it "sofa"
6. Local execute this code in the debug window, and tweak it 'til you have "placed" the furniture where you want it: sofa attachTo [ house, [ 0, 0, 1 ];

I mean hey, if you want to go ahead creating layouts, now you have an idea how to do it.

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, SGT M.Lafontaine said:

Would be great if you made a detailed description of your process in making those "templates". We have a large community here and all of us can easily outbeat you in both originality and production speed in making a much much larger pack of those templates.

 

Making a some sort of a tool that allows you to simple export those templates from a 3den Editor made mission would be quite handy. For example if we simply had a VR map with the building in question set at 0,0,0 from the world of that map. Then you fill up that building with w/e you want using the 3den controls and easy to use interface. Export it and have your relative xyz to that source building??? would that work? who knows....

 

I would recommend you convert this into a MOD, scrips and mods are the same thing anyways, and it would allow consistent versions to be pushed w/o having to consistently redo mission templates. Would also make your mod some sort of a "Must have" across the whole community imo, fill the void in my Arma.

+1 for us helping.

-1 for making it into a mod. Something like this doesn't need to be a mod.

Share this post


Link to post
Share on other sites

DOWNLOAD LINK - (Google Drive)

DOWNLOAD LINK - (Steam Workshop)

Version: 0.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

__________________________________

 

Additionally, I corrected some information and typos in the readMe.txt

  • Like 2

Share this post


Link to post
Share on other sites
8 hours ago, Tankbuster said:

-1 for making it into a mod. Something like this doesn't need to be a mod.

 

Ideally you can have both. Scripted version and modded version allowing communities who allready have a modpack to easily integrate it in all of their missions, and communities who run pub servers to easily add this has a feature.

 

My Milsim community runs 2 templates on 10+ different maps. They have to be consistently updated to keep up with changes in our framework, etc... I won't be updating 20+ mission files every time there is an update to this thing, especially that now hes in early developement phase and you can expect consistently occuring new itterations. Think about it. We aren't just talking about 1 mission here and there to play with 2-3 of your friends. Having it modded on the workshop allows me to integrate this in our modpack and forget about updates or anything else. The Dev can do w/e he wants and push has many updates he wants it wont affect my productivity.

Share this post


Link to post
Share on other sites

Hey! That's amazing actually!

Can I use it in my post-apo missions? It'd bring some really wonderful addiction!

Share this post


Link to post
Share on other sites

You have permission to use the script in your mission, as long as I'm given credit somewhere for you using the code.  Even if you modify the code, it's a generous courtesy for you (as the mission maker) to provide credit to the original script creator(s).

Share this post


Link to post
Share on other sites
12 hours ago, phronk said:

You have permission to use the script in your mission, as long as I'm given credit somewhere for you using the code.  Even if you modify the code, it's a generous courtesy for you (as the mission maker) to provide credit to the original script creator(s).

Of course you'll be credited

  • Thanks 1

Share this post


Link to post
Share on other sites

is there a way to exclude a town or area? For example an area where you yourself want to furnish the buildings with specific things?

Share this post


Link to post
Share on other sites

Place an ellipse marker covering that town, name it, and reference it in the PF_Blacklist array (in the CFG.sqf)

Share this post


Link to post
Share on other sites

 

On 11/19/2017 at 9:30 PM, phronk said:

Place an ellipse marker covering that town, name it, and reference it in the PF_Blacklist array (in the CFG.sqf)

cool. Thanks

Share this post


Link to post
Share on other sites

Using on my server....

 

Observation:

1. When there is only one player, all the furniture disappears when the player dies and re-spawns, then the script is triggered again when he spawns in, and the furniture reappears.

 

2. When the furniture spawns it has to orient it self to the house with correct azimuth.  There is a delay between the furniture spawning in, and the correcting for orientation, leaving furniture sticking out walls, and in the wrong position. 

 

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

1. This bug is now fixed.  I'll release an update in a couple days.

2. The delay is intended, but sometimes it takes longer for some of the furniture to rotate.  They should eventually rotate, at least when you're close enough.

Share this post


Link to post
Share on other sites

@phronk - How come you use attachTo command for the furniture inside the building? Code snippet from something I did ages back:

_group = createGroup civilian;

{
	_building = _x;
	_npc = _group createUnit ["C_man_1", [0, 0, 0], [], 0, "CAN_COLLIDE"];
	_npc setDir ((getDir (_building select 0)) + 185);
	_position = (_building select 0) modelToWorld [3, 5, 0];
	_npc setPos _position;
} forEach (nearestObjects [(getArray (configfile >> "CfgWorlds" >> "Altis" >> "centerPosition")), ["Land_CarService_F"], ("Altis" call BIS_fnc_mapSize)]);

I was just curious is all, was there a reason why you took this approach?

Share this post


Link to post
Share on other sites

@HazJ I just like using attachTo, I'm more "experienced" with it.  Haven't tried your method, yet.

@Tankbuster Unfortunately yes.  They won't spawn in hidden/destroyed buildings. Undestroyed buildings can spawn furniture in it and if that building is destroyed later, the furniture may still "float" until the town's furniture trigger is deactivated/despawns all furniture.  I might add a fix in the future, but it's not too big a deal at the moment.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×