shiFt
Member
- Reaction score
- 8
What function would I use?
function IsPointWater takes real x, real y returns boolean
return IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) and not(IsTerrainPathable(x,y,PATHING_TYPE_AMPHIBIOUSPATHING))
endfunction
how would I use this to, basically want to detect if units are in water and slow there ms, then when they exit again they get their ms restored to normal speed. Regions?
scope WaterSlow initializer Init
globals
private constant integer raw = 039;A000039;
private unit myCaster
private group myGroup = CreateGroup()
endglobals
native UnitAlive takes unit id returns boolean
private function SlowWaterPeople takes real x, real y returns boolean
local unit u = GetFilterUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
if IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) and not IsTerrainPathable(x,y,PATHING_TYPE_AMPHIBIOUSPATHING) and UnitAlive(u) then
call IssueTargetOrder(mydummyunitorwhatevertocastslow,"slow",u)
endif
set u = null
return false
endfunction
private function Grouping takes nothing returns boolean
if GetSpellAbilityId() == raw then
set myCaster = GetTriggerUnit()
call GroupEnumUnitsInRange(myGroup,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),500,Condition(function SlowWaterPeople))
call GroupClear(myGroup)
endif
return false
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition(function Grouping))
set t = null
endfunction
endscope
native GetUnitGoldCost takes integer unitid returns integer
native GetUnitWoodCost takes integer unitid returns integer
native GetUnitBuildTime takes integer unitid returns integer
native GetUpgradeGoldCost takes integer id returns integer
native GetUpgradeWoodCost takes integer id returns integer
native UnitAlive takes unit id returns boolean
native UnitInvis takes unit id returns boolean