Forged Alliance Forever Forged Alliance Forever Forums 2018-03-20T18:19:29+02:00 /feed.php?f=53&t=15973 2018-03-20T18:19:29+02:00 2018-03-20T18:19:29+02:00 /viewtopic.php?t=15973&p=161874#p161874 <![CDATA[Re: How to creat a damaging or healing area?]]>
stormbeforedawn wrote:
I would be very interested in this if you get a method to work.


@stormbeforedawn

Hello!stormbeforedawn:


here's my method. copy and paste the code to your mapscript. It does work, but still needs improving.

it should be noted that you must place a blankmarker on your map firstly ,and rename it as DAMAGEAREA_1

'cause the damagearea is a rectangle field located around the marker.

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

function OnPopulate()
   ScenarioUtils.InitializeArmies()   
end

function OnStart(self)

   ForkThread(HealthAdjustor)
end

   local DAMAGEAREAName
   local location
   local px, py, pz
   local rect
   local units
   local health
   local preAdjHealth

function HealthAdjustor(self)
    while true do
      for k = 1, 1 do
        DAMAGEAREAName = 'DAMAGEAREA_' .. k
        location = ScenarioUtils.MarkerToPosition(DAMAGEAREAName)
        px, py, pz = unpack(location)
        rect = Rect(px-25, pz-25, px+25, pz+25)
        units = GetUnitsInRect(rect)
      end
      for _, instigator in units do
        if VDist3(instigator:GetPosition(), location) <= 25 then
        health = instigator:GetHealth()
        instigator:AdjustHealth(instigator, -30)
        end
      end

        WaitSeconds(10)
    end
end

Statistics: Posted by Ghoustaq — 20 Mar 2018, 18:19


]]>
2018-03-05T18:49:59+02:00 2018-03-05T18:49:59+02:00 /viewtopic.php?t=15973&p=161504#p161504 <![CDATA[Re: How to creat a damaging or healing area?]]> Statistics: Posted by stormbeforedawn — 05 Mar 2018, 18:49


]]>
2018-03-05T14:44:34+02:00 2018-03-05T14:44:34+02:00 /viewtopic.php?t=15973&p=161494#p161494 <![CDATA[Re: How to creat a damaging or healing area?]]>
For more information look at the following files;

BuffField.lua
BuffFieldDefinitions.lua

Statistics: Posted by Sprouto — 05 Mar 2018, 14:44


]]>
2018-03-05T19:41:45+02:00 2018-03-05T14:33:35+02:00 /viewtopic.php?t=15973&p=161493#p161493 <![CDATA[How to creat a damaging or healing area?]]> Statistics: Posted by Ghoustaq — 05 Mar 2018, 14:33


]]>