Forged Alliance Forever Forged Alliance Forever Forums 2017-12-26T12:22:41+02:00 /feed.php?f=53&t=15651 2017-12-26T12:22:41+02:00 2017-12-26T12:22:41+02:00 /viewtopic.php?t=15651&p=158608#p158608 <![CDATA[Re: why no score after the game?]]>
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

Thank you very much! You inspired me a lot. I have found the solution to this problem. :D I should have set the value of 'k' from 1 to 55, 'cause I only have put 55 pairs of entries and exits on the map. The maximum of 'k' must be equal to the totality of the entries or exits on the map.

Statistics: Posted by Ghoustaq — 26 Dec 2017, 12:22


]]>
2017-12-25T20:44:11+02:00 2017-12-25T20:44:11+02:00 /viewtopic.php?t=15651&p=158576#p158576 <![CDATA[Re: why no score after the game?]]> Entry_1, Entry_2, Entry_3, ... Entry_88
and same for
Exit_1 - Exit_88

Statistics: Posted by speed2 — 25 Dec 2017, 20:44


]]>
2017-12-25T20:10:44+02:00 2017-12-25T20:10:44+02:00 /viewtopic.php?t=15651&p=158574#p158574 <![CDATA[Re: why no score after the game?]]>
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.

I think I have found where the bug is. If I delete those sentences below, the score system will work normally. But I can't do that, they are very important for me to complish the map.

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

Statistics: Posted by Ghoustaq — 25 Dec 2017, 20:10


]]>
2017-12-25T19:39:33+02:00 2017-12-25T19:39:33+02:00 /viewtopic.php?t=15651&p=158573#p158573 <![CDATA[Re: why no score after the game?]]>
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.

I copied the script to the folder of another map and rename it, then the same problem occured. So I'm sure that there's something wrong with the content of the script.You can try it as I did.

Statistics: Posted by Ghoustaq — 25 Dec 2017, 19:39


]]>
2017-12-25T18:52:17+02:00 2017-12-25T18:52:17+02:00 /viewtopic.php?t=15651&p=158571#p158571 <![CDATA[Re: why no score after the game?]]> Statistics: Posted by speed2 — 25 Dec 2017, 18:52


]]>
2017-12-25T17:09:17+02:00 2017-12-25T17:09:17+02:00 /viewtopic.php?t=15651&p=158563#p158563 <![CDATA[Re: why no score after the game?]]>
speed2 wrote:
what's the name of your map?

the name is 13. I haven't rename it yet, because the map is not complished, and I have not uploaded it on the forum or somewhere else. I just test it on my own computer.

Statistics: Posted by Ghoustaq — 25 Dec 2017, 17:09


]]>
2017-12-25T15:46:24+02:00 2017-12-25T15:46:24+02:00 /viewtopic.php?t=15651&p=158559#p158559 <![CDATA[Re: why no score after the game?]]> Statistics: Posted by speed2 — 25 Dec 2017, 15:46


]]>
2017-12-25T15:31:10+02:00 2017-12-25T15:31:10+02:00 /viewtopic.php?t=15651&p=158558#p158558 <![CDATA[Re: why no score after the game?]]>
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.


thanks for you suggestions, here's the content of the script:


Code:
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




----------------------------------------
some parts of the script are totally copied from a map named 'Aperture Laboratories' whose author is Col. Jessep, what I do is just modifying some values in the sentenses to make them suitable for my map.

Statistics: Posted by Ghoustaq — 25 Dec 2017, 15:31


]]>
2017-12-25T14:42:12+02:00 2017-12-25T14:42:12+02:00 /viewtopic.php?t=15651&p=158556#p158556 <![CDATA[Re: why no score after the game?]]> Statistics: Posted by speed2 — 25 Dec 2017, 14:42


]]>
2017-12-25T14:19:33+02:00 2017-12-25T14:19:33+02:00 /viewtopic.php?t=15651&p=158554#p158554 <![CDATA[why no score after the game?]]> Excuse me, I can't post an image here, cause' I'm newcom.

Statistics: Posted by Ghoustaq — 25 Dec 2017, 14:19


]]>