Forged Alliance Forever Forums
Moderator: Morax
speed2 wrote:Mentioning the name of your map would be a good start, so someone can have a look at it. Or posting the content of the script, since that's just text, or anything that would give any kind of information.
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
speed2 wrote:what's the name of your map?
speed2 wrote:If there are no errors in the log, it should be fine. Else I'd need to try the map to tell you more.
speed2 wrote:If there are no errors in the log, it should be fine. Else I'd need to try the map to tell you more.
speed2 wrote:do you have markers on your map? specifically markers named
Entry_1, Entry_2, Entry_3, ... Entry_88
and same for
Exit_1 - Exit_88
Users browsing this forum: No registered users and 1 guest