Statistics: Posted by Franck83 — 12 Dec 2017, 23:42
local Buff = import('/lua/sim/buff.lua')
local TRadarUnit = import('/lua/terranunits.lua').TRadarUnit
UEB3101 = Class(TRadarUnit) {
OnStopBeingBuilt = function(self,builder,layer)
TRadarUnit.OnStopBeingBuilt(self,builder,layer)
local units = self:GetAIBrain():GetUnitsAroundPoint(categories.MOBILE, self:GetPosition(), 1000, 'Ally') -- grab all mobile units in 1000 area distance around the radar
BuffBlueprint {
Name = 'VisionRadius',
DisplayName = 'VisionRadius',
BuffType = 'VisionRadius',
Stacks = 'REPLACE',
Duration = -1,
Affects = {
VisionRadius = {
Mult = 1.2, -- +20% vision radius
},
},
for k, unit in units do
Buff.ApplyBuff(unit , 'VisionRadius')
end
}
end,
}
TypeClass = UEB3101
Statistics: Posted by Franck83 — 10 Dec 2017, 16:48
local units = Unit:GetAIBrain():GetUnitsAroundPoint(categories.MOBILE, Unit:GetPosition(), 1000, 'Ally') -- grab all mobile units in 1000 area distance around your research center
BuffBlueprint {
Name = MaxHealthBuff',
DisplayName = 'MaxHealthBuff',
BuffType = 'MaxHealth',
Stacks = 'REPLACE',
Duration = -1,
Affects = {
MaxHealth = {
Mult = 1.2, -- 20% Max Health buff
},
},
}
for k, unit in units do
-- casting your buff on each grabbed unit
Buff.ApplyBuff(unit , 'MaxHealthBuff')
end
Statistics: Posted by Franck83 — 10 Dec 2017, 00:39
Categories = {
'RESEARCHCENTER', -- Your add
'SELECTABLE',
...
},
local OldUnit = Unit
Unit = Class(OldUnit) {
OldOnStopBeingBuilt = Unit.OnStopBeingBuilt,
OnStopBeingBuilt = function(Unit, builder, layer)
Unit.OldOnStopBeingBuilt(Unit, builder, layer) -- Here you call the old function
if Unit then
local id = Unit:GetEntityId()
local bp = Unit:GetBlueprint()
if table.find(bp.Categories, 'RESEARCHCENTER') then
-- Cast your buff
end
end
end,
}
Statistics: Posted by Franck83 — 10 Dec 2017, 00:13
local OldUnit = Unit
Unit = Class(OldUnit) {
OldOnStopBeingBuilt = Unit.OnStopBeingBuilt,
OnStopBeingBuilt = function(Unit, builder, layer)
Unit.OldOnStopBeingBuilt(Unit, builder, layer) -- Here you call the old function
-- Add here your code.
end,
}
Statistics: Posted by Franck83 — 09 Dec 2017, 23:56
Statistics: Posted by PerfectWay — 09 Dec 2017, 23:17
...
okBtn.OnClick = function(self)
...
SimCallback ({Func= 'SetBuildingSpeed', Args = {id = _id, BuildingRate = Your building rate}})
dialog:Close()
end
Callbacks.SetBuildingSpeed = import('/Mods/Heroes_Reloaded/Modules/UiToSim.lua').SetBuildingSpeed
function SetBuildingSpeed(Unit)
local id = Unit.id
local unit = GetUnitById(id)
unit:SetBuildingRate(Unit.BuildingRate)
end
SetBuildingRate = function(self, BuildRate)
BuffBlueprint {
Name = 'BuildingRateBuff',
DisplayName = 'BuildingRateBuff',
BuffType = 'BuildingRateBuff',
Stacks = 'REPLACE',
Duration = -1,
Affects = {
BuildRate = {
Add = BuildRate or 0,
Mult = 1,
},
},
}
Buff.ApplyBuff(self, 'BuildingRateBuff')
end,
Statistics: Posted by Franck83 — 07 Dec 2017, 00:17
Statistics: Posted by PhilipJFry — 06 Dec 2017, 21:26
function ModBlueprints(all_bps)
...
Statistics: Posted by PerfectWay — 06 Dec 2017, 21:03