I've run into issue trying to modify the teleport script. I'm trying to add in a return functionality, and I've got the following so far:
In \mods\MyMod\hook\lua\sim\Units.lua:
- Code: Select all
OnTeleportUnit = function(self, teleporter, location, orientation)
local ReturnTime
local Return
local ReturnPos
local bp = self:GetBlueprint().Economy
if bp then
if bp.TeleportReturn == true then
ReturnTime = bp.TeleportReturnTime
Return = true
ReturnPos = self:GetPositionXYZ()
else
ReturnTime = false
Return = false
end
end
if self.TeleportDrain then
RemoveEconomyEvent( self, self.TeleportDrain)
self.TeleportDrain = nil
end
if self.TeleportThread then
KillThread(self.TeleportThread)
self.TeleportThread = nil
end
self:CleanupTeleportChargeEffects()
self.TeleportThread = self:ForkThread(self.InitiateTeleportThread, teleporter, location, orientation)
if Return == true then
WaitSeconds(5)
self.TeleportThread = self:ForkThread(self.InitiateTeleportThread, teleporter, ReturnPos, orientation)
end
end,
So, in bp.Economy in relevant units I've added TeleportReturn = true and TeleportReturnTime = 'n'
In game, I get the following error:
- Code: Select all
WARNING: SCR_LuaDoFileConcat: Loading "c:\programdata\faforever\gamedata\lua.nx2\lua\sim\unit.lua" failed: c:\programdata\faforever\gamedata\lua.nx2\lua\sim\unit.lua(4081): unexpected symbol near `='
There's 4047 lines in the original Unit.lua, so 4081 is line 34, specifically at the end of the OnTeleportUnit function.
Any ideas?
Edit: I should clarify, line 4081 is also the end of file, i had some redundant stuff following