Target-table Locust Swarm and Hashtables

BarzahdX

Active Member
Reaction score
18
Target-able Locust Swarm and Hashtables

Geeze it's been awhile, the last I logged on was 06/05/09. :p

I usually don't have many questions and can troubleshoot myself pretty well, but I've been away from the editor for some time now and I have seem to lost some of my ability. :p Anyways, I'm here to ask if anyone knows how to make a unit operate like a Locust Swarm-spawned unit, while still being target-able by both allies and enemies, but uncontrollable, their AI working like they do with Locust Swarm.



My second question is: With the latest patch I found an unfamiliar aspect of the editor--hashtables. What are they, what do they do, and what are they for? If anyone has some decent tutorials, I'd be much obliged.


Thanks in advance, +rep to helpers!
 

Curo

Why am I still playing this game...?
Reaction score
109
Anyways, I'm here to ask if anyone knows how to make a unit operate like a Locust Swarm-spawned unit, while still being target-able by both allies and enemies, but uncontrollable, their AI working like they do with Locust Swarm.

That's something I've been investigating myself. I went through a lot of effort to try and make the SC Carrier complete with interceptors. I'm using a sloppy method atm that periodically orders the interceptors to move/attack-move to somewhere near the carrier (a region created via a trigger). I also use the deselecting method to make them uncontrollable, but a quick order can still be given if the player is fast enough.

I was going to try and make a locust spell without the units actually having the locust and invulnerable skills, but I'm guessing that would just make the units controllable. I still might give it a shot though, although I'm pretty sure you must have tried this.
 

BarzahdX

Active Member
Reaction score
18
Actually I haven't tried much of anything, just brainstorming. To function like LS while being target-able and kill-able without being able to be controlled, I don't think it's possible, I'd love a decent coder to tell me otherwise. :)

I don't want them to be deselected, you just can't give them orders, which I believe may be possible with an order trigger. The hardest part is just the way they follow the caster around and attack his target in bursts, without having locust.
 

Bogrim

y hello thar
Reaction score
154
What you can do is use the ward classification to hide the interface. Then make a trigger that picks up on any issued order and simply overwrite that order with whichever order the unit previously had.

Hashtables would be good for this type of trigger as it allows you to store the units previous order by the unit's own ID, as well as the position the unit is heading towards.

Hashtables are double arrays, I've written a post on them previously:
A hashtable is a way to store data by catalog. Much like you have folders on your computer, a hashtable allows you to create a system for data retrieval. Hashtables access these "folders" through keys (integer values or strings).

Think of the Hashtable as your computer.
"of 0" is the primary folder.
"as 0" is the folder inside the first folder.

Trigger:
  • Hashtable
    • Of 0
      • As 0

An example of values a hashtable might store:
Trigger:
  • Hashtable
    • Of (Key: Unit ID)
      • As Integer Value Damage
      • As Integer Value Duration
    • Of (Key: Unit ID)
      • As Integer Value Damage
      • As Integer Value Duration

You could do something similar with variables alone, only hashtables allow you to store much more data with much more flexible access.
 

BarzahdX

Active Member
Reaction score
18
Thank you for the tutorial, Vicboy. What I gather from it is that they are variables that can be more easily converted to MUI.. Not as fancy as I thought, lol.

To Borgrim: Will hiding the interface make the command inaccessible? Such as if I use "A" as a hotkey to attack, just because I can't see the icon, will the command still go through? If not than the order trigger wouldn't matter. If so, than I wouldn't even bother hiding it, and I'd just use the order trigger.
 

Bogrim

y hello thar
Reaction score
154
Yes, using the ward classification to hide the interface also disables any hotkeys used by the interface. That's why I recommend using it, as the only orders you'd have to worry about controlling would be the orders the players can give with the mouse (limited to "smart", "attack" and "move").

Also the classification does not alter the way the unit is target, except if you also set it as a ward under "Target as".
 

Vicboy

Ultra Cool Member
Reaction score
44
There are some couple of things I've learned while using Hashtables.

1. You can use a unit's (SUPER) unique ID as the handle (this is the key, or array in variable terms) which makes it very easy to manipulate targeted units and etc. Once you've learned and appreciated this feature, the possibilities become almost endless. (exciting, ain't it?)

2. I forgot... But #1 will make you pretty thankful I've mentioned it.
 

Curo

Why am I still playing this game...?
Reaction score
109
Yes, using the ward classification to hide the interface also disables any hotkeys used by the interface. That's why I recommend using it, as the only orders you'd have to worry about controlling would be the orders the players can give with the mouse (limited to "smart", "attack" and "move").

Also the classification does not alter the way the unit is target, except if you also set it as a ward under "Target as".

Just to point something out, the orders would be limited to "smart". Not to be picky, but if you are using a trigger to detect the orders, a right click on a point or unit is always classified as "smart".

That's a handy idea, but whats the point of removing the interface if you can still give the unit "smart" orders? You'd still need the trigger to re-order your fake locusts anyways, regardless of whether or not the interface is displayed. Although I suppose having no interface sends to the player the message "you can't control me".

I noticed something like this in castle fight....
 

Curo

Why am I still playing this game...?
Reaction score
109
Actually, look up this post: http://www.thehelper.net/forums/showpost.php?p=1010724&postcount=14

This should solve the "selectable but not controlable" issue.

Except that allows you to stop the unit. So in our situations, the locust/interceptor would then just stop, rather then continue on its movement.

I was working through it in my head, and I think it would be possible to save the locust's current order (attack/move) and the target of that order through a hashtable. Then instead of ordering the locust to stop (as in the link you gave), you could load the order and target from the hashtable, and reorder the locust with that order. So much work :p
 

Bogrim

y hello thar
Reaction score
154
That was what I suggested earlier. I thought that by pausing the unit before issuing the stop order, you would just cancel the previous order. I didn't test it.
 

BarzahdX

Active Member
Reaction score
18
Thanks for all the replies, I might try out some of these ideas in the future, +rep to both of you. For now, I've just chosen an alternative route.
 

BarzahdX

Active Member
Reaction score
18
Yeah.. So I had a grand scheme, and as it's all coming together and everything is going well and my plan is unfolding I found out something new. Units with Locust are not recognized as being in the game, and cannot be put into unit groups(I'm using a "units within point unit-type of" kind of checker.)

Is this just a glitch or have I just really taken this long to figure it out?


EDIT: Sorry for the double post, I know some forums don't allow that, I can't remember the rules for here, lol.
 

Curo

Why am I still playing this game...?
Reaction score
109
In general, locust units cannot be "picked" (ie. pick every unit in group and...). You have to refer to them with functions (ie. Last Created Unit, Triggering Unit, etc), or variables.
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
In general, locust units cannot be "picked" (ie. pick every unit in group and...). You have to refer to them with functions (ie. Last Created Unit, Triggering Unit, etc), or variables.

thats wrong. locust units cannot be picked within range or regions (like pick all units within range / region) but can still be picked with pick all units owned by player / of type / matching condition.
 

BarzahdX

Active Member
Reaction score
18
EDIT: Gonna post my new questions in a new topic, thanks for the help.

P.S: The unit grouping worked.
 
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

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top