Deleted member 219079
D
Deleted member 219079
Current process:
Currently the demo map is following:
Where on the red circle stand 2 paladings after the scope init.
What this does at the moment?
It orders the paladin to move to point -3168 x and -3040 y when it hits low health.
In this case 2 Paladins, as I'm also testing the MUI capabilities, and running multiple units at the same time seems to work just fine.
There's still a lot to do but I'll keep ye updated
JASS:
scope PaladinAI
globals
private player filtPlayer
private group G = CreateGroup()
private unit U
endglobals
private function AliveEnemyFilter takes nothing returns boolean
return AliveAttackerFilter() and AttackableFilter() and IsUnitEnemy(GetFilterUnit(),filtPlayer)
endfunction
private function FriendFilter takes nothing returns boolean
return AliveAttackerFilter() and AttackableFilter() and IsUnitAlly(GetFilterUnit(),filtPlayer)
endfunction
private function JuicyEnemyFilter takes nothing returns boolean
set U = GetFilterUnit()
return AliveEnemyFilter() and /*
*/ 0.33>GetUnitState(U,UNIT_STATE_LIFE)/GetUnitState(U,UNIT_STATE_MAX_LIFE)
endfunction
private function BackOff takes unit u, boolean aggro returns boolean
if aggro then
return IssuePointOrder(u,"attack",(GetPlayerId(GetOwningPlayer(u))*2-1)*3000,0)
endif
return IssuePointOrder(u,"move",(GetPlayerId(GetOwningPlayer(u))*2-1)*3000,0)
endfunction
public function LowStats takes nothing returns nothing
call BackOff(HeroAI(GetTimerData(GetExpiredTimer())).me,false)
endfunction
//! textmacro PALADIN_ATK_LOCALS takes PALA
local unit FoG
local real x = GetUnitX($PALA$)
local real y = GetUnitY($PALA$)
local real hp
local real r
//! endtextmacro
//! textmacro PALADIN_ATK takes PALA, RANGE, VAR
set r = 9999
set filtPlayer = GetOwningPlayer($PALA$)
call GroupEnumUnitsInRange(G,x,y,$RANGE$,Filter(function AliveEnemyFilter))
loop
set FoG = FirstOfGroup(G)
exitwhen FoG == null
set hp = GetUnitState(FoG,UNIT_STATE_LIFE)
if hp<r then
set r=hp
set $VAR$=FoG
endif
call GroupRemoveUnit(G,FoG)
endloop
//! endtextmacro
public function Attack takes nothing returns nothing
local HeroAI ai = GetTimerData(GetExpiredTimer())
local unit u = ai.me
local unit target
//! runtextmacro PALADIN_ATK_LOCALS("u")
//! runtextmacro PALADIN_ATK("u","300","target")
if target==null then
set target = GetClosestUnitInRange(x,y,ai.targetConsiderRange,Filter(function AliveEnemyFilter))
if target != null then
call IssueTargetOrder(u,"attack",target)
set target = null
endif
else
call IssueTargetOrder(u,"attack",target)
set target = null
endif
set u = null
endfunction
public function FallBack takes nothing returns nothing
local unit u = HeroAI(GetTimerData(GetExpiredTimer())).me
local unit target
local integer c
//! runtextmacro PALADIN_ATK_LOCALS("u")
if GetUnitAttackers(u) > 0 then
set target = GetClosestUnitInRange(GetUnitX(u),GetUnitY(u),300,Filter(function JuicyEnemyFilter))
else
set filtPlayer=GetOwningPlayer(u)
call GroupEnumUnitsInRange(G,GetUnitX(u),GetUnitY(u),500,Filter(function FriendFilter))
set c = 0
loop
set FoG = FirstOfGroup(G)
exitwhen FoG==null
set c=c+1
call GroupRemoveUnit(G,FoG)
endloop
if c>2 then
//! runtextmacro PALADIN_ATK("u","450","target")
else
set target=null
endif
endif
if target == null then
call BackOff(u,false)
elseif GetUnitTarget(u)!=target then
call AddIndicator(u,255,255,255,255)
call IssueTargetOrder(u,"attack",target)
endif
endfunction
public function Assault takes nothing returns nothing
local unit u = HeroAI(GetTimerData(GetExpiredTimer())).me
if GetUnitState(u,UNIT_STATE_LIFE)/GetUnitState(u,UNIT_STATE_MAX_LIFE)>0.8 then
call IssuePointOrder(u,"attack",(GetPlayerId(GetOwningPlayer(u))*2-1)*-3000,0)
else
call BackOff(u,true)
endif
set u = null
endfunction
// ---------------
//! textmacro PALADIN_INI takes U, AI
// Basic :
set $AI$ = HeroAI.create($U$)
set $AI$.onLowLife = function PaladinAI_LowStats
set $AI$.onFallback = function PaladinAI_FallBack
set $AI$.onAttack = function PaladinAI_Attack
set $AI$.onOffend = function PaladinAI_Assault
// Uses SkillMod - plugin :
static if HeroAI.HAS_SKILLMOD then
call $AI$.enableSkillMod()
set $AI$[1] = A_HOLYLIGHT
set $AI$[2] = A_DIVINESHIELD
set $AI$[3] = A_HOLYLIGHT
set $AI$[4] = A_DEVOTIONAURA
set $AI$[5] = A_HOLYLIGHT
set $AI$[6] = A_RESURRECTION
set $AI$[7] = A_DIVINESHIELD
set $AI$[8] = A_DEVOTIONAURA
set $AI$[9] = A_DEVOTIONAURA
set $AI$[10] = A_DIVINESHIELD
call $AI$.checkLevelups()
endif
// Speed stuff up:
//call UnitAddItem($U$,CreateItem('ratf',0,0))
//! endtextmacro
endscope
Currently the demo map is following:
Where on the red circle stand 2 paladings after the scope init.
What this does at the moment?
It orders the paladin to move to point -3168 x and -3040 y when it hits low health.
In this case 2 Paladins, as I'm also testing the MUI capabilities, and running multiple units at the same time seems to work just fine.
There's still a lot to do but I'll keep ye updated
Attachments
Last edited by a moderator: