[Library] Building Helper

edited January 2016 in Projects

Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.

Comments

  • Posts: 184

    Added the most important issue in BH: https://github.com/Myll/Dota-2-Building-Helper/issues/39

    Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.

  • Posts: 1,670

    Updated with all the changes done through DotaCraft

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

  • Awesome, now someone can start making jurassic park... maybe

  • edited January 2016 Posts: 1,670

    Bump, from the dead it rises: https://github.com/MNoya/BuildingHelper

    I will only maintain the minimal codebase because the rts example was too broad and made the library scripts too tied to the implementation. I might consider remaking rts_example after DotaCraft is in Beta-shape, as well as a td_example based on ElementTD.

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

  • edited April 2016 Posts: 16

    Adorable work, nice lib, but how to upgrade towers? I have 2 units (2 towers). What the ability i must add? And how i can track, that tower was upgraded? Thanks

  • edited April 2016 Posts: 1,670

    @ExotiC BuildingHelper:UpgradeBuilding(building, newName) is part of the core API, read the Usage wiki and find examples on how to keep track of upgrades in the list of Implementations

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

  • Posts: 16

    @Noya I'm truying to understand how it works in implementations, i did something, but its doesn't work. It says "Ability Not Learned".

    enter image description here

    My KV files there Codeshare

    And one more problem: When tower building is complete, and i go make 1 more tower - my old tower deleted. And its causes that block path dont deleted from old tower. What i do wrong? Thanks

  • Posts: 1,670

    Make a new thread with your question on the Tools section and I'll look at it, this isn't really the place for going over specific code help.

    It does look like you misunderstood how the different abilities interact. You have abilities that build with the ghost system, and new upgrade abilities that just basically replace the unit with another. I'll go more in depth on the new thread

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

  • Hey,

    i just started using the BuildingHelper Library. I was wondering if there is a pool of buildings that i can use. Is everyone supposed to make his own building units? Would that include to also create models for those units (i have no clue of modelling)? I have just looked over the source codes of some mods using the BuildingHelper, and I´d like to know whether they created their building units and models themselves.

    Best regards VanillaThunder

  • Posts: 1,670

    Buildings are custom creatures with a model. Read more on Datadriven Units to make them, you can reutilize models from Dota.

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

  • Thanks, where can i find those models? What is their file extension?

  • Please provide an implementation example for the new repair feature added with BH 1.2.0. To be more precise, I dont understand which unit should have a repair ability defined like this:

    "RepairAbility" "repair_ability_name"

    Q1: Should the RepairAbility be attached to the repairing unit, e.g. my hero, or the repaired unit, e.g. a tower?
    Q2: Definition is one thing, implementation is the other one. How to implement such an ability?
    Q3: Where to put the KV "RequiresRepair" "1"?

    Thanks in advance :-)

  • edited June 2016 Posts: 1,670

    I'm still finishing some repair interactions, I'll document all on the wiki later

    Q1 You put the "RepairAbility" kv on the reparing unit, the builder
    Q2 All the repair ability should need to do is calling the repair script
    Q3 RequiresRepair is specific for buildings that you want to be constructed via repair. Repair by itself will work on all buildings that have HP missing, this is just to replicate the classic WC3 Human behaviour were buildings needed to be repaired progressively in order to finish the construction. You just put the "RequiresRepair" "1" on the ability and the builder will use the defined RepairAbility right after placing the building, and it will keep his queue to make other buildings or repair actions.

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

  • edited June 2016 Posts: 33

    Might it be problematic that my builder unit is an overwritten hero rather than a npc_dota_creature? Can heros have and use that RepairAbility? I expected "repair" not to be a classical ability shown with an icon next to my other abilities. Am I wrong?
    How is it triggered via right click then?

  • Posts: 1,670

    Currently you need the RepairAbility to be available as one of the "AbilityX" entries, yeah. I can make the system not need an ability at all but then the players wouldn't know you can repair buildings (unless you make it obvious that Right Click = Repair)

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

  • Hey Noya, I think I found a small bug in repair.lua line 55.

    if PlayerResource:GetGold(playerID) >= gold_tick then
            building.GoldAdjustment = building.GoldAdjustment + gold_float
            if building.GoldAdjustment > 1 then
                PlayerResource:ModifyGold(playerID, -gold_tick, false, 0) --LINE OF INTEREST
                building.GoldAdjustment = building.GoldAdjustment - 1
                building.gold_used = building.gold_used + gold_tick + 1
            else
                PlayerResource:ModifyGold(playerID, -gold_tick, false, 0)
                building.gold_used = building.gold_used + gold_tick
            end
        else
            building.gold_used = nil
            return false -- cancels the repair on all builders
        end
    

    Line of interest should be adjusted to

     PlayerResource:ModifyGold(playerID, - (gold_tick + 1) , false, 0)
    

    I noticed that when gold_tick is consequently smaller than 1 there would not ever be gold substraction. This will happen when BuildingCost or Costfactor are not at big values. My building for instance was 100 gold and had 300 HP. As a result, every costfactor value below 3 was not draining any gold for repair. Costfactors above that value were draining huge amounts of gold.

  • edited June 2016 Posts: 1,670

    repair.lua is a custom file containing callbacks for when something happens, change them at will (same as with builder.lua) based on your game needs, the code there is just an example (I should make this clear via comments on the file)

    The library will call the OnRepairTick every time it increases 1 or more HP. I think doing +1 is not correct for my case of use where I have a 2000HP building and the repair costs ~100 gold over a long time, many ticks shouldn't use gold and all small intervals are accumulated for later ticks.

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