Jump to content
  • 0

Preventing sky bases


MGT

Question

Hey, not sure if my syntax is correct but im trying to prevent the building of sky bases, by adding this line into player_build.sqf (with correct syntax) work?

if (getPosATL _x select 2 > 45.0) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_41"), "PLAIN DOWN"];};
Link to comment
Share on other sites

Recommended Posts

  • 0

I am not sure if you are referring to an actual object unless this is the only code line you've added. If modifying original player_build, then you might want to add this check to an attached object, not the one you publish:

_heightCheck = (_object getPosATL select 2);
if (_heightCheck > 45) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_41"), "PLAIN DOWN"];};

edit: or at least refer to a player himself if check against attached object doesn't work.

Link to comment
Share on other sites

  • 0

What's a Sky Base look like?

A base floating in the sky? lol. I've done it out of boredom sorta, but it was actually a treehouse. Thing is people can keep building as high as they want so, if they have too much time on their hands, it can be 500 feet in the air, only accessible by heli.

Link to comment
Share on other sites

  • 0

I am not sure if you are referring to an actual object unless this is the only code line you've added. If modifying original player_build, then you might want to add this check to an attached object, not the one you publish:

_heightCheck = (_object getPosATL select 2);

if (_heightCheck > 45) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_41"), "PLAIN DOWN"];};

edit: or at least refer to a player himself if check against attached object doesn't work.

 

Yes, the object check didn't work, testing your edit now

 

Just trying to prevent building above a certain height, we have a few sky bases appearing at over 200m in the sky! The thing is, they've not been built up and then had the bits removed, they've been built from scratch in the sky somehow, no one's telling me how though ;)

Link to comment
Share on other sites

  • 0

Yes, the object check didn't work, testing your edit now

 

Just trying to prevent building above a certain height, we have a few sky bases appearing at over 200m in the sky! The thing is, they've not been built up and then had the bits removed, they've been built from scratch in the sky somehow, no one's telling me how though ;)

My guess would be they just build a floor/ceiling and keep raising the height of it then land on it and continue building the rest. After testing I can just Alt+PageUp an item endlessly. Not sure if there is a script somewhere that defines controls for raising/lowering, if there is perhaps you could add a count to add/subtract each time it's raised/lowered, causing it to cancel out of building if above 5 or below -5.

Link to comment
Share on other sites

  • 0

So another way to prevent it would be to have the build timer or remove the alt+pageup so big moves are impossible.

If I can this way to work it should still prevent it as they wont be able to land on the high platform and continue building.

 

Edit, Raymix, your edit breaks building, even with _heightcheck added in to the array

 

You said "select 2", are the coord positions in the array for x,y,z - 0,1,2?

Link to comment
Share on other sites

  • 0

This should work. (The _vehicle code is there so you know the location)

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
if (((getPosATL _vehicle) select 2) > 45) exitWith {DZE_ActionInProgress = false; cutText ["Your fear of heights prevents you from building!","PLAIN DOWN"];};
Link to comment
Share on other sites

  • 0

My guess would be they just build a floor/ceiling and keep raising the height of it then land on it and continue building the rest. After testing I can just Alt+PageUp an item endlessly. Not sure if there is a script somewhere that defines controls for raising/lowering, if there is perhaps you could add a count to add/subtract each time it's raised/lowered, causing it to cancel out of building if above 5 or below -5.

 

This code in player_build should prevent endlessly alt-pageup'ing?  It's in stock Epoch.

 

        if(abs(_objHDiff) > 5) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = "Cannot move up or down more than 5 meters";
            detach _object;
            deleteVehicle _object;
        };

 

I can't verify it myself, as I'm using snapbuilding which modifies that code.

Link to comment
Share on other sites

  • 0

This code in player_build should prevent endlessly alt-pageup'ing?  It's in stock Epoch.

        if(abs(_objHDiff) > 5) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = "Cannot move up or down more than 5 meters";
            detach _object;
            deleteVehicle _object;
        };

I can't verify it myself, as I'm using snapbuilding which modifies that code.

Yah I see that. Pretty sure that's based on character position though, not object. So if your character moves up or down 5 meters it cancels. Like when you move side to side or forward and back more then 5 meters. Overall it just cancels out building based on player movement.

 

Edit: Think I'm wrong on what I just said.

Link to comment
Share on other sites

  • 0

This code in player_build should prevent endlessly alt-pageup'ing?  It's in stock Epoch.

        if(abs(_objHDiff) > 5) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = "Cannot move up or down more than 5 meters";
            detach _object;
            deleteVehicle _object;
        };

I can't verify it myself, as I'm using snapbuilding which modifies that code.

 

They must be building it somehow in the sky then! Some bases have gone up in a matter of hours so are definitely not using the build/remove method - Also, they're established players, not dupers or hackers.

Link to comment
Share on other sites

  • 0

They must be building it somehow in the sky then! Some bases have gone up in a matter of hours so are definitely not using the build/remove method - Also, they're established players, not dupers or hackers.

Ok the problem with "if(abs(_objHDiff) > 5) exitWith {" is that it counts every raise as an increase of 0.1 whether you're using alt, ctrl or just pageup as normal. Basically something needs to be changed within...

        if(_zheightchanged) then {
            detach _object;

            _position = getPosATL _object;

            if(_zheightdirection == "up") then {
                _position set [2,((_position select 2)+0.1)];
                _objHDiff = _objHDiff + 0.1;
            };
            if(_zheightdirection == "down") then {
                _position set [2,((_position select 2)-0.1)];
                _objHDiff = _objHDiff - 0.1;
            };

            if(_zheightdirection == "up_alt") then {
                _position set [2,((_position select 2)+1)];
                _objHupDiff = _objHupDiff + 1;
            };
            if(_zheightdirection == "down_alt") then {
                _position set [2,((_position select 2)-1)];
                _objHDiff = _objHDiff - 1;
            };

            if(_zheightdirection == "up_ctrl") then {
                _position set [2,((_position select 2)+0.01)];
                _objHupDiff = _objHupDiff + 0.01;
            };
            if(_zheightdirection == "down_ctrl") then {
                _position set [2,((_position select 2)-0.01)];
                _objHDiff = _objHDiff - 0.01;
            };

            _object setDir (getDir _object);

            if((_isAllowedUnderGround == 0) and ((_position select 2) < 0)) then {
                _position set [2,0];
            };

            _object setPosATL _position;

            //diag_log format["DEBUG Change BUILDING POS: %1", _position];

            _object attachTo [player];

        };

to increase count more when using Alt+PageUp. It shows like it should be doing it more when Alt+Up but it doesn't seem to.

 

Edit: you guys think maybe this would work?

 

if(_zheightdirection == "up" && _zheightdirection == "alt")
Link to comment
Share on other sites

  • 0

 

This should work. (The _vehicle code is there so you know the location)

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
if (((getPosATL _vehicle) select 2) > 45) exitWith {DZE_ActionInProgress = false; cutText ["Your fear of heights prevents you from building!","PLAIN DOWN"];};

 

Bingo! This works, you can be on the ground and place a plot and alt+pageup the plot pole, then a metal floor, but as soon as  you take your heli and get up there,  you cant build any more and it exits with your message, i've posted the whole player_build.sqf on pastebin, would be nice if Awol etc could add a variable that can be called in the init to restrict height on building in 1.0.5

 

http://pastebin.com/6iv3H8xe

Link to comment
Share on other sites

  • 0

Yah I see that. Pretty sure that's based on character position though, not object. So if your character moves up or down 5 meters it cancels. Like when you move side to side or forward and back more then 5 meters. Overall it just cancels out building based on player movement.

 

Edit: Think I'm wrong on what I just said.

 

Yeah, location1/location2 is player location, objHDiff is on the object.

 

They must be building it somehow in the sky then! Some bases have gone up in a matter of hours so are definitely not using the build/remove method - Also, they're established players, not dupers or hackers.

 

It's not impossible to do it in a few hours, just a lot of work.  Two ways I can think of off the top of my head:

 

1)

When in the preview mode with a modular item, other players can walk on it.  So... if I wanted to be really ballsy, I could preview a floor, two of my buddies could climb on it, I could then raise it as far as it could go.  one of them could then preview another piece, the other could climb on it... with a big enough group, I could get substantial high without placing any pieces.  Place the last piece and you've got a floor 5 x (# of buddies) high.  Helicopter everyone up to that piece and start over.  It would suck if one of you lost connection or accidently hit your mouse button... and it's a massive PITA, though. 

 

2) It's a lot faster to just place a crap ton of (relatively cheap) wooden stairs and keep walking up them until you reach the desired height.  Place your initial floors and go back down, removing stairs as you go.  Fast skyhook.  I imagine construction death is a common occurence.

 

An overall limit in height should fix it, though.  Hopefully Vampire's last code works?

Link to comment
Share on other sites

  • 0

Yeah, location1/location2 is player location, objHDiff is on the object.

Yah, I'm pretty sure the issue lies in the next post I made which talks about the portion calculating the counts. I think the issue is the fact that it's spread into multiple if statements, and it's checking to see if the first one matches the requirements before the rest. It doesn't seem to care if a person is pressing Alt+Up, so long as just the Up requirement is met. Thinking perhaps it needs to be restructured to check Up and Down last out of all of them. I'm going to do a quick test on it and see. If it still presents an issue, I may need to add in a series of else's.

 

 

 

TheVampires method stops any building by a player above x metres

Saw that, but now the other thing is bugging me because it's broken, lol

Link to comment
Share on other sites

  • 0

You already have thse lines defined in the player_build.sqf, MGT, you just need ot place your code below it =)

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);

Also, wouldn't you need to loop it, or is a if boolean enough? Preferably that is.

Link to comment
Share on other sites

  • 0

Yah, I'm pretty sure the issue lies in the next post I made which talks about the portion calculating the counts. I think the issue is the fact that it's spread into multiple if statements, and it's checking to see if the first one matches the requirements before the rest. It doesn't seem to care if a person is pressing Alt+Up, so long as just the Up requirement is met. Thinking perhaps it needs to be restructured to check Up and Down last out of all of them. I'm going to do a quick test on it and see. If it still presents an issue, I may need to add in a series of else's.

 

 

 

Saw that, but now the other thing is bugging me because it's broken, lol

 

This thread's busy.  4 replies came in while I was typing my last post! :)

if(_zheightdirection == "up_alt") then {
                _position set [2,((_position select 2)+1)];
                _objHupDiff = _objHupDiff + 1;

This will trigger on alt-pageup.  The "up" will only trigger on a regular pageup.  So you can only alt-up a maximum of 5 times before it rejects it.

 

1)

When in the preview mode with a modular item, other players can walk on it.  So... if I wanted to be really ballsy, I could preview a floor, two of my buddies could climb on it, I could then raise it as far as it could go.  one of them could then preview another piece, the other could climb on it... with a big enough group, I could get substantial high without placing any pieces.  Place the last piece and you've got a floor 5 x (# of buddies) high.  Helicopter everyone up to that piece and start over.  It would suck if one of you lost connection or accidently hit your mouse button... and it's a massive PITA, though. 

Actually, looking at the code, you may be able to do this with two people a lot easier than I wrote... first guy previews a floor, second guy previews another floor.  Each of you makes sure your floor is below your buddy, then one of you raises his.  I believe if YOUR position raises, the floor you are previewing will move up the same amount.  But not entirely sure on that without testing it, pretty much depends on how the attachto code works, which I don't know much about.

 

But Vampire's code fixed this, so all good!

Link to comment
Share on other sites

  • 0

Note:For both fixes combined and ready to use, grab player_build.sqf from post below this one.

 

Ok, after several alterations to the script, I discovered what the issue was. Wish I saw it sooner, would have saved me time. Anyway...

 

For player_build.sqf

if(_zheightchanged) then {

The parts dealing with alt+up and ctrl+up had incorrect code.

_objHupDiff = _objHupDiff + 1;
and
_objHupDiff = _objHupDiff + 0.01;

Should be.

_objHDiff = _objHDiff + 1;
and
_objHDiff = _objHDiff + 0.01;

With that change, walls raised above 5 meters for Alt+PageUp and Ctrl+PageUp will cancel out correctly.

 

Now I'll quote the fix for cancelling out anything built over a certain elevation so anyone reading this thread late will see.

 

 

This should work. (The _vehicle code is there so you know the location)

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
if (((getPosATL _vehicle) select 2) > 45) exitWith {DZE_ActionInProgress = false; cutText ["Your fear of heights prevents you from building!","PLAIN DOWN"];};

 

Bingo! This works, you can be on the ground and place a plot and alt+pageup the plot pole, then a metal floor, but as soon as  you take your heli and get up there,  you cant build any more and it exits with your message, i've posted the whole player_build.sqf on pastebin, would be nice if Awol etc could add a variable that can be called in the init to restrict height on building in 1.0.5

 

http://pastebin.com/6iv3H8xe

 

Hope my fix helps some people. And that elevation check might come in handy so... thank you guys.

 

Edit:

 

This thread's busy.  4 replies came in while I was typing my last post! :)

Just saw your post now. Yah, I knew what was controlling it but it wasn't working properly, so I thought perhaps it could be something to do with the order. I'm still getting used to this scripting, used to working with C# in MonoDevelopment and it's got it's fair amount of differences. However, turns out it was a typo in the original scripting the whole time.

Link to comment
Share on other sites

  • 0

The parts dealing with alt+up and ctrl+up had incorrect code.

_objHupDiff = _objHupDiff + 1;
and
_objHupDiff = _objHupDiff + 0.01;

Should be.

_objHDiff = _objHDiff + 1;
and
_objHDiff = _objHDiff + 0.01;

 

Nice catch.  How many times did I look at that code today and not catch that?  It's even still there after adding snap building, so made the change on mine as well.  Thanks.

Link to comment
Share on other sites

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
  • Advertisement
  • Discord

×
×
  • Create New...