System Advanced Indexing & Data Storage

Kenny

Back for now.
Reaction score
202
AIDS structs do not have static units named 'unit'.

Just because you use it in a static method, does not mean that the struct member will be static when you need it to be.

You can only use 'unit' when referring to struct instances, using either 'this', '.' or nothing at all.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
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.

The '.unit' member is part of the AIDS system. I think he tried to use AIDS, but ended up having a problem. He posted it here, not knowing his problem is not related to AIDS.

I use it in a static method and this is not of a type which allows . syntax (says JassHelper).

Well there's a number of solutions. First of all, the problem with your code is, you're not referring to any instance of a struct. Most likely, if you are using some of the AIDS methods implemented by the textmacro, you need to make the method non-static, and use 'this'.
 

Lehona

New Member
Reaction score
12
Sorry, thougt that I can post problems with a system in the system's thread. :)

And thank you, got everything fixed. +rep
 

Lehona

New Member
Reaction score
12
Which is now :p

I got this Trigger/Struct for an AI, but it doesn't seem to work... The "Works!" shows only up once, so I think it doesn't work with giving a Unit the Chaos-Ability (Or maybe the Locust, dunno) :

JASS:
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)=='Ske2' or GetUnitTypeId(u)=='Ske1' //'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


The summoned Units do nothing, though they are ment to do sth. (To walk to "udg_Hero").

And because I'm already asking: Is there a good way to detect whether there are enemys nearby?
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
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.

Have you ever played a spawn-based strategy map?
They have a lot of units.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Have you ever played a spawn-based strategy map?
They have a lot of units.
I highly doubt you can have 8190 or more units simultaneously in the map.
I mean without breaking something, like fucking the units moving done by the wc3 engine.
"simultaneously " is the keyword here.
 

Jesus4Lyf

Good Idea™
Reaction score
397

There is no "Triggering Unit" for a periodic event...

>I got this Trigger/Struct for an AI, but it doesn't seem to work... The "Works!" shows only up once
What "Works!"?

>Is there a good way to detect whether there are enemys nearby?
GroupEnum. Check this first.
 

Lehona

New Member
Reaction score
12
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 >.<

The "Works!" which should be displayed within the deleted TextTag function-call:p


>>GroupEnum. Check this first.
So put all units in range in a group, filter any ally out (so there are just enemys left) and then check whether its an empty group? Thougt of that before, but it seems so unefficient.
 

Jesus4Lyf

Good Idea™
Reaction score
397
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 >.<
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).

>>GroupEnum. Check this first.
So put all units in range in a group
No, you use a global group which never has any units added (as per the tutorial I linked).
 

Lehona

New Member
Reaction score
12
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.

JASS:
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, &quot;move&quot;, d.newPointX, d.newPointY)
set justonce = true
elseif d.square &gt; 1000.0 then
call IssuePointOrder(d.unit, &quot;move&quot;, 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, &quot;move&quot;, 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;o000&#039; or GetUnitTypeId(u)==&#039;n000&#039;
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
 

Nexor

...
Reaction score
74
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?
 

Jesus4Lyf

Good Idea™
Reaction score
397
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.
>[LJASS]private static thistype d[/LJASS]
Because that is a global variable, which you overwrite when you summon another. Use a timer system like KT2 to access a struct periodically.
 

Kenny

Back for now.
Reaction score
202
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 :D)
 

Jesus4Lyf

Good Idea™
Reaction score
397
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 :D)
I should do that, shouldn't I.
I just find it so adequate in its current form. I guess I'll get around to it, I've intended to some time... :)
 

grim002

New Member
Reaction score
0
When you do bother to update it, I'd appreciate it if you stopped supporting non-existent stuff from AutoIndex like that AutoData module that hasn't existed for 6 months. If you want to keep the module there, stop referring to it as an AutoIndex related feature.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top