Uhh sorry to play a moderator but where is the AIDS question here ?!!
Make a thread.
// - You can use '.unit' from any AIDS struct to get the unit for which
// the struct is for.
I use it in a static method and this is not of a type which allows . syntax (says JassHelper).
Absolutely, you can. Next time it's probably worth posting your code with the problem, though.Sorry, thougt that I can post problems with a system in the system's thread.
struct AI extends array
//! runtextmacro AIDS()
private real newPointX
private real newPointY
private real dx
private real dy
private trigger t
private static method periodic takes nothing returns nothing
local thistype d=thistype[GetTriggerUnit()]
set d.dx = GetUnitX(udg_Hero) - GetUnitX(d.unit)
set d.dy = GetUnitY(udg_Hero) - GetUnitY(d.unit)
set d.newPointX = GetUnitX(udg_Hero) + GetRandomReal(-800.0,800.0)
set d.newPointY = GetUnitY(udg_Hero) + GetRandomReal(-800.0,800.0)
if SquareRoot(d.dx * d.dx + d.dy * d.dy) > 1300.000 then
call IssuePointOrder(d.unit, "move", d.newPointX, d.newPointY)
endif
endmethod
private static method AIDS_filter takes unit u returns boolean
return GetUnitTypeId(u)==039;Ske2039; or GetUnitTypeId(u)==039;Ske1039; //'Ske1' is the unit after summoning, 'Ske2' is the unit after getting the Chaos-ability.
endmethod
private method AIDS_onCreate takes nothing returns nothing
set this.t=CreateTrigger()
call TriggerAddAction(this.t,function thistype.periodic)
call TriggerRegisterTimerEvent(this.t, 2.0, true)
endmethod
endstruct
And for what silly reason you would have more than 8190 units simultaneously on the map ?
Also then it would required the user to use extended structs, pretty lame.
I highly doubt you can have 8190 or more units simultaneously in the map.Have you ever played a spawn-based strategy map?
They have a lot of units.
Actually, i don't. Do you even realize what 8190 means ? xDOh-ho, trust me. There can be A LOT of units.
local thistype d=thistype[GetTriggerUnit()]
I think you'd best read the documentation. AIDS structs exist for all units passing the filter supplied, and then to get a unit's struct use [LJASS]thistype[unit][/LJASS], to get a struct's unit use [LJASS]struct.unit[/LJASS]. To attach an extra unit to that struct, use a unit field in the struct (same way you always attach things to structs).I hate Copy&Paste ;_;
So to attach a Unit to an Aids_Struct i have to do...?
Seems a bit too late to think about that >.<
No, you use a global group which never has any units added (as per the tutorial I linked).>>GroupEnum. Check this first.
So put all units in range in a group
globals
boolean justonce
integer count
group GROUP
unit ut
unit Hero
endglobals
function notally takes nothing returns boolean
local AI d = AI[ut]
if justonce == true and IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(ut)) == false and GetFilterUnit() != Hero and IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) == false then
call IssuePointOrder(d.unit, "move", d.newPointX, d.newPointY)
set justonce = true
elseif d.square > 1000.0 then
call IssuePointOrder(d.unit, "move", d.newPointX, d.newPointY)
endif
if GetFilterUnit() == Hero then
set count = count + 1
endif
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(ut)) == true and IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) == false then
set count = count - 1
endif
return false
endfunction
struct AI extends array
//! runtextmacro AIDS()
public real newPointX
public real newPointY
private real dx
private real dy
private trigger t
private static thistype d
public real square
private static method periodic takes nothing returns nothing
set d.dx = GetUnitX(Hero) - GetUnitX(d.unit)
set d.dy = GetUnitY(Hero) - GetUnitY(d.unit)
set d.newPointX = GetUnitX(Hero) + GetRandomReal(-500.0,500.0)
set d.newPointY = GetUnitY(Hero) + GetRandomReal(-500.0,500.0)
set d.square = SquareRoot(d.dx * d.dx + d.dy * d.dy)
set ut = d.unit
set justonce = false
set count = 0
set GROUP = CreateGroup()
call GroupEnumUnitsInRange(GROUP, GetUnitX(d.unit), GetUnitY(d.unit), 300.0, Filter(function notally))
if count == 1 then
call IssuePointOrder(d.unit, "move", d.newPointX, d.newPointY)
endif
call DestroyGroup(GROUP)
set GROUP = null
endmethod
private static method AIDS_filter takes unit u returns boolean
return GetUnitTypeId(u)==039;o000039; or GetUnitTypeId(u)==039;n000039;
endmethod
private method AIDS_onDestroy takes nothing returns nothing
call DestroyTrigger(this.t)
set this.t = null
endmethod
private method AIDS_onCreate takes nothing returns nothing
set d = thistype[this.unit]
set this.t=CreateTrigger()
call TriggerAddAction(this.t,function thistype.periodic)
call TriggerRegisterTimerEvent(this.t, 3.0, true)
endmethod
endstruct
>[LJASS]private static thistype d[/LJASS]Why is this going to be not MUI? It should be if I'm not wrong, but it stops working for the first unit if I summon another.
I'm using dummy units, but AIDS keeps saying an error about inlined (null) unit, will this cause any harm?
How should I fix it, if it causes any?
if <vars> != null then
//some stuffs here.
endif
I should do that, shouldn't I.Are there plans for an update for this in the near to not-so-distant future? (Fixing what Azlier found and possibly adding AIDS modules and stuff )