Trouble building with custom ui

Nizlarath

New Member
Reaction score
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.
 

Nizlarath

New Member
Reaction score
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
 

jleips2600

New Member
Reaction score
4
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?
 

SerraAvenger

Cuz I can
Reaction score
234
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.
 
Reaction score
54
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.)
 

SerraAvenger

Cuz I can
Reaction score
234
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.)

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).
 

bobby5589

Member
Reaction score
15
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.
 

Dan

The New Helper.Net gives me great Anxiety... o.O;;
Reaction score
160
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
 

Nizlarath

New Member
Reaction score
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.

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.
 

bobby5589

Member
Reaction score
15
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.
 

SerraAvenger

Cuz I can
Reaction score
234
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.

Hmmm. Is there a way to simulate UI presses?
 

bobby5589

Member
Reaction score
15
I haven't seen any. So as far as I can say, this is undoable unless either that or more cursor support is added.
 

wingdnosring

New Member
Reaction score
16
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.
 

Nizlarath

New Member
Reaction score
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.

i dont think that is an acceptable method =P
 

wingdnosring

New Member
Reaction score
16
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 ;).
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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