[PARTIALLY SOLVED] Can we disable buildable areas on the map with the Building Helper?

edited January 2016 in Support

I'm wondering if it's possible to disable certain build spots or areas on the map so that the builder can't place structures there - preferably via Hammer since that's easier for me to manage. My goal is to disable my players from building on the lanes.

I know there's the reverse function in Dotacraft with the blight check (and that the builder can only build on areas with blight) so I'm guessing with some tweaks the opposite should be feasible?

Comments

  • Posts: 1,670

    I haven't implemented this yet, but the idea was to have named triggers on the map, then calling a RegisterTrigger("name") to detect those areas, then have buildings marked as "Requires" "name" and "Prevents" "name", so that when you use that skill, it will require or deny building on those area names, in addition to the normal construction checks.

    Alternatively and in less configurable option (the grid will still show green in your client), you could place those triggers on the lane areas, then in the PreConstruction phase, check if the location is inside the lane using the trigger bounds, and return false to stop the placement.

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • @Noya that seems a little challenging for me to undertake on my own right now. Will wait for you to implement that :) Let me know when you get to it!

  • For anyone that's interested - I saw a pretty neat code in EleTD so I implemented that as a workaround for the time being - it's based off denying construction below a certain elevation. Here's code:

            if vPos.z < 250 then
                SendErrorMessage(caster:GetPlayerOwnerID(), "#error_cannot_build_in_lane")
                return false
            end
    

    Just put that line in the event:OnPreConstruction block. I pretty much had to rework the whole map but meh, at least I don't have people exploiting the creep spawns with obstructive buildings.

  • Posts: 1,670

    Keep in mind that will not update the clientside grid, you'd need the same checks in javascript for the grid to turn red when hovering over an invalid area

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • edited January 2016 Posts: 69

    Yeah that's something I have to work on at some point. My grid system is the old one anyway so it's pretty damn messed up everything is green most of the time - even when hovering over the trees lol.

    I still think ur white grid thing is really cool though - if u make that the default (instead of having to push alt - like nobody does that u know right :P) that would make the UX much cooler.

    Also a somewhat related topic - the grid system does not show if u click on the ability then click on the ground (as opposed to the usual pressing hotkey then clicking on ground).

  • Posts: 1,670

    The reason I don't make the Alt-grid default is because for big buildings it causes FPS drops

    The 'click on the ability' bug is fixed by rendering the bottom part of the screen, like this: https://github.com/MNoya/DotaCraft/blob/master/content/dota_addons/dotacraft/panorama/layout/custom_game/custom_ui_manifest.xml#L3

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • edited January 2016 Posts: 69

    Ah interesting - a single line of code... I like. Will test it out! Thanks @Noya.

    And how bad is the FPS drop?

  • Posts: 1,670

    Around -20FPS for the biggest 8x8 buildings (it makes 24^2 particles)

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||