- Joined
- Mar 10, 2009
- Messages
- 5,016
THIS IS SOLVED AND NEEDS TO BE CLOSED
Does this work for you?,well it works for me but when I use this setup in my EngageSystem system, it doesnt, idk why..., tested only for 1 or more units but not all units that is registered wants to engage...
Full test code posted...
Does this work for you?,
JASS:
scope D
globals
private hashtable HASH = InitHashtable()
private group G = CreateGroup()
endglobals
struct D
static method groupLooper takes nothing returns nothing
local unit u = GetEnumUnit()
local unit filter = GetClosestUnit(GetUnitX(u),GetUnitY(u),LoadBooleanExprHandle(HASH,GetHandleId(u),100))
call BJDebugMsg(GetUnitName(u)+"===ATTACKS==="+GetUnitName(filter))
call IssuePointOrder(u,"attack",GetUnitX(filter),GetUnitY(filter))
set u = null
set filter = null
endmethod
static method forGroup takes nothing returns nothing
call ForGroup(G,function thistype.groupLooper)
endmethod
static method SetUnitLockTargets takes unit u, boolexpr b returns nothing
call SaveBooleanExprHandle(HASH,GetHandleId(u),100,b)
endmethod
static method RegisterHero takes unit u returns nothing
call GroupAddUnit(G,u)
endmethod
static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(),2.0,true,function thistype.forGroup)
endmethod
endstruct
endscope
JASS:
//this is written in the map header
native UnitAlive takes unit u returns boolean
function filterU takes nothing returns boolean
return UnitAlive(GetFilterUnit()) and IsUnitEnemy(udg_U,GetOwningPlayer(GetFilterUnit()))
endfunction
-
Setup NOT WORKING
-
Events
- Time - Elapsed game time is 0.00 seconds
- Conditions
-
Actions
-
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
-
Loop - Actions
- Set U = (Picked unit)
- Custom script: call D.RegisterHero(udg_U)
- Custom script: call D.SetUnitLockTargets(udg_U, Filter(function filterU))
-
Loop - Actions
-
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
-
Events
-
Setup WORKING
-
Events
- Time - Elapsed game time is 0.00 seconds
- Conditions
-
Actions
- -------- This is working but for 1 unit only --------
- Set U = Mountain King 0006 <gen>
- Custom script: call D.RegisterHero(udg_U)
- Custom script: call D.SetUnitLockTargets(udg_U, Filter(function filterU))
-
Events
Full test code posted...
Attachments
Last edited: