• 0

    posted a message on Automatically Queueing last created unit

    come on I know some of you may know how to auto queue :( I know it's possible too because I've seen maps doing it. Any help would be much appreciated!

    Posted in: Miscellaneous Development
  • 0

    posted a message on Automatically Queueing last created unit

    Hi, I have been looking for a way to auto queue units. So if you create say a marine then if it finishes (or earlier I don't care really) it should automatically queue another marine. I tried doing it like this after much thinking, but it wont save/compile so obviously something is wrong. I didn't find an easy way to do it so here's how I've tried:

    Events
      Unit - Any Unit creates a unit with Any or Any
    Local Variables
      checkUnitCounter = 0 <integer>
      Unit Type = (String((Unit type of (Created Unit()))) <String>
    Conditions
    Actions
      General - For each integer checkUnitCounter from 0 to 1 with increment 1, do (Actions)  //ATM I have used 0 to 1 because I currently only have 1 unit that you can train from the barracks. (Marine)
        If
           Unit Type == ((String(checkUnitCounter)) from the Global data table) //see code block under this one to see what I saved to data table
        Then
           Unit - Order (Triggering unit) to ((String((checkUnitCounter + 100))) from the Global data table) (Replace Existing Orders)
        Else
           General - Break
    

    Two values added to data table on map initialisation are: (currently the only things added, will add more but atm only have a marine as an option to train)

    EDIT: Basically what I've been wanting to do is just add all unit types in data tables as Strings numbering from 0-99 and then all Train Orders from (0-99)+100 which makes 100-199. Not that I'm going to need that much, just in case ;)

    Data Table - Save "Marine" as "0" in the Global data table //Marine being a String, because you cant save a unit type to a data table, that's why I had to make Unit Type local variable a String.
    Data Table - Save (Barracks - Train Marine) as "100" in the Global data table
    
    <</code>>\\
     \\
    When it tries to compile I get these errors:
    
    <<code>>
    
    #
    1 implicit cast not allowed - line 181 --> if ((lv_unitType == DataTableGetInt(true, IntToString(lv_checkUnitCounter)))) {
    2 implicit cast not allowed - line 192 --> if ((lv_unitType == DataTableGetInt(true, IntToString(lv_checkUnitCounter)))) {
    

    So obviously something's going wrong with the datatables and all the String conversions somewhere, but I haven't yet spotted it. Would appreciate it if someone could help me out even though I'll keep on looking myself too

    Also for some reason the codes fucked up but I really cant be arsed to look into that now, It's just not working... stupid bb-code

    Posted in: Miscellaneous Development
  • 0

    posted a message on Triggers- How to use a unit group as a whole in "events"

    Seems like a fair solution! I was hoping that it was able to use unit group names in the events themselves but doesn't seem that easy ;) But I'll have no problems figuring it out with the loops, thanks for the help nZifnab!

    EDIT: Doesn't seem to work. You'll probably need the galaxy editor to work it out, but in a for loop I can't seem to use the local variable a and if I try it with an if I'm gettingsoemthing like

    if a == Value , where value has to be "In group Zerglings" And again same story here: can only say unit x of group y and not take the whole group y

    Posted in: Miscellaneous Development
  • 0

    posted a message on Triggers- How to use a unit group as a whole in "events"

    Hey there, I've been trying to find the answer myself on this site but failed at it... I'm trying something simple where zerglings unburrow if marines get close to them. So at the moment I got the following lines in Triggers.

    Events:
    Unit - Any Unit Enters a distance of 2.0 from (Unit 1 from Zerglings) //Zerglings being the group of zerglings (5 in total)
    Unit - Any Unit Enters a distance of 2.0 from (Unit 2 from Zerglings)
    Unit - Any Unit Enters a distance of 2.0 from (Unit 3 from Zerglings)
    Unit - Any Unit Enters a distance of 2.0 from (Unit 4 from Zerglings)
    Unit - Any Unit Enters a distance of 2.0 from (Unit 5 from Zerglings)
    Conditions:
    ((Triggering unit) is in Marines) == true //Marines being the group of marines (5 in total)
    Actions:
    Unit - Order all units in Zerglings to (Zergling - Unburrow) (Replace Existing Orders)
    


    Now, this works. But I was unable to use something like 'All units from Marines/Zerglings' in the events. So I had to work around it. I made a condition to check if the triggering unit was in Marines. But I still have to make a seperate line for every unit in Zerglings and I was wondering how to do this faster, something like the following.

    Unit Group - Any Unit from Marines enters a distance of 2.0 from any unit from Zerglings
    


    Because I figured it would get very retarded to do this if I had say 150 zerglings. So I'm sure there's a quicker way to do this out there, anybody who knows about it and can explain it to me?
    Thx

    Posted in: Miscellaneous Development
  • To post a comment, please or register a new account.