Jump to content
phronk

[Released] Phronk's Furniture Script

Recommended Posts

I agree with @Tankbuster but if you really want to use attachTo command, I recommend detaching the objects once they are in place.

  • Like 1

Share this post


Link to post
Share on other sites
3 minutes ago, Tankbuster said:

Good call. Do they stay put when you do that?

I believe so. I don't think you can even knock them over, as they are created with createSimpleObject command.

Share this post


Link to post
Share on other sites

Cool. I know that attached objects have no collision geometry when thet are attached.

If I'm honest, it shouldn't be too hard for phronk to convert this script to modeltoworld as it uses the same coordinate system that attachto does.

  • Like 1

Share this post


Link to post
Share on other sites

Yeah, I'll do some tests to make sure the conversion is faster (performance) and functions the same.  Also, I don't detach the objects because they stay attached in space when the object they're attachedTo (Land_HelipadEmpty_F) is deleted.  Haven't noticed any issues for not detaching.

Share this post


Link to post
Share on other sites

@phronk - When you destroy a building, the furniture stays as it was. Would it be possible for you to add a option to delete furniture for destroyed buildings and remove from array so it doesn't get re-added again on activation?

Share this post


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

It's a mission eh, so hopefully it's cheap on the cpu

Yes, you can use to make the furniture disappear (deleted or hidden) but no way to have something interesting in other ways.

For example, detach is a waste of code in any case.

Even with a modelToWorld placed, not attached objects, this kind of problem still persists.

Share this post


Link to post
Share on other sites

I've been hesitant about adding a BuildingChanged missionEventHandler because I'm not sure how heavy that'd be on the mission.  I'm going to add it to at least experiment with its performance impact (If any) probably soon.  I also intend to try out @HazJ's method of "attaching" the objects, to see if that's more optimal for this sorta thing.  Also, it has been exactly 5 years since I first played the Arma series!  What better time to release an update?!

 

 

DOWNLOAD LINK - (Google Drive)

DOWNLOAD LINK - (Steam Workshop)

DOWNLOAD LINK - (Armaholic)

Version: 0.3

Size: 112 KB

  • 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

  • Like 3

Share this post


Link to post
Share on other sites
27 minutes ago, phronk said:

Also, it has been exactly 5 years since I first played the Arma series! 

5 years?   Rookie.   :unclesam:

  • Like 1
  • Thanks 1
  • Haha 1

Share this post


Link to post
Share on other sites

I used to play OFP back in the day! Only the campaigns though... Victor Troska, do you know anything about this? I'm sorry i don't. :tounge_o::smileee:

  • Like 1

Share this post


Link to post
Share on other sites

@phronk - I've noticed the building may not spawn again with furniture in again after leaving and coming back in the town. Not a big deal though. Would be nice to have an option to load the same again or have option to set variable on a specific building. I think someone suggested this already in the thread.

Share this post


Link to post
Share on other sites

@HazJ Just tested it and the town repopulates houses with furniture when returning to the town/trigger.  I think what you meant is that the script doesn't cache which house has furniture and what layout it's using; I really don't want to store variables for all buildings.  That'd make this heavier than it needs to be, it's just for cosmetics, really.  If you want, you can disable the randomization so all houses have furniture by replacing the PF.sqf with this:

 

Spoiler

if(!isServer)exitWith{};

private _WS=worldSize;
PF_WN=worldName;
private _towns=nearestLocations[[0,0,0],["NameCity","NameCityCapital","NameLocal","NameVillage"],_WS];
if(!(PF_WN=="Altis" || PF_WN=="Malden" || PF_WN=="Stratis" || PF_WN=="Tanoa"))then{
private _towns=nearestLocations[[0,0,0],["FlatAreaCity","FlatAreaCitySmall","NameCity","NameCityCapital","NameLocal","NameVillage"],_WS];};
sleep 2;
{private _pos=locationPosition _x;
private _townX=250;
private _townY=250;

private _m=createMarker[format["m--%1",random 100000],_pos];
_m setMarkerShape"RECTANGLE";
_m setMarkerBrush"SolidBorder";
_m setMarkerSize[_townX,_townY];
_m setMarkerAlpha 0.4;if(!PF_Dbug)then{_m setMarkerAlpha 0;};
_m setMarkerColor"ColorWest";

_check=nearestObjects[getMarkerPos _m,["House_F"],250];
if(count _check<1)then{deleteMarker _m;};

private _t=createTrigger["EmptyDetector",getMarkerPos _m,false];
_t setTriggerArea[_townX,_townY,0,true];
_t setTriggerTimeout[2,2,2,true];
_t setTriggerActivation["ANYPLAYER","PRESENT",TRUE];

sleep .02;

_t setTriggerStatements[
"{isPlayer _x}count thisList>0",//TRIGGER CONDITION

//TRIGGER ACTIVATION
"private _tPos=getPos thisTrigger;
if(PF_Dbug)then{systemChat""Trigger Activated"";};
private _nearH=nearestObjects[_tPos,[""House_F""],250];
if(PF_Dbug)then{systemChat format[""%1 houses found"",count _nearH];};
if(count _nearH==0)exitWith{};
{
	if((isObjectHidden _x)||(damage _x>0.9))exitWith{};
	if(!(PF_Blacklist isEqualTo[])||{(PF_Blacklist isEqualTo[""""])})then{
	_house=_x;
	_isBL=false;
	{_isBL=[_x,_house]call BIS_fnc_inTrigger;if(_isBL)exitWith{};}forEach PF_Blacklist;
	if(_isBL)exitWith{};};

	private _tempH=createVehicle[""Land_HelipadEmpty_F"",[0,0,0],[],0,""can_collide""];
	_tempH setDir(getDir _x);
	_tempH setPosATL(getPosATL _x);
	[_tempH,_x]call PF_spawn;
}forEach _nearH;",

//TRIGGER DEACTIVATION
"if(PF_Dbug)then{systemChat""Trigger Deactivated"";};
{_furn=_x;
_isBL2=false;
{_isBL2=[_x,_furn]call BIS_fnc_inTrigger;}forEach PF_Blacklist;
if(_isBL2)then{}else{
if((!simulationEnabled _x)||(isSimpleObject _x)||
(typeOf _x isEqualTo""#lightpoint"")||(_x isKindOf""Fireplace_burning_F"")||( _x isKindOf""MetalBarrel_burning_F"")||(_x isKindOf""Land_HelipadEmpty_F""))then{deleteVehicle _x;};
};}forEach nearestObjects[thisTrigger,[],300,true];"];
}forEach _towns;

 

 

Share this post


Link to post
Share on other sites

Yeah, I meant that. That is why I said maybe an option for specific buildings that can be set by the mission maker.

Share this post


Link to post
Share on other sites

Hello,
Do you think it's possible to use your script in multiplayer?

Share this post


Link to post
Share on other sites

@phronk Hi Phronk, great work as always! I don’t know if it’s possible but have you thought about adding graffiti/posters to the outside of some buildings?

Share this post


Link to post
Share on other sites

@ricoarma Works in singleplayer, multiplayer client-hosted, and dedicated servers.

 

@Bosh__ Thank you; I have thought about adding graffiti to the abandoned buildings, but there's not really a lot of options.  I might add it in the future.

Share this post


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

@ricoarma Works in singleplayer, multiplayer client-hosted, and dedicated servers.

 

@Bosh__ Thank you; I have thought about adding graffiti to the abandoned buildings, but there's not really a lot of options.  I might add it in the future.

@phronk thanks a lot for your answer.
I still have two more questions:
1 *  How to disable the text that appears at the bottom of the screen that activates or deactivates the trigger?
2 * Why in the file CFG.sqf: when I change to False line 23, nothing happens?
 

PF_Dbug=TRUE;            // TRUE enables debug mode, FALSE disables it

thanks

Share this post


Link to post
Share on other sites
7 hours ago, ricoarma said:

@phronk thanks a lot for your answer.
I still have two more questions:
1 *  How to disable the text that appears at the bottom of the screen that activates or deactivates the trigger?
2 * Why in the file CFG.sqf: when I change to False line 23, nothing happens?
 


PF_Dbug=TRUE;            // TRUE enables debug mode, FALSE disables it

thanks

That's odd. Are you sure you saved it and restarted the mission? @phronk - This one doesn't check if PF_Dbug to be true:

systemChat""Not blacklisted..."";

Also, how come you use double quotes? Is it just to show them in the chat? Never mind! I just saw/realised why haha.

Share this post


Link to post
Share on other sites

I'm getting this error randomly. Imagine it's when it call h2b_1 file. Don't see it anywhere else. Saw this in .2 as well. 

 

15:20:26 Error in expression <180;
_table attachTo[_house,[7,.35,.8]];_pTable setDir 270;
_radio attachTo[_hou>
15:20:26   Error position: <_pTable setDir 270;
_radio attachTo[_hou>
15:20:26   Error Undefined variable in expression: _ptable
15:20:26 File C:\Users\Blackheart_Six\Documents\Arma 3\mpmissions\Insurgency.Altis\PF\A3\h2b_1.sqf, line 37

 

 

Share this post


Link to post
Share on other sites

Fixed.  I'll update the script when more changes are included.

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

×