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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top