Trouble building with custom ui

Discussion in 'Starcraft 2 (SC2) Editor Help' started by Nizlarath, May 27, 2010.

  1. Nizlarath

    Nizlarath New Member

    Ratings:
    +0 / 0 / -0
    I have some trouble with my map,

    we are creating a build system from custom ui alone.

    so the problem i cant find a solution for is.

    i want to click a dialog button then i want a model of the building faded like when you click build on a normal buildability.

    so if i press the button that is labeled pylon i would get a pylon following my mouse so i can place my tower.
     
  2. Nizlarath

    Nizlarath New Member

    Ratings:
    +0 / 0 / -0
    right now i have it working like this. It is a suboptimal solution but onw that works right now. i would gladly recieve some help on how to do this in a better way, and what i would like the most is for it to behave like a normal build ability.

    Trigger:
    • Trigger 002
      • Events
        • Dialog - Any Dialog Item is Clicked by Player Any Player
      • Local Variables
      • Conditions
        • (Used dialog item) == Button[0]
      • Actions
        • Variable - Set ClickedButton[0] = true

    Trigger:
    • Trigger 003
      • Events
        • UI - Player Any Player clicks Left mouse button Down.
      • Local Variables
      • Conditions
      • Actions
        • General - If (Conditions) then do (Actions) else do (Actions)
          • If
            • ClickedButton[0] == true
          • Then
            • Unit - Order Builder[0] to (Probe - Warp in Nexus targeting (Point((Mouse X position clicked in the world), (Mouse Y position clicked in the world)))) (Replace Existing Orders)
            • Variable - Set ClickedButton[0] = false
          • Else
     
  3. jleips2600

    jleips2600 New Member

    Ratings:
    +4 / 0 / -0
    I dont quite understand your problem, that seems like a lot of unncessary code... couldn't you just use the build ability as it is right now, but instead of having the button for the ability in the command card, insert it into your custom ui? or have a ui button link to that ability?

    if you're only changing the button and keeping the ability, then the ability will remain the same, and when you click to build something you'll get the faded image showing where you want to place it, no?
     
  4. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    If you want to code it, be sure to make it table driven. Data tables are there for a reason.

    jleips' idea seems better though - if you CAN get it to work, it would be very fancy.
     
  5. Ancanus

    Ancanus [ancanus@TheHelper.net]# _

    Ratings:
    +54 / 0 / -0
    Data tables are maps of type string-to-data, right?

    I'm just curious how would you use them to implement this (wondering mainly because I haven't found any use for them.)
     
  6. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    Yeah. You can always convert ints to string. Best would be to get some sort of unique identifier for each button. If that's not possible, create one yourself and get it with the fastest search algorithm possible.
    Then when a button is clicked, get its identifier and you instantly have the building to be constructed.

    Advantages over a data driven structure:
    It is _much_ easier to maintain.
    If there is a builtin way to get a unique identifier, it will probably be about O(1) vs O(n).
     
  7. bobby5589

    bobby5589 Member

    Ratings:
    +14 / 0 / -0
    Well, I think what he's saying is that he has the normal UI hidden and as he has it, it will build correctly where you click. However, when ordering a unit in triggers to build something you give it a point and don't have that intermediat step where you can place the building. (i.e. The tranparent building following your cursor with pathing info.)

    I can't say of seeing anyway to get that intermediat positioning step and there's not really any mouse support to do it that way.
     
  8. Dan

    Dan The New Helper.Net gives me great Anxiety... o.O;;

    Ratings:
    +160 / 1 / -0
    this is such a specific situation that I'm sure no one else will ever have to deal with... so all I can say is... good luck to you my friend. XD
     
  9. Nizlarath

    Nizlarath New Member

    Ratings:
    +0 / 0 / -0
    Yes excactly like this, the trouble is i cant find anything that calls a specific ability, the best would be i think that when i press my button i would simulate pressing the build button. But i dont think this is possible.
     
  10. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    Unit - UnitIssueOrder
     
  11. bobby5589

    bobby5589 Member

    Ratings:
    +14 / 0 / -0
    Does that work for you, Serra(this all could just be me, idk)? I've tried that to see if it worked (thought I mentioned that, becuase it was the first thing I tried to get working) and it doesn't work becuase it cancels because the unit doesn't have the needed information from it.

    I couldn't get any results out of build, but for example I tried issuing "attack" in that manner and the unit gets the order (you can see the button flash/be clicked(?)) and it ends becuase there was not point to move to. It doesn't allow you to left click a point like you would if you normally clicked attack.
     
  12. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    Hmmm. Is there a way to simulate UI presses?
     
  13. bobby5589

    bobby5589 Member

    Ratings:
    +14 / 0 / -0
    I haven't seen any. So as far as I can say, this is undoable unless either that or more cursor support is added.
     
  14. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    Well, you could always Lock Camera Mouse Relative Mode. Basically this will lock your mouse to the center of the screen while building your unit (you can still scroll around the map, but the mouse will stay in the center of the screen).

    In Mouse Relative Mode you can actually detect targets.
     
  15. Nizlarath

    Nizlarath New Member

    Ratings:
    +0 / 0 / -0
    i dont think that is an acceptable method =P
     
  16. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    Ahh, worth a shot. Had a feeling you wouldn't bite :p.

    You could make it look pretty killer though...like you're beaming in the building or something ;).
     
  17. Nizlarath

    Nizlarath New Member

    Ratings:
    +0 / 0 / -0
    i guess noone has come up with a solution to my problem yet ? =p
     

Share This Page