Trouble building with custom ui

Nizlarath

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

Ancanus

[ancanus@TheHelper.net]# _
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
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
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;;
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
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
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
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
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
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
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
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.
  • Ghan Ghan:
    Test!
  • tom_mai78101 tom_mai78101:
    I must be in a test server.
  • tom_mai78101 tom_mai78101:
    Nice, Twitter tweets embedding now works
  • Wizard Wizard:
    Yup.
  • Ghan Ghan:
    Excellent.
  • Ghan Ghan:
    @tom_mai78101 Hello there.
  • Ghan Ghan:
    Tagging works in the chat too.
  • tom_mai78101 tom_mai78101:
    @Ghan Missed it.
  • Wizard Wizard:
    Still fixing things here and there. Added widgets to the portal, will make it match the ones here on the forum index tomorrow.
  • Ghan Ghan:
    The venerable World Editor Tutorials site has been converted to HTTPS at last.
  • jonas jonas:
    cool
  • jonas jonas:
    and I can even edit my messages, nice
  • seph ir oth seph ir oth:
    GENERAL CHIT CHAT, YOU ARE A BOLD ONE
  • Ghan Ghan:
    Hello there
  • The Helper The Helper:
    this new chatbox is great and the forum software update is great too
    +1
  • The Helper The Helper:
    upgrade has fixed forum registration spam problem
  • tom_mai78101 tom_mai78101:
    Something tells me we might be able to customize the chatbox a bit, considering that there's a gap under every message.
  • Wizard Wizard:
    Going to deploy a fix soon, just had to take some time for myself this weekend.
  • Varine Varine:
    Unbelievable. Time for yourself? How dare you!
  • Wizard Wizard:
    xD
  • tom_mai78101 tom_mai78101:
    Hm, it is now harder to type anything on an Android phone. Pressing Backspace or Enter keys will dismiss the Android keyboard for some reasons.
  • tom_mai78101 tom_mai78101:
    Just noticed there's a delay of at least 2 minutes before each post. Guess I can't post Headline News quickly as I used to.
  • tom_mai78101 tom_mai78101:
    As far as I can tell, there are definitely things I need to get accustomed to first.
  • Varine Varine:
    FCC is cracking down recently

    Members online

    No members online now.

    Affiliates

    Hive Workshop
    Top