Skip to content

BuildingHelper:AddBuilding

Liam S edited this page Jul 18, 2015 · 4 revisions

This will run you through a "standard" building process. So basically, everything you see here: http://gfycat.com/ThickGleamingIslandwhistler

It should be called in a generic function that runs on every buildings OnSpellStart

Eg in npc_abilities_custom.txt

	"OnSpellStart"
	{
		"RunScript"
		{
			"ScriptFile"			"scripts/vscripts/abilities.lua"
			"Function"				"build"
		}
	}

and in lua

function build( keys )
    BuildingHelper:AddBuilding(keys)

    keys:OnConstructionCompleted(function(unit)
        print("Fin!")
    end)
end

The keys arg will have a heap of callbacks attached to it which are really handy for running game events when buildings hit certain events. There is a full example in abilities.lua

Clone this wiki locally