Beowulfv

Build Height Limit Plus

7 posts in this topic

I'm working on adding more checks for the build height limit addon. I am trying to add in an array that defines which height limit to use so if a player wants to build on the water or ship object they can. I've been trying a few different ways right now and it'll either skip over one of the statements (I'm assuming it's not pulling distance) or it'll break building all together. This should be something simple but I'm stuck. Code example below:

if (_AllowedShips distance (getPosASL player) > 150) then
    {
		if ((getPosATL ExileClientConstructionObject) select 2 > _MaxBuildHeight) then {
			ExileClientConstructionModePhysx = true;
			ExileClientConstructionResult = 2;
			["ErrorTitleAndText", [_MaxBuildHeightErrMsgTiltle, _MaxBuildHeightErrMsgContent]] call ExileClient_gui_toaster_addTemplateToast;
		}
	}else{
		if ((getPosATL ExileClientConstructionObject) select 2 > _SeaLevel) then {
			ExileClientConstructionModePhysx = true;
			ExileClientConstructionResult = 2;
			["ErrorTitleAndText", [_MaxBuildHeightErrMsgTiltle, _MaxBuildHeightErrMsgContent]] call ExileClient_gui_toaster_addTemplateToast;
		}
	};

If you know something I don't, please let me know. The objects in the array currently are:
"Land_Carrier_01_base_F",
"Land_Destroyer_01_base_F" 

Edited by Beowulfv

Share this post


Link to post
Share on other sites

Hello @Beowulfv,

There are several considerations to be made:

#1 - What if this ship is right next to land or a dock, then what?  So 5m East and they can build 200m high and 5m West they can only build 100m high?

#2 - What if they build at a different location than on deck which most likely be a different height?  Same example as #1.

What I would do and where you put it, can be many places.  You need to do what we scripters from OFP -> ARMA 3 Beta did, when we wished to place something on the deck of a ship, we added the height of the ship to the item to be placed.  As we do not have to do this anymore, I can not remember if it was method A or method B:

A - Add depth where ship was + height of ship + .1 (or .01) = Added to unit to be placed

B - height of ship + .1 (or .01) = Added to unit to be placed

In the 'old' days, we did not have a 3D editor to place things, so we would have to resort to such methods.  And this is what YOU must do too.

 

So, for example, your check would be SOMETHING like this:

1 - Get height of deck FROM THE SHIP (Ex. 50m, DH (Deck Height Vari))

2 - Get max building height (Ex. 100m, MX (Max Height Vari))

3 - When building check is made:

If object being built on = ground then error if currentheight > MX

Else

error if (currentheight + DH) > MX

 

You just have to add the deck height to your check when you perform ship/land base check which should be a simple task to add in.

 

This should help in this matter.

 

:)

 

 

Edited by Z80CPU

Share this post


Link to post
Share on other sites
Advertisement
1 hour ago, Z80CPU said:

Hello @Beowulfv,

There are several considerations to be made:

#1 - What if this ship is right next to land or a dock, then what?  So 5m East and they can build 200m high and 5m West they can only build 100m high?

#2 - What if they build at a different location than on deck which most likely be a different height?  Same example as #1.

What I would do and where you put it, can be many places.  You need to do what we scripters from OFP -> ARMA 3 Beta did, when we wished to place something on the deck of a ship, we added the height of the ship to the item to be placed.  As we do not have to do this anymore, I can not remember if it was method A or method B:

A - Add depth where ship was + height of ship + .1 (or .01) = Added to unit to be placed

B - height of ship + .1 (or .01) = Added to unit to be placed

In the 'old' days, we did not have a 3D editor to place things, so we would have to resort to such methods.  And this is what YOU must do too.

 

So, for example, your check would be SOMETHING like this:

1 - Get height of deck FROM THE SHIP (Ex. 50m, DH (Deck Height Vari))

2 - Get max building height (Ex. 100m, MX (Max Height Vari))

3 - When building check is made:

If object being built on = ground then error if currentheight > MX

Else

error if (currentheight + DH) > MX

 

You just have to add the deck height to your check when you perform ship/land base check which should be a simple task to add in.

 

This should help in this matter.

 

:)

 

 

None of this helps as I am only searching for the object in a 150 meter radius and then in the next statement I declare how high a player can build according to the level of water below them which was set to 50 meters since I was taking in account of the ships elevation from the water with is 24 meters. But it's fine, I found another way of doing this since the USS freedom doesn't return a Object classname but fragments of p3d like trees do. Either way, you can easily setup a large range to test for and still restrict players to smaller height limits in the last step.

Share this post


Link to post
Share on other sites
On 1/6/2019 at 10:33 AM, Beowulfv said:

I'm working on adding more checks for the build height limit addon. I am trying to add in an array that defines which height limit to use so if a player wants to build on the water or ship object they can. I've been trying a few different ways right now and it'll either skip over one of the statements (I'm assuming it's not pulling distance) or it'll break building all together. This should be something simple but I'm stuck. Code example below:


if (_AllowedShips distance (getPosASL player) > 150) then
    {
		if ((getPosATL ExileClientConstructionObject) select 2 > _MaxBuildHeight) then {
			ExileClientConstructionModePhysx = true;
			ExileClientConstructionResult = 2;
			["ErrorTitleAndText", [_MaxBuildHeightErrMsgTiltle, _MaxBuildHeightErrMsgContent]] call ExileClient_gui_toaster_addTemplateToast;
		}
	}else{
		if ((getPosATL ExileClientConstructionObject) select 2 > _SeaLevel) then {
			ExileClientConstructionModePhysx = true;
			ExileClientConstructionResult = 2;
			["ErrorTitleAndText", [_MaxBuildHeightErrMsgTiltle, _MaxBuildHeightErrMsgContent]] call ExileClient_gui_toaster_addTemplateToast;
		}
	};

If you know something I don't, please let me know. The objects in the array currently are:
"Land_Carrier_01_base_F",
"Land_Destroyer_01_base_F"  

Edited Sunday at 10:34 AM by Beowulfv

 

"...then in the next statement I declare how high a player can build according to the level of water below them which was set to 50 meters since I was taking in account of the ships elevation from the water with is 24 meters..."

WHERE IS THIS IN YOUR ORIGINAL POST?????  The ONLY numbers I see are '150' and '2'!

 

How would anyone KNOW you took in account the height?  You never said suchNor was it in your post.  I never saw '50' in your post or code snippet.  We are not mind readers.

 

You asked for help, and out of kindness, thinking of you, I expended my time and effort to help you.  You could have said, at a minimum 'Thank you', even if you could not use the information.

Being rude and disrespectful is so unbecoming on anyone including you.  And it seems you practice this habit of being rude and hateful quite often as well.

Remember:  It takes no effort to be hateful.

 

Here is some tips you really should put into use instead of playing games:  How To Have Good Manners

For it is apparent that either your parents failed you or you're a rude and hateful person, either way, the 'rule' is, you say 'THANK YOU' to those that either OFFERED HELP or actually PROVIDED HELP.  You are supposed to ALWAYS SAY THANK YOU.  And at this simple task of common courtesy, you have failed.

Since you have demonstrated via your actions that you lack this basic common courtesy, I shall provide this tip too:  WHEN TO SAY THANK YOU

 

And by the way, do not even waste your time responding, I am done with you.  Your hatefulness and rudeness is something I can bear no more.  Get your help from someone else from now on.  I care not to help nor respond to ungrateful and rude people, whoever they may be.  I care not to read their 'excuses' and 'lame comments' to my post.

 

And regardless if my 'help' was 'acceptable' to you or not, AT LEAST I TRIED AND WAS POLITE ABOUT IT.  That is way more than anyone can say of you!  ;)

Write what you may, just as your last response to me in another post, I never read it, just as I shall do with this one.  You simply are not worth the effort.

 

Good Day

:)

 

Share this post


Link to post
Share on other sites
57 minutes ago, Z80CPU said:

WHERE IS THIS IN YOUR ORIGINAL POST?????  The ONLY numbers I see are '150' and '2'!

if ((getPosATL ExileClientConstructionObject) select 2 > _MaxBuildHeight) then
if ((getPosATL ExileClientConstructionObject) select 2 > _SeaLevel) then

The first statement is a check for distance from an array of objects to the player:

if (_AllowedShips distance (getPosASL player) > 150) then

It reads, if (array of objects distance to player) is greater than 150 then execute first build height limit restriction else use secondary build height restriction. The original post states that I was having issues with the script reading the array and checking the distance between the two. The process would get hung up and the 3D model for building would freeze in midair. I would later realize that the ships, although show up in the mission.sqm with a classname, do not register as such when in the playable world. They instead return the same as trees do. I then tested a check for nearestObject but it still did not function as needed. So scrapping distance all together I created a check for player elevation from ground to water to use as my script to declare which build height to use. _MaxBuildHeight and _SeaLevel are shown as place holders for heights that are in a config file so that if I choose to share, users will simply need to edit one file instead of sifting thru hundreds of lines of code. You tend to see this practice a lot when working with code.

Share this post


Link to post
Share on other sites
35 minutes ago, [x] cit said:

Hi, what news about building on ships?
 

The code provided in the post is the answer. I edited the ExileClient_construction_thread SQF file near line 268 (Not the exact line as I have made many changes to this file). I altered the original script mod Max Build Height to add in a check for ASL which is the players relative location to the surface of water. If you have flag spawning enabled on your server and the players spawn on the ground, then it will spawn them on the bottom of the sea floor. To combat that I altered xsSpawn by xstreme so that if a player selects a flag on over water they will only have the option to Halo.

The code for building over water is:

	if ((getPosATL player) select 2 > 100) then
    {
		if ((getPosASL ExileClientConstructionObject) select 2 > _SeaLevel) then {
			ExileClientConstructionModePhysx = true;
			ExileClientConstructionResult = 2;
			["ErrorTitleAndText", [_MaxBuildHeightErrMsgTiltle, _MaxBuildHeightErrMsgContent]] call ExileClient_gui_toaster_addTemplateToast;
		};
	}else{
		if ((getPosATL ExileClientConstructionObject) select 2 > _MaxBuildHeight) then {
			ExileClientConstructionModePhysx = true;
			ExileClientConstructionResult = 2;
			["ErrorTitleAndText", [_MaxBuildHeightErrMsgTiltle, _MaxBuildHeightErrMsgContent]] call ExileClient_gui_toaster_addTemplateToast;
		};
	};

_SeaLevel, _MaxBuildHeight, _MaxBuildHeightErrMsgTiltle, and _MaxBuildHeightErrMsgContent are all place holders for text and number values. So for example it could read:

		if ((getPosASL ExileClientConstructionObject) select 2 > 50) then {
			ExileClientConstructionModePhysx = true;
			ExileClientConstructionResult = 2;
			["ErrorTitleAndText", ["Construction Aborted", "You cannot build above 30 meters!"]] call ExileClient_gui_toaster_addTemplateToast;
		};

 

  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.