Jump to content

[RELEASE] Build Snapping - Extended v1.6 (Updated 02/20/2014)


OtterNas3

Recommended Posts

In post #220 I had pasted my shot at adding HalfFloors to points.hpp.

 

Like I said, works well for the angles 0/180, but not for 90. Sadly noone has offered advice :-(

the post I made on previous page has metal floors snapping to cinderblock walls and such, they do spap at 90's, but its honestly alittle buggy, but better than nothing.

 

 

Feel free to poke through the points.hpp i modded and see if it helps for you!

Link to comment
Share on other sites

  • 2 weeks later...

Just debugging another script and I keep getting a couple of errors error coming up relating to the snapto release.  I have debugged them and worked out fixes that appear to be working now.

 

Error

 

player_buildControls.sqf -> line 85 -> _isAllowedUnderGround undefined.

 

Reason

 

_isAllowedUnderGround is not passed to the player_buildControls script and is not defined in the player_buildControls script.

 

Solution

 

  • Open custom\snap_build\player_build.sqf
  • find
_key_monitor = [] spawn player_buildControls ;
  • Change to 
_key_monitor = [_isAllowedUnderGround] spawn player_buildControls ;
  • save

 

  • Open custom\snap_build\player_buildControls.sqf
  • find 
private ["_zheightchanged", "_zheightdirection", "_rotate"];
diag_log "build controls";
  • Change to 
private ["_zheightchanged", "_zheightdirection", "_rotate", "_isAllowedUnderGround"];
diag_log "build controls";

_isAllowedUnderGround = _this select 0;
  • Save
 
What the change does
 
The _isAllowedUnderGround variable is defined and populated in the palyer_build.sqf script.  This then passes it to the player_buildControls.sqf script as a parameter.

 

Tested: Yes - Light testing.

Result: No issues with fix found.

 

---------------------------

 

Error 2

 

player_build.sqf -> line 288 -> s_building_snapping undefined.

 

Reason

 

This occurs when a non snapable item is placed.  Adding the snap mouse wheel menu item occurs only if the item being placed is snapable.  

 

Removing the menu item occurs at the end of the code even if the menu item was never added as the item being places was not snapable, hence the error message.  

 

Solution

 

  • Open custom\snap_build\player_build.sqf
  • Find 
player removeAction s_building_snapping;
  • Change to   
if (isClass (missionConfigFile >> "SnapPoints" >> _classname)) then {
player removeAction s_building_snapping;  // Only remove the snap menu item if the item is snapable.
};

 

What the change does
 
The added if statement uses the same check to see if the item being placed is snapable before trying to remove the snap option form the mouse wheel menu.

 

Tested: Yes - Light testing.

Result: No issues with fix found.

 

----------------------------------------------

 

 

RB

Link to comment
Share on other sites

Hello and thanks for the script. I installed this script and followed the directions given closely but still I have no luck. I am quite new at scripting and learning a lot as I go long but could you please help me. I currently have a couple of other MODS already installed which I got to work but this script does not work for me and I am wondering if it is because the other scripts I have installed. I have so far installed Epoch Admin Tools, DZAI, and I think I may have read something in another forum that I can no longer find that was saying something about Admin Tools not working with Snap Build, Is this true? I have done alot of research and can not find anything that answers my question. Thanks :)

Link to comment
Share on other sites

Well we got a problem we did everything as said in instructions aand our server is down now. giving out error

 

 

Hello and thanks for the script. I installed this script and followed the directions given closely but still I have no luck. I am quite new at scripting and learning a lot as I go long but could you please help me. I currently have a couple of other MODS already installed which I got to work but this script does not work for me and I am wondering if it is because the other scripts I have installed. I have so far installed Epoch Admin Tools, DZAI, and I think I may have read something in another forum that I can no longer find that was saying something about Admin Tools not working with Snap Build, Is this true? I have done alot of research and can not find anything that answers my question. Thanks :)

 

Please both post your RPT's to see if there are any errors :)

 

P,s, Admin tools works just fine with Snap Building!

Link to comment
Share on other sites

Please both post your RPT's to see if there are any errors :)

 

P,s, Admin tools works just fine with Snap Building!

Well theres nothing to post since all the files have been erased for some random reason but ye we got the server up by getting the files back from the server provider so no problem anymore :D and the snap building well we will get it work this time :D

Link to comment
Share on other sites

Hey Survivors,

 

i started this new Thread for the Mod so it's easier for players to find it and for me to support it!

This will also stop the confusion with the mod when you use Maca's or mine and have problems with it.

 

I got Maca's permission to do it and ALL credits for the idea and the first coding goes to Maca!

Thanks again Maca for this amazing idea/script!

 

Ok here we go...

 

This Mod adds a "Toggle Snapping" function to these Epoch Buildable objects:

  • MetalFloor_DZ
  • WoodFloor_DZ
  • CinderWall_DZ
  • CinderWallDoorway_DZ
  • CinderWallDoorLocked_DZ
  • CinderWallDoor_DZ
  • CinderWallSmallDoorway_DZ
  • CinderWallDoorSmallLocked_DZ
  • CinderWallHalf_DZ
  • CinderWallDoorSmall_DZ
  • WoodLargeWall_DZ
  • Land_DZE_LargeWoodDoor
  • WoodLargeWallWin_DZ
  • WoodLargeWallDoor_DZ
  • Land_DZE_GarageWoodDoor
  • Land_DZE_GarageWoodDoorLocked
  • Land_DZE_LargeWoodDoorLocked
  • WoodSmallWallThird_DZ
  • WoodSmallWallDoor_DZ
  • WoodSmallWall_DZ
  • WoodSmallWallWin_DZ
  • Land_DZE_WoodDoor
  • Land_DZE_WoodDoorLocked
  • Sandbag1_DZ
  • MetalPanel_DZ
  • Fence_corrugated_DZ
  • StickFence_DZ
  • Land_HBarrier1_DZ
  • Land_HBarrier3_DZ
  • Land_HBarrier5_DZ
  • Fort_RazorWire

Objects can be snapped to another object of the same type like:

Metal_Floor_DZ <-> Metal_Floor_DZ

Sandbag1_DZ <-> Sandbag1_DZ

 

or any Wall combination if its the same Material like:

WoodSmallWall_DZ <-> WoodSmallWall_DZ

WoodSmallWall_DZ <-> WoodSmallWallWin_DZ

CinderWallHalf_DZ <-> CinderWallHalf_DZ

CinderWallHalf_DZ <-> CinderWallDoorway_DZ

 

When you start building a new object you will get a "Toggle Snapping" option if the object is supported.

Hit it to activate the snapping.

 

Distance between the two objects has to be lower then 1.5m.

So move your object to almost same height and next to one side, near the top or near the bottom of the object you want to snap it to.

SNAP!

This allows you to build a Floor or a Wall on the same height in a perfect line.

 

It is also possible to make perfect 90° angles with it, for this you also have to bring the object almost in the desired angle to the other object and it will snap to it.

 

So What makes this version "Extended"?

 

Well...

  • Snapping will work on more then one  Floor
  • Snapping will work while building over Water
  • Snapping a object on Top/Bottom of eachother
  • Snapping with set rotation (for set Door open directions)
  • More objects supported
  • Code for finding snap points redone

 

Demo Video:

http://youtu.be/j5SXctN8WHA

 

Download (install instructions included):

https://www.dropbox.com/s/e1x7mcfuvy7mwyj/Snapping_v1.6.zip

 

Installation instructions:

 

1.

Download and extract Snapping_v1.5.zip

 

2.

unpbo MPMissions\YOURMISSIONNAME.pbo

 

3.

Copy custom folder from the extracted Snapping_v1.5 to MPMissions\YOURMISSIONNAME\

 

4.

If you dont have a custom compiles.sqf do step ( A )

If you already have a custom compiles.sqf do step ( B )

 

( A )

Open MPMissions\YOURMISSIONNAME\init.sqf

Find this line:

call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";

and add this line RIGHT BELOW it:

call compile preprocessFileLineNumbers "custom\snap_build\compiles.sqf";

so it will look like:

call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";
call compile preprocessFileLineNumbers "custom\snap_build\compiles.sqf";

( B )

Open your custom compiles.sqf

copy these lines to the VERY BOTTOM of your custom compiles.sqf

if (!isDedicated) then {
	player_build		= compile preprocessFileLineNumbers "custom\snap_build\player_build.sqf";
	player_buildControls	= compile preprocessFileLineNumbers "custom\snap_build\player_buildControls.sqf";
	snap_object		= compile preprocessFileLineNumbers "custom\snap_build\snap_object.sqf";
};

if you already have a player_build line in your custom compiles.sqf, it doesnt matter, IF you copied these line at the VERY BOTTOM, of your custom compiles.sqf!

 

5.

Open MPMissions\YOURMISSIONNAME\description.ext

Add this line again to the VERY BOTTOM of it! (Yeah this means AFTER the last closing bracket!)

It has to be the VERY LAST LINE of the File!

#include "custom\snap_build\points.hpp"

6.

repbo MPMissions\YOURMISSIONNAME\ - upaload - reload - snap - smile!

 

 

I hope i could clarify the !IMPORTANCE! that you copy the lines i mentioned to the VERY BOTTOM!

Else:

No Snap - No Smile - unneded questions

 

 

 

Have fun with it,

Otter

aka Bob der Baumeister

 

 

- If you like it - Like it - So I can count Downloads - I like that

Link Broken

Link to comment
Share on other sites

Nice to see someone is hosting the files now, however I have taken it a little further. I have created a Github repo for this content :D

 

This repo is permanent and will never go down unless something unthinkable happens to our beloved Github.

 

The code in this repo is not my own in ANY way. It all belongs to OtterNas and I will transfer ownership of the repo to OtterNas upon request. Github is simply a more stable host for code like this and you won't ever have to worry about a broken link for it. Please send me a private message on this forum to have ownership of the repo transferred to you OtterNas and great job on the tool man. If you don't know how to use Github I will give you a crash course in it so that it may help you in your coding endeavors.

 

I have also taken the liberty to rewrite his install guide so that it is a bit more organized and easy to follow. It is found in the README.md file in the repo.

 

Link to repo: https://github.com/noxsicarius/Build-Snapping

 

 

Edit: Made a small error where I didn't put the files into the custom folder directory, fixed it all up and tested out the readme. Everything is working fine so have at it. Let me know if you find anything that is not very clear in the readme.

Link to comment
Share on other sites

Nice to see someone is hosting the files now, however I have taken it a little further. I have created a Github repo for this content :D

 

This repo is permanent and will never go down unless something unthinkable happens to our beloved Github.

 

The code in this repo is not my own in ANY way. It all belongs to OtterNas and I will transfer ownership of the repo to OtterNas upon request. Github is simply a more stable host for code like this and you won't ever have to worry about a broken link for it. Please send me a private message on this forum to have ownership of the repo transferred to you OtterNas and great job on the tool man. If you don't know how to use Github I will give you a crash course in it so that it may help you in your coding endeavors.

 

I have also taken the liberty to rewrite his install guide so that it is a bit more organized and easy to follow. It is found in the README.md file in the repo.

 

Link to repo: https://github.com/noxsicarius/Build-Snapping

 

 

Edit: Made a small error where I didn't put the files into the custom folder directory, fixed it all up and tested out the readme. Everything is working fine so have at it. Let me know if you find anything that is not very clear in the readme.

Was just coming on to tell you about the missing folders as I downloaded this earlier and noticed but looks like you fixed it up :P

Since you wanted to make the instructions even more straight forward for people, I have a suggestion - one thing that might be confusing for newbies is the fact you state to first extract the mission PBO; however, if they have simply setup Epoch on their own server (rather than using a host) they will have the folder for the mission instead of a PBO file; it might be best to clarify for those people that in their case they will have the folder already instead of a PBO, just to save them from any possible confusion.

 

Thanks for uploading the files to GitHub, really appreciate it.

Link to comment
Share on other sites

Was just coming on to tell you about the missing folders as I downloaded this earlier and noticed but looks like you fixed it up :P

Since you wanted to make the instructions even more straight forward for people, I have a suggestion - one thing that might be confusing for newbies is the fact you state to first extract the mission PBO; however, if they have simply setup Epoch on their own server (rather than using a host) they will have the folder for the mission instead of a PBO file; it might be best to clarify for those people that in their case they will have the folder already instead of a PBO, just to save them from any possible confusion.

 

Thanks for uploading the files to GitHub, really appreciate it.

 

That is a very good point. I will go ahead and fix that.

Link to comment
Share on other sites

  • 2 weeks later...

i read in the earlyer posts that you need to do this s_building_snapping to the whitelist in the AHconfig.sqf file. if you have infistar

 

now i cannot the life of me find that file , i did do the http:// ftp thing but it says the file dosnt exist , any help would be great 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
×
×
  • Create New...