Einherj 6 Posted May 20, 2012 Now, don't execute me for making a new thread about this. My reasoning for making a new one was, unlike other threads, I have an actual working solution for this issue.Issue:water bottles can not be filled in ponds without swimmingI came up with a better solution which can be found here:http://dayzmod.com/forum/showthread.php?tid=4204&pid=40633#pid40633Solution:1) A config class in which ponds are represented as polygons2) A function that checks if a given point (player position) is inside a collection of polygons3) Integrate check into fn_selfActions.sqf which determines if "Fill Water" action is displayedThis is not just a theory, I have actually tested this already. All I have to do now is to record the rest of the ponds as polygons.Some proof to follow. The red balls represent vertices and there is some debug data on the upper right corner.[attachment=247][attachment=248]Would this be something the devs might be interested in? Share this post Link to post Share on other sites
Riemer 23 Posted May 20, 2012 Yes, someone finally didn't just wish for it to happen and made it happen.You are among the better people on the forums. Share this post Link to post Share on other sites
waphlez 2 Posted May 20, 2012 Yes, this looks really good. It will also prevent the ability to refill and drink sea water. Share this post Link to post Share on other sites
harryzhe 28 Posted May 20, 2012 seeing as you're evidently a good scripter i would assume this is all calculated clientsidebut i have to check, it's clientside right? No weird technicality disallows you from doing it? Share this post Link to post Share on other sites
Leechman 8 Posted May 20, 2012 Nice work.Would like to see this little bug fixed Share this post Link to post Share on other sites
Einherj 6 Posted May 20, 2012 seeing as you're evidently a good scripter i would assume this is all calculated clientsidebut i have to check' date=' it's clientside right? No weird technicality disallows you from doing it?[/quote']It is done clientside, yes, but it still has to be implemented in the DayZ code, if that is what you meant. Hence the question if the devs would be interested in this :) Share this post Link to post Share on other sites
Leechman 8 Posted May 20, 2012 Try emailing the devs to get the word to them quicker?It could also be possible that they are working on something similar at the moment. Share this post Link to post Share on other sites
Einherj 6 Posted May 20, 2012 Try emailing the devs to get the word to them quicker?I have emailed them. Still, I feel like the forums would be a better medium to get the message through since they supposedly get an email every two minutes or so. Share this post Link to post Share on other sites
Leechman 8 Posted May 20, 2012 As long as you've got all bases covered I'm sure they'll see it :) Share this post Link to post Share on other sites
Mutonizer 78 Posted May 20, 2012 Wouldn't it be easier to just link the "can fill bottle" to the "you're walking in water" terrain detection? I mean, something clearly tells our client to play the "splosh, splosh" noise and to update the visibility and sound markers, so it knows if it's water or not just fine and that's already in the DAYZ code (since terrain makes the sound/visibility change and zombies react to it).Can't you plug the event detection there and be done with it? No calculation needed. Share this post Link to post Share on other sites
Einherj 6 Posted May 20, 2012 Wouldn't it be easier to just link the "can fill bottle" to the "you're walking in water" terrain detection? I mean' date=' something clearly tells our client to play the "splosh, splosh" noise and to update the visibility and sound markers, so it knows if it's water or not just fine and that's already in the DAYZ code (since terrain makes the sound/visibility change and zombies react to it).Can't you plug the event detection there and be done with it? No calculation needed.[/quote']Nice idea in theory, though in practice not possible since these things are handled by the engine and are not available outside of it. Share this post Link to post Share on other sites
Einherj 6 Posted May 20, 2012 I came up with an improved solution today which needs less manual labor and is more efficient and accurate:At startup1) Gather all pond object IDs2) Convert pond bounding boxes to 2d rectangles and save as an arrayIntegrate into surface check loopa function that1) checks if the player is inside any of the rectangles.2) If yes, checks if the player is at the same level above the sea as the pond in question.3) ???4) Profit.Some test screens to follow.Player is not inside any of the pond bounding rectangles:Player is touching the water:[attachment=278] Share this post Link to post Share on other sites
Vaxis 0 Posted May 20, 2012 I'd just like to fill my water in a pond without losing my stuff, I'm all for a fix. :D Share this post Link to post Share on other sites
rocket 16567 Posted May 20, 2012 This is fixed in 1.5.8.You can no longer fill in the sea. You must use ponds or pumps. Share this post Link to post Share on other sites
greez 4 Posted May 20, 2012 This is fixed in 1.5.8.You can no longer fill in the sea. You must use ponds or pumps.it would be nice to add option "drink water" near the pumps or near a pond without a flask Share this post Link to post Share on other sites
Einherj 6 Posted May 20, 2012 This is fixed in 1.5.8.You can no longer fill in the sea. You must use ponds or pumps.Nice! I should probably wait for the next patch before trying to figure out solutions for other issues :D Share this post Link to post Share on other sites
Napoleon Solo 10 Posted May 21, 2012 Great idea.How are you checking if an object is inside?My first naive approach would be to compute the distances to all corners. Then take the closest two and compute the vector between them. Then get the vector perpendicular to it and dot product it with the vector from the player pos to one of the corners. Then read the sign of the result.For optimization purposes it should only be computed when the player triggers a circular area around the lake by his presence. Share this post Link to post Share on other sites
Dullard 6 Posted May 21, 2012 I'm glad to see this is getting fixed in the upcoming patch.Einherj, thank you for seeing a problem and then working on a solution. (even if the devs were already working on it too) People like you are a benefit to the community. Share this post Link to post Share on other sites
Einherj 6 Posted May 21, 2012 How are you checking if an object is inside?I check if the point is inside either of the defining triangles. Share this post Link to post Share on other sites
Napoleon Solo 10 Posted May 21, 2012 Alright, I'm not sure how it's done after the patch, but with the dot product method vey few operations are needed.Basically it's if ( (corner1.y - corner2.y, corner2.x - corner1.x) dotP (player.x - corner1.x, player.y - corner1.y) > 0 ) { is outside }8 instructions. As soon as the two closest corners have been found in a loop (worst case maybe #corners * 10 ops). Share this post Link to post Share on other sites
JezzaFromAUS 0 Posted May 21, 2012 Could you perhaps find the script that detects what a player is walking on to produce a sound and use that same system to detect whether he's on water or not? Share this post Link to post Share on other sites
Einherj 6 Posted May 21, 2012 Could you perhaps find the script that detects what a player is walking on to produce a sound and use that same system to detect whether he's on water or not?Like explained earlier in this same thread this is not possible since the surface collision (including sounds) is handled by the engine internally. Share this post Link to post Share on other sites
Einherj 6 Posted May 22, 2012 Since all the item interactions were moved to the inventory in the latest patch how this system works now is:1) there's always a fill water bottle action associated with the empty water bottle item2) clicking on it checks if the player is near a water pump, tank, well or a pond3) if true the bottle is filled, if false a text is displayed to tell the player he has to be near one of these things.The pond check goes like this:1) get all objects inside 50 meter radius2) check if any of their string representations have the word "pond" in it3) if true check that the player is below the pond surface Share this post Link to post Share on other sites