Dynamically placed buttons

Discussion in 'Starcraft 2 (SC2) Editor Help' started by Siretu, Feb 2, 2012.

  1. Siretu

    Siretu Starcraft 2 Editor Moderator Staff Member

    Ratings:
    +295 / 0 / -0
    Okay, dynamically might be the wrong word. Here's what I am trying to do:

    A unit has an inventory. The items can give abilities that only show up if you have the item. The problem is that there will be a lot of items, more than there are slots on the command card so a button has to be able to appear in several places.

    Now I could do this in several ways but all ways I can think of are incredibly messy and takes a lot of extra work.

    First of all, I'm pretty sure I have to add the button of all abilities to all slots where they can appear. I then have to make sure I only show one of the buttons of the same abilities and only if the unit has that item.

    If anyone could think up a good solution for this, I'd be grateful.

    If you have a solution that includes triggers, that's fine too but I prefer data.
     
  2. GFreak45

    GFreak45 I didnt slap you, i high 5'd your face.

    Ratings:
    +132 / 0 / -0
    have you considered making dialog buttons and positioning them correctly to simulate buttons? that way you could move them arround as you please
     
  3. Kyuft

    Kyuft Member

    Ratings:
    +11 / 0 / -0
    Now, Siretu needs help? I thought he was perfect?
    Lol JK.

    -Kyuft:shades:
     
  4. GFreak45

    GFreak45 I didnt slap you, i high 5'd your face.

    Ratings:
    +132 / 0 / -0
    IKR? "When i shit gold" just happened.
     
  5. Kyuft

    Kyuft Member

    Ratings:
    +11 / 0 / -0
    Wait... that's not normal?
    And Siretu, you will probably have to do something with triggers and custom functions. Something like,
    If
    That slot on the card is not full,
    then put it there
    else,
    put it somewhere else.

    -Kyuft:shades:
     
  6. Siretu

    Siretu Starcraft 2 Editor Moderator Staff Member

    Ratings:
    +295 / 0 / -0
    I am usually very good at finding the answer myself so I rarely ask for help.

    The problem with doing this with triggers(if I don't do it with dialogs as GFreak suggested, which by the way is a solution but it's not a good one) is that there's no way that I know of to interact with the command card with triggers.
     
  7. GFreak45

    GFreak45 I didnt slap you, i high 5'd your face.

    Ratings:
    +132 / 0 / -0
    ???
    you mean you cant use the command card natives?
     
  8. Siretu

    Siretu Starcraft 2 Editor Moderator Staff Member

    Ratings:
    +295 / 0 / -0
    Care to elaborate?
     
  9. GFreak45

    GFreak45 I didnt slap you, i high 5'd your face.

    Ratings:
    +132 / 0 / -0
    the trigger actions dealing with command cards, ie: Disable Command Card, etc.
     
  10. Kyuft

    Kyuft Member

    Ratings:
    +11 / 0 / -0
    If i remember correctly, there is a few command card actions. However, I cannot remember where i saw them.

    -Kyuft:shades:
     
  11. Dave312

    Dave312 Censored for your safe viewing

    Ratings:
    +269 / 0 / -0
    I think you may be thinking of Enable/Disable Command Type which is used for disabling ability commands. I recall no functions/actions that deal directly with the command card.
     
  12. Jokker

    Jokker Member

    Ratings:
    +16 / 0 / -0
    Depends on how many abilities there are...
    If you don't want to mess around with buttons at all, you could add a hotkey in item description, so it would be activated with hotkeys only.
     
  13. Dave312

    Dave312 Censored for your safe viewing

    Ratings:
    +269 / 0 / -0
    Have you tried using the Catalog function to set the positions of the buttons? That would probably be the easiest way of doing it (if it works).
     
  14. Siretu

    Siretu Starcraft 2 Editor Moderator Staff Member

    Ratings:
    +295 / 0 / -0
    I actually thought of using the catalog functions yesterday and spent a lot of time yesterday trying to get it to work and I didn't want to post about it until I was sure it'd work.

    From my testings, it seems like moving the positions of buttons is not allowed(since catalog field value set has some fields it can't set because they're protected). What I did instead was to have 6 dummy buttons and 6 dummy abilities. One for each slot. I can then keep track of which items the unit has and change the name and description of the dummy abilities to reflect that.

    This works as of now. If I have 3 of item A and 3 of item B, I'll get one button(not 3) for ability A and one button for ability B.

    There are still some problems though that I think I can solve but which will take some time. Right now, the dummy abilities are all of the type "Effect - instant". I need some abilities to be "Effect - Target". I can't change the type so I probably need to have 6 more abilities and switch between them. There's also the problem that my "Effect - target" abilities can either have a unit target or a point target and I wasn't able to change between the two with catalog set. This means I'll probably need 6 more abilities(18 in total, sigh). Fortunately, it's still just a constant amount of work and adding a new item wont be a ton of work when the initial work is done.

    There's one final thing I also have to do, I have to make a dialog overlay with images for the buttons since unfortunately, "Catalog field value set" can't modify the icon of a button so I'll just skip the icon for the button and do it with dialogs.

    The reason I cant do the entire thing in dialogs is that some abilities require targeting and if I press an ability that requires a target, I can't by triggers get it to enter the targeting mode. I could fake it and overlay a picture of a target cursor on the cursor and change everything but that'd be stupid.
     
  15. Dave312

    Dave312 Censored for your safe viewing

    Ratings:
    +269 / 0 / -0
    What about using the Command Card: Level Button Image property on the dummy abilities to set the button image and setting the ability level to 2? With any luck you will have access to that.

    Sounds like no matter which way you do it, it is going to be a lot of work. I wonder whether it might just be easier to scrap the command card and use an inventory to act as one instead.
     

Share This Page