Statistics: Posted by DDDX — 14 Oct 2018, 18:36
local TConstructionUnit = import('/lua/terranunits.lua').TConstructionUnit
local MassKilled = 0
DUMMY0815 = Class(TConstructionUnit) {
OnKilledUnit = function(self, unitKilled, massKilled)
-- add the mass of this kill to our mass counter
MassKilled = MassKilled + massKilled
-- if we killed over 1,000,000 mass then...
if MassKilled > 1000000 then
--do stuff here like creating new unit etc.
end
-- call the original function, so we don't break it.
TConstructionUnit.OnKilledUnit(self, unitKilled, massKilled)
end,
}
TypeClass = DUMMY0815
Statistics: Posted by Uveso — 14 Oct 2018, 14:45
OldOnKilledUnit = Unit.OnKilledUnit,
OnKilledUnit = function(self, unitKilled, massKilled)
if not massKilled or massKilled == 0 then return end -- Make sure engine calls aren't passed with massKilled == 0
if IsAlly(self:GetArmy(), unitKilled:GetArmy()) then return end -- No XP for friendly fire...
self.MassKilled = self.MassKilled + massKilled -- Saving Mass Killed by unit
-- Your stuff : unit creation or buffing
---------------------------------------
Unit.OldOnKilledUnit(self, unitKilled, massKilled)
end,
local pos = uniKilled:GetPosition()
local unit = aiBrain:CreateUnitNearSpot('URL0107', pos[1], pos[3])
Statistics: Posted by Franck83 — 14 Oct 2018, 13:29
Statistics: Posted by DDDX — 14 Oct 2018, 11:35