Forged Alliance Forever Forums
Moderator: Morax
function EditBlueprints(self)
for UnitID, UnitBlueprint in __blueprints do
if (UnitID == 'xsb2401') then -- Yolona Oss
UnitBlueprint.Intel.VisionRadius = 5
UnitBlueprint.Defense.Health = 22000
UnitBlueprint.Defense.MaxHealth = 22000
end
end
end
__blueprints['xsb2401'].Defense.Health = 22000
GetArmyUnitCapCost()
GetArmyUnitCap()
SetArmyUnitCapCost()
SetArmyUnitCap()
SetArmyUnitCap( brain:GetArmyIndex() , ScenarioInfo.Options.UnitCap )
speed2 wrote:These are all the engine functions available http://supcom.wikia.com/wiki/LUADOC_1.5.3599
I wrote bit of documentation for some of them here https://github.com/FAForever/fa/tree/develop/engine
local ScenarioUtils = import('/lua/sim/ScenarioUtilities.lua')
local ScenarioFramework = import('/lua/ScenarioFramework.lua')
function OnPopulate()
ScenarioUtils.InitializeArmies()
ScenarioFramework.SetPlayableArea('AREA_1', false)
local oldDamageArea = DamageArea
local radius = 25
local self = import('/lua/sim/Entity.lua').Entity()
local damage = 30
for k = 1, 1 do
local DAMAGEAREAName = 'DAMAGEAREA_' .. k
local location = ScenarioUtils.MarkerToPosition(DAMAGEAREAName)
local px, py, pz = unpack(location)
end
end
DamageArea = function(instigator, location, radius, damage, type, damageAllies, damageSelf, brain, army)
local army = ListArmies()
local rect = Rect(px-radius, pz-radius, px+radius, pz+radius)
local units = GetUnitsInRect(rect) or {}
local damageAllies = true
local damageSelf = true
for _, u in units do
if table.find(u:GetBlueprint().Categories,'MOBILE') then
continue
end
if VDist3(u:GetPosition(), location) > radius then
continue
end
if instigator == u then
if damageSelf then
local vector = import('/lua/utilities.lua').GetDirectionVector(location, u:GetPosition())
-- need this ugliness due to Damage() refuse to damage when instigator == u
instigator:OnDamage(instigator, damage, vector, 'Reclaimed')
end
elseif damageAllies or not IsAlly(army, u:GetArmy()) then
Damage(instigator, location, u, damage, 'Reclaimed')
end
end
local reclaim = GetReclaimablesInRect(rect) or {}
for _, r in reclaim do
if IsProp(r) and VDist3(r:GetPosition(), location) <= radius then
Damage(instigator, location, r, damage, 'Reclaimed')
end
end
-- Get rid of trees
oldDamageArea(instigator, location, radius, 1, 'Reclaimed', false, false)
end
function OnStart(self)
end
Users browsing this forum: No registered users and 1 guest