Statistics: Posted by Ghoustaq — 26 Dec 2017, 12:22
Statistics: Posted by speed2 — 25 Dec 2017, 20:44
Statistics: Posted by Ghoustaq — 25 Dec 2017, 20:10
Statistics: Posted by Ghoustaq — 25 Dec 2017, 19:39
Statistics: Posted by Ghoustaq — 25 Dec 2017, 17:09
local ScenarioUtils = import('/lua/sim/ScenarioUtilities.lua')
local ScenarioFramework = import('/lua/ScenarioFramework.lua')
--units to be restricted
local AIRbuildRestriction = categories.AIR + categories.ANTIAIR
local rectSizeX = 5
local rectSizeY = 5
function OnPopulate()
ScenarioUtils.InitializeArmies()
local tblArmy = ListArmies()
for index,army in tblArmy do
ScenarioFramework.AddRestriction(army, AIRbuildRestriction)
end
local self = import('/lua/sim/Entity.lua').Entity()
for k = 1, 88 do
local entryName = 'Entry_' .. k
local exitName = 'Exit_' .. k
local entryPos = ScenarioUtils.MarkerToPosition(entryName)
local exitPos = ScenarioUtils.MarkerToPosition(exitName)
ForkThread(TeleportThread, self, entryPos, exitPos)
CreateTeleportMaintenanceEffects(entryPos, exitPos)
end
end
TeleportThread = function(self, entryPos, exitPos)
local ex, ey, ez = unpack(entryPos)
local tx, ty, tz = unpack(exitPos)
local entryRect = Rect(ex - rectSizeX/2, ez - rectSizeY/2, ex + rectSizeX/2, ez + rectSizeY/2)
local exitRect = Rect(tx - rectSizeX/2, tz - rectSizeY/2, tx + rectSizeX/2, tz + rectSizeY/2)
local counter -- wtf value just to havy ANY value at until
local telUnits
local killUnits
while true do
telUnits = GetUnitsInRect( entryRect)
killUnits = GetUnitsInRect( exitRect)
if telUnits ~= nil then
if table.getn(telUnits) >= 1 then
for k, v in telUnits do
if table.find(v:GetBlueprint().Categories,'AIR') then
#v:GetPosition()
else
ForkThread(WarpThread,self, entryPos, exitPos, v)
end
end
end
end
if killUnits ~= nil then
if table.getn(killUnits) >= 1 then
for k, v in killUnits do
if table.find(v:GetBlueprint().Categories,'STRUCTURE') then
v:Destroy()
end
end
end
end
WaitSeconds(3)
end
end
WarpThread = function(self, entryPos, exitPos, v)
local ex, ey, ez = unpack(entryPos)
local tx, ty, tz = unpack(exitPos)
if table.find(v:GetBlueprint().Categories,'MOBILE') or table.find(v:GetBlueprint().Categories,'PROJECTILE') then
Warp(v, Vector( tx + Random(-rectSizeX/0.2, rectSizeX/0.2)/10, ty, tz + Random(-rectSizeY/0.2,
rectSizeY/0.2)/10))
#print('uzoom')
elseif table.find(v:GetBlueprint().Categories,'STRUCTURE') then
v:Destroy()
end
end
function CreateTeleportMaintenanceEffects (entryPos, exitPos)
#local ex, ey, ez = unpack(entryPos)
#local tx, ty, tz = unpack(exitPos)
#CreateUnitHPR('uel0001', 1, ex - rectSizeX/2, ey,ez - rectSizeY/2 , -180, 0, 0)
#CreateUnitHPR('uel0001', 1, ex + rectSizeX/2, ey,ez - rectSizeY/2 , -180, 0, 0)
#CreateUnitHPR('uel0001', 1, ex - rectSizeX/2, ey,ez + rectSizeY/2 , -180, 0, 0)
#CreateUnitHPR('uel0001', 1, ex + rectSizeX/2, ey,ez + rectSizeY/2 , -180, 0, 0)
local entryEnt = import('/lua/sim/Entity.lua').Entity()
local exitEnt = import('/lua/sim/Entity.lua').Entity()
Warp(entryEnt, Vector(entryPos[1],entryPos[2] + 0.2,entryPos[3] ))
Warp( exitEnt, Vector(exitPos[1],exitPos[2] + 0.2,exitPos[3] ))
end
function OnStart(self)
end
Statistics: Posted by Ghoustaq — 25 Dec 2017, 15:31
Statistics: Posted by Ghoustaq — 25 Dec 2017, 14:19