FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login
    1. Home
    2. Ghoustaq_14
    3. Posts
    G
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 16
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: [New problem]How to make extraarmies behave like AI players?

      @ghoustaq_14 said in [New problem]How to make extraarmies behave like AI players?:

      @penguin_ Wow, It seems that you created a new AI for the map of Twin Cities. I wonder if it is possible for extra amies to call the original AI codes?

      OK, I think I already solved this problem. Thank everyone for helping me.😊

      posted in Mapping
      G
      Ghoustaq_14
    • RE: [New problem]How to make extraarmies behave like AI players?

      @penguin_ Wow, It seems that you created a new AI for the map of Twin Cities. I wonder if it is possible for extra amies to call the original AI codes?

      posted in Mapping
      G
      Ghoustaq_14
    • [New problem]How to make extraarmies behave like AI players?

      I have created a huge map which is 80km² and I want more than 8 players on my map. So I placed many units including COMMAND UNITs,ENGINEERS, TANKs and so on for the ARMY_9 and Neutral Civilian which is set as enemy in the game options. But why do they just not work? the units of ARMY_9 will not appear on the game totally, and the units of Neutral Civilian will appear but just stand still and do noting.

      How to solve this problem? Is it possible for ARMY_9+ or Neutral Civilian to be manipulated by AI?

      posted in Mapping
      G
      Ghoustaq_14
    • RE: [Another question]How do those different types of layer work on game?

      @jip said in [Another question]How do those different types of layer work on game?:

      You'd need to do that in a mod, but that is possible yes. If you want to take that road you're better off asking in #modding-general on the official discord. Make sure to give yourself the modder role in #role-selection. There's a lot more activity on Discord

      Thanks for advising!

      posted in Mapping
      G
      Ghoustaq_14
    • RE: [Another question]How do those different types of layer work on game?

      @jip said in [Another question]How do those different types of layer work on game?:

      Technically they can also influence the movement speed, or any other unit property. There is a engine callback when a unit switches terrain type. The game just doesn't make use of it

      is there a code that could make one unit's movement speed related with some terrain type. For example, one unit will slow down on rockyland and speed up on grassland.could it be realized by editing script.lua?

      posted in Mapping
      G
      Ghoustaq_14
    • RE: [Another question]How do those different types of layer work on game?

      @madmax said in [Another question]How do those different types of layer work on game?:

      they produce different effects on the ground like dust and footprints the ones with the red circle symbol are blocking types it is all defined in terraintypes.lua

      Thank you, Sir! It is a professional answer.👍

      posted in Mapping
      G
      Ghoustaq_14
    • [Another question]How do those different types of layer work on game?

      May they effect on the speed of units moving through on them? I am not sure, who knows the answer?
      layer type.jpg

      posted in Mapping
      G
      Ghoustaq_14
    • RE: I need some help for the script.lua of my map

      @rowey said in I need some help for the script.lua of my map:

      https://github.com/FAForever/fa-lua-vscode-extension

      Thank you for helping buddy👏 ,you are so kind

      posted in Mapping
      G
      Ghoustaq_14
    • RE: I need some help for the script.lua of my map

      @rowey said in I need some help for the script.lua of my map:

      Majority use Visual Studio Code for development as that's what our Intelisense is created for

      OK, I have installed Visual Studio Code, can you tell me where to download the "Intelisense plugin"?😊 I cannot wait to try it.

      posted in Mapping
      G
      Ghoustaq_14
    • RE: I need some help for the script.lua of my map

      @rowey said in I need some help for the script.lua of my map:

      What code editor are you using as we do have a Intelisense plugin that's being worked on for faf which is located on the faforever GitHub

      I use SciTE. Do you have a better choice?

      posted in Mapping
      G
      Ghoustaq_14
    • RE: I need some help for the script.lua of my map

      @magge said in I need some help for the script.lua of my map:

      The code style is just all messy in this forum. Just use pastebin.com to share your code. Or even better, GitHub.

      hey buddy! Do you have any idea of my codes? I don't know what's wrong with them🙄 Just give me some tips.Thanks so much😊

      posted in Mapping
      G
      Ghoustaq_14
    • RE: I need some help for the script.lua of my map

      @magge Hi buddy, I have shared it on GitHub. Do me a favor please😊

      Click on this link below:
      https://github.com/Ghoustaq-14/code-share-for-FAF/blob/main/a warp-test

      posted in Mapping
      G
      Ghoustaq_14
    • RE: I need some help for the script.lua of my map

      @penguin_ hello guy, I have written some codes for this function, but it doesn't work. Can you help fixing them?

      Here are the script codes:

      local ScenarioUtils = import('/lua/sim/ScenarioUtilities.lua')
      local ScenarioFramework = import('/lua/ScenarioFramework.lua')

      --units to be restricted
      local AIRbuildRestriction = categories.AIR + categories.EXPERIMENTAL + categories.STRATEGIC * (categories.TECH3) + categories.ANTIAIR * (categories.STRUCTURE) + categories.ANTIAIR * (categories.MOBILE)

      local rectSizeX = 5
      local rectSizeY = 5
      local radius = 3.5
      local distance = 2
      local Color0 = 'FFCEA984' -- CIVILIAN Color
      local Color1 = 'FFe80a0a' -- Cybran red
      local Color2 = 'ff2e8b57' -- new green
      local Color3 = 'FF2929e1' -- UEF blue
      local Color4 = 'ffa79602' -- Sera golden
      local Color5 = 'ffffffff' -- white
      local Color6 = 'FF2F4F4F' -- dark green
      local Color7 = 'ff000000' -- black
      local Color8 = 'ff901427' -- dark red
      local Color9 = 'ff40bf40' -- mid green
      local Color10 = 'FF5F01A7' -- dark purple
      local Color = {'FFe80a0a', 'ff2e8b57', 'FF2929e1', 'ffa79602', 'ffffffff', 'FF2F4F4F', 'ff000000', 'ff901427', 'ff40bf40', 'FF5F01A7'}

      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, 99 do
      	local entryName = 'Entry_' .. k
      	local exitName = 'Exit_' .. k
      	local midpointName = 'Midpoint_' .. k
      	local entryPos = ScenarioUtils.MarkerToPosition(entryName)
      	local exitPos = ScenarioUtils.MarkerToPosition(exitName)
      	local MIDPOINTPos = ScenarioUtils.MarkerToPosition(midpointName)
      	
      	ForkThread(TeleportThread, self, entryPos, exitPos)
      	CreateTeleportMaintenanceEffects(entryPos, exitPos)
      end
      

      end

      TeleportThread = function(self, entryPos, exitPos)
      local telUnits
      local killUnits
      local ferrymanX

      while true do
                  for INDEX, BRAIN in ArmyBrains do	
      	telUnits = BRAIN:GetUnitsAroundPoint( categories.MOBILE, entryPos, 3.5, 'Ally')
      	killUnits = BRAIN:GetUnitsAroundPoint( categories.MOBILE, exitPos, 3.5, 'Ally')
      	ferrymanX = BRAIN:GetUnitsAroundPoint( categories.ENGINEER, MIDPOINTPos, 5.5, 'Ally')
      
      	
      	if ferrymanX ~= nil then
      		if table.getn(ferrymanX) >= 1 then
      	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
      				      local MaxHealthofUnit = v:GetMaxHealth()
      				      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
      	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
             if ex >= tx and ez > tz then
      		Warp(v, Vector( tx-rectSizeX+Random(-rectSizeX/0.1, 0)/10, ty, tz-rectSizeX+Random(-rectSizeX/0.1, 0)/10))
      		#print('uzoom')
             end
             if ex >= tx and ez <= tz then
      		Warp(v, Vector( tx-rectSizeX+Random(-rectSizeX/0.1, 0)/10, ty, tz+rectSizeX+Random(0, rectSizeX/0.1)/10))
      		#print('uzoom')
             end
             if ex < tx and ez > tz then
      		Warp(v, Vector( tx+rectSizeX+Random(0, rectSizeX/0.1)/10, ty, tz-rectSizeX+Random(-rectSizeX/0.1, 0)/10))
      		#print('uzoom')
             end
             if ex < tx and ez <= tz then
      		Warp(v, Vector( tx+rectSizeX+Random(0, rectSizeX/0.1)/10, ty, tz+rectSizeX+Random(0, rectSizeX/0.1)/10))
      		#print('uzoom')
             end
      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 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

      posted in Mapping
      G
      Ghoustaq_14
    • RE: I need some help for the script.lua of my map

      or give me some examples, I will try to study them

      posted in Mapping
      G
      Ghoustaq_14
    • I need some help for the script.lua of my map

      I want to write a string of code to achieve some function like this: if one of my units reach the area-A, other units of mine can warp from area-B to area-C.

      I know how to use warp(), but I don't know how to write those
      Conditional statements for I am not professional in programming. Anybody would like to help me?

      posted in Mapping
      G
      Ghoustaq_14