• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[General] "Ground/Water-Pathable" setting for Naga Buildings

Level 6
Joined
Sep 15, 2020
Messages
57
I'm trying to expand on the Naga race for my project, but I've repeatedly come across an annoyance dealing with their buildings; Mainly, the way the Object Editor sets them to require "Ground-Pathable" over "Buildable" terrain means that, yes, Naga can build on shallow water, but, they can also be built on any Ground terrain, even if it is normally unbuildable. What's more, I've noticed in some people's maps and campaigns, Naga buildings seemingly sometimes lose the 1/2 tile ring of unbuildable pathing, allowing you to overlap the edges of Naga buildings so long as they don't overlap the ground-blocking centres. This even happened last time I played tomoraider's Rise of the Blood Elves 3.0.

Is there a way I can fix the Naga buildings so they can be built on Land, and they can be built on Shallows, but not on unbuildable terrain? I have tried multiple configurations of the Pathing: Requires, and Pathing: Blocked By fields, experimented a bit with the Water Radius until I figured out it was meant for Shipyards, and even tried giving the buildings Amphibious pathing, but to no avail. It'd be cheesy as hell if you could build entire Naga cities in dungeon hallways and block the pathing of units passing through.
 
Level 6
Joined
Sep 15, 2020
Messages
57
If only shallow water building isn't an option, you'd have to trigger the construction order cancel on unbuildable tiles sadly.
If that's how it has to be done to allow shallow water building, any tips on how to set it up so it checks terrain under the building's entire path area? I'm not good with the technical stuff, but I plan to set the gameplay constants to receive 100% resources when cancelling a build/upgrade, instead of 75%, so it won't be a major loss for trying to spam a build where it shouldn't go.
 

deepstrasz

Map Reviewer
Level 70
Joined
Jun 4, 2009
Messages
18,995
If that's how it has to be done to allow shallow water building, any tips on how to set it up so it checks terrain under the building's entire path area?
Sadly, I don't think it's possible, at least not with GUI to check the to be constructed building's whole pathing in regards to the terrain it is supposed to be placed on. However, it can be detected if any unbuildable tile is in the point you click to build on.
Actually... there could be a way but it won't cancel before starting construction but right after. So basically, the building is placed, then a trigger checks the area around the building and if any unbuildable tiles are detected, the building is canceled/destroyed. Problem is, you'll have to make custom ranged areas of detection for each building depending on their size. Maybe you could figure out a formula depending on their object editor size. Not sure if you can add the pathing into the formula.
 
Last edited:
Level 6
Joined
Sep 15, 2020
Messages
57
Problem is, you'll have to make custom ranged areas of detection for each building depending on its size. Maybe you could figure out a formula depending on their editor size. Not sure if you can add the pathing into the formula.
I was trying to figure out in between babysitting today how to detect within a custom radius. If I know that 1 block on the map is 128 range units, then the Naga Tidal Guardian would technically only need to check its center square.

A full size Town Hall is 4 square blocks across, or 256 range from center to edge, and using Pythagoras theorem, that tells me that a Town Hall's area is also 362 units range from center to corner, rounded down.

I could run a check that hits the center point, 256 in cardinal directions, and 360 in diagonals, and if any of those 9 points are invalid, destroy the structure and adds its refund amount back to the player.

The hard part will be not stacking it as If/Then/Else statements, and the tedious part is doing it for each buildable structure as there is no native function (I know of) to return the building's gold and lumber cost, otherwise I'd easily group each building by size for the checks. I have attempted to test using the Transmute spell with triggers as a refund skill, but I've issues with that for another day.
 

deepstrasz

Map Reviewer
Level 70
Joined
Jun 4, 2009
Messages
18,995
I could run a check that hits the center point, 256 in cardinal directions, and 360 in diagonals, and if any of those 9 points are invalid, destroy the structure and adds its refund amount back to the player.
Yes, or rather, just make this trigger run right when you place the building on the tile if possible, that is to say, before the worker actually gets there and starts construction. So, if the tiles both in the cast point and around it are unbuildable, the worker is ordered to stop and a message appears informing the player that the place is not for building.
 
Level 21
Joined
Aug 29, 2012
Messages
860
and the tedious part is doing it for each buildable structure as there is no native function (I know of) to return the building's gold and lumber cost,

If you're not using those fields for anything, you can put their gold cost in "Gold Bounty Awarded - Base" and then retrieve it like so
  • Set VariableSet GoldCost = (Unit: (Triggering unit)'s Integer Field: Gold Bounty Awarded - Base ('ubba'))
Same with lumber. It'll be faster than a wall of Ifs, and player units don't give bounty natively so that shouldn't have an impact on anything
 
Level 6
Joined
Sep 15, 2020
Messages
57
If you're not using those fields for anything, you can put their gold cost in "Gold Bounty Awarded - Base" and then retrieve it like so
  • Set VariableSet GoldCost = (Unit: (Triggering unit)'s Integer Field: Gold Bounty Awarded - Base ('ubba'))
Same with lumber. It'll be faster than a wall of Ifs, and player units don't give bounty natively so that shouldn't have an impact on anything
Thanks for the tip, I actually didn't think of that. I've sorta given up on making the Naga buildings work, but for a few of my factions I'm working on implementing a way to salvage and refund unwanted units, up to 50% of the gold and lumber cost for most units and 80% for Mechanicals. I tried doing this with a dummy trigger for Transmute to cast on targets within an aura projected by a selling structure, but for some reason if you set the gold value to 1.0, aka 100%, it gives roughly 70-80% gold or so. If I set it to 0.99 gold, it gives 1 gold less than the full amount, and if 1.01 gold, 1 gold more than the full amount. It's weird. Using the Bounty Values seems a lot less of a headache.
 
Level 6
Joined
Sep 15, 2020
Messages
57
About the Naga buildings, perhaps you could make them only buildable in shallow water? That way players couldn't build them in problematic positions and you could define precisely where they could build
Considered it. Wasn't sure how to make it work, as usually with the default settings, if the pathing allows shallow water, it's allowed for all water. I've decided to just nix water buildings altogether at this stage.
 
Top