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!
 
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.
 
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.
 
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.
 
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.
 
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".
 
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.
 
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....
 
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
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top