Clicking System for Hack'n'Slay

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

  1. Sensang

    Sensang TH.net Regular

    Ratings:
    +7 / 0 / -0
    Hey there,

    hopefully someone can help me out here.
    Trigger:
    • ClickedLMB
      • Events
        • UI - Player Any Player clicks Left mouse button Down.
      • Local Variables
        • RegionClicked = (Region((Point((Mouse X position clicked in the world), (Mouse Y position clicked in the world))), 1.0)) <Region>
      • Conditions
      • Actions
        • Region - Move RegionClicked to (Point((Mouse X position clicked in the world), (Mouse Y position clicked in the world)))
        • General - If (Conditions) then do (Actions) else do (Actions)
          • If
            • (Number of Living units in (Units in RegionClicked having alliance Enemy with player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most 1)) == 1
          • Then
            • Variable - Set LMBClicked[(Triggering player)][1] = true
            • Variable - Set LMBClicked[(Triggering player)][0] = false
          • Else
            • Unit - Order CameraUnit[(Triggering player)] to ( Move targeting (Point((Mouse X position clicked in the world), (Mouse Y position clicked in the world)))) (Replace Existing Orders)
            • Variable - Set LMBClicked[(Triggering player)][1] = false
            • Variable - Set LMBClicked[(Triggering player)][0] = true
        • Unit Group - Pick each unit in (Units in RegionClicked having alliance Enemy with player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most 1) and do (Actions)
          • Actions
            • General - While (Conditions) are true, do (Actions)
              • Conditions
                • ((Picked unit) is alive) == true
                • LMBClicked[(Triggering player)][1] == true
              • Actions
                • Unit - Order CameraUnit[(Triggering player)] to (Ghost - Sniper Round (Picked unit)) (Replace Existing Orders)
                • General - Wait AttackCD[(Triggering player)] Game Time seconds


    I can't think of anything better to get this working without selecting the units i click on. I don't want that cuz it doesn't look nice and I want this system to work with the right mouse button too.

    Just a few issues:

    1. My biggest problem right now is to turn off that rectangle being drawn when I hold the left mouse button down. (How) can i change that?

    2. And someone plz tell me if theres a way to get the mouse position without clicking. (I know the general assumption is that it can't be done, if you know better, plz let me know)

    3. Could someone tell me how I stop my ghost from fleeing? I can't find the field for it in the data editor...

    As soon as I have this system done I will release the map for people to learn from it. Atm it's working quite smooth... which kind of surprises me^^
     
  2. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    You could try changing the event to "left mouse button is pressed up". Basically, it would only run the trigger when you release the left mouse button instead of pressing it down. But I have a feeling that's not what you're looking for if you want to be able to hold the button down for a different effect.

    Another option would be to have a trigger for the left mouse button being clicked down and another for it being released. You could simply gauge the time between them and not run your trigger if it has been greater than x time.

    Blizzard may be intending to release support for this feature along with the retail version of the game. Nobody knows that for sure, but at the moment it is impossible unless you use your mouse to move the camera (Lock Camera Mouse Relative Mode).

    Go to your unit in the data editor. It's the 'Abilities - Response' field. You can set it to flee, acquire, or no response. I assume you'll want no response.
     
  3. Sensang

    Sensang TH.net Regular

    Ratings:
    +7 / 0 / -0
    thx.

    Maybe I wasn't clear on the 1.:

    I want to be able to continuously attack an enemy while the mouse is pressed down. I would love to add a feature that lets you walk at your mouse position as long as the left mouse button is down, too. So basically I want this to be 100% as in a Hack'n'Slay game. (Diablo 2 is my main reference here)

    As far as I know the moving to mouse position while left mouse button is down isn't possible without knowing it's position :p

    However the continuous attack is possible. But when i hold the left mouse button down I also draw a rectangle, which I could ignore ofc since the units are unselectable^^

    It just doesn't look that nice... But it works: My hero keeps attacking the enemy as long as the left mouse button is being pressed down.


    Ok now another question. Can I turn off that the Zealot fights back without taking away his weapon?
    It would work with abilities too just weapons are a little nicer to handle...
     
  4. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    Yeah, alter this field for the zealot: Abilities - Response

    I wasn't following what you were talking about with the mouse, but now I get it. That's a difficult problem that I'm not sure can be rectified.

    You may be able to import an image that is completely blank/invisible and replace the texture used for the mouse drag boxes. This may hide the selection effect.

    As for detecting the mouse for moving: no it is not possible the way you're suggesting. Alot of people are looking for this though, so I wouldn't be surprised if Blizzard added full mouse support at a later date.
     
  5. Sensang

    Sensang TH.net Regular

    Ratings:
    +7 / 0 / -0
    ok thx for your help again.
    Dearly I have no idea how i could adress the texture of the drag box.
    I really hope Blizzard will grant us a few more features with the retail or at least with the addons...
     
  6. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    Well, retail will definitely have more to it. If nothing else, we know the editor keeps trying to access game files that aren't in the beta. And the full game will be about 16gb (I think?) while the beta is only 2.

    Create an action in a trigger with a fade filter. When it asks you to select the texture to fade in (or out) search for 'ui'. The list may be massive, but somewhere in there you'll see the texture you're looking for (the drag box texture). Once you know its name, import a blank texture file (or a texture that is max alpha, so it's invisible) and place it in the map with the same name.

    Please be aware that I have not tried this. I'm just assuming this will work because it was how Warcraft importing was implemented. Try it at your own peril :p.
     
  7. Sensang

    Sensang TH.net Regular

    Ratings:
    +7 / 0 / -0
    I don't know if this deserves another thread so I just wanted to ask right here (It's bugging me for hours now -.-)

    Trigger:
    • DialogIsClicked
      • Events
        • Dialog - Any Dialog Item is Clicked by Player Any Player
      • Local Variables
        • I = 0 <Integer>
        • P = (Triggering player) <Integer>
      • Conditions
      • Actions
        • General - If (Conditions) then do (Actions) else do (Actions)
          • If
            • (Used dialog item) == ChooseHero[P][I]
          • Then
            • HeroIsChosen(I, P, HeroType[I])
          • Else

    Trigger:
    • Dialog - Create a Button for Dialog ChooseHeroDialog[P] with the dimensions (161, 244) anchored to Bottom Left with an offset of ((OffsetX + 40), (OffsetY + 65)) setting the tooltip to ("Choose " + (Name of HeroType[I])) with button text " " and the hover image set to ""
      • Variable - Set ChooseHeroButton[P][I] = (Last created dialog item)


    Ive alreade checked which values I and P are by displaying them, same with the triggers that define the ChooseHero[][] Dialog-button array.

    And I have no clue why it always chooses ELSE.
    Basically i know that the I and P from the trigger that creates the dialog-button array and the I and P from the trigger that checks if a clicked dialog button was that button the same. So anyone has an idea?

    I've attached the map. If anyone could take a look at it plz.
    The things to look at are in the library "Hack'n'Slay System"!
    The triggers: Setup, DialogIsClicked; the Actions: CreateChooseHeroDialog, CreateHeroChooseButton.

    I guess it's not too complicated for someone else, but I might be wrong.
    The whole concept of it is for a noob or someone who is lazy to change as much as possible by as few clicks as possible.
     

    Attached Files:

  8. Sensang

    Sensang TH.net Regular

    Ratings:
    +7 / 0 / -0
    Ok, I've figured it out... I showed the dialog to all players instead of just to one...

    so i clicked on another players dialog.
    Damn I just wasted hours of figuring out for that crap :banghead:

    cheers
     
  9. jleips2600

    jleips2600 New Member

    Ratings:
    +4 / 0 / -0
    Just a FYI in case you haven't explored it yet and were interested in messing around with it to see what you could produce, I just noticed there was a 'ClickResponse' behavior... I haven't dug too much into it, but perhaps if you were interested in doing it through the data editor, that could open up some possibilities~
     
  10. Sensang

    Sensang TH.net Regular

    Ratings:
    +7 / 0 / -0
    thx a lot :thup:

    Nevertheless, I don't think this will do anything for me. As far as I can see it just recognizes clicks on the unit with the behavior. I think it's impossible to give the behavior to an enemy and recognize the click so you can order your unit to attack it.

    Atm I'm figuring out a way to do it with selection again. But the drag box that you get when you hold the left mouse button down and move it, is a pain in the ass to deal with. because when you work with clicks it doesnt matter whether or not you actually select something within that dragbox...
    When you work with selection it kind of does^^

    On the other hand the click system appears to lag oO
    But in the end I will need the click event either, simply because otherwise you can't move when you click terrain^^

    So if someone figures out a way to remove that dragbox PLEASSE!!! tell me ...
     
  11. jleips2600

    jleips2600 New Member

    Ratings:
    +4 / 0 / -0
    Maybe you could try hiding the mouse cursor in the Mouse Click DOWN event, and show it again in the Mouse Click UP event?
     
  12. jleips2600

    jleips2600 New Member

    Ratings:
    +4 / 0 / -0
    I got sucked into playing around with the hack and slash idea (avid arpg/diablo fan, but who isn't?) and this is how I ended up putting it together!


    Right click (and hold) to move or attack!! Maybe you can find something useful in my wasted 45 minutes~ xD
     

    Attached Files:

  13. formerself

    formerself New Member

    Ratings:
    +3 / 0 / -0
    Yeah, lots of people are making this type of map, including myself. Unfortunately, I can't play your (Original poster's) map as everything in the trigger section is disabled and links to variables and other triggers are missing.

    Instead of making my own thread, I'll just add some questions to this one.

    1. The selection rectangle. It's annoying, but as there is no way to detect mouse position without clicking I don't really need to get rid of it.

    2. Health bars. I can't find a way to get rid of them completely. I don't want them to show when the mouse is over a unit (since I copied the diablo style health bar of enemy units) and I don't want them to show if pressing alt.

    3. Setting the camera to follow with an offset. I want the hero to appear a bit further up on the screen. I can do it with a timer, but maybe someone knows a way to do it without one?
     
  14. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    I believe I mentioned this earlier in this thread, but I theorize that importing a blank texture, or one that is completely alphad out to replace the selection box model/texture, may work.

    Force Unit Status Bar Off. It doesn't seem to work for me, but others have managed to get it working.

    There are quite a few people looking into this on my third person shooter thread. I have it working right now, but its very jerky and I keep getting complaints. I suspect you could make the camera follow either a hidden or incredibly small unit. Then you move this incredibly small unit to your player's unit with an offset evry 0.06 seconds or so.
     
  15. formerself

    formerself New Member

    Ratings:
    +3 / 0 / -0
    I've tried modifying textures, but most of the software or plugins seem to lack support for a 64-bit windows (or maybe it's just my computer being messed up). Might have to get myself an older version of photoshop just so I can use the plugins. I might just wait and see if the improved galaxy editor will have an option to remove the selection box.

    EDIT: Looked through the whole ui texture list and I couldn't find a single one matching the selection box. Either it's hidden somewhere very well, or it's coded without using a graphic file. Can't find anything in the data editor either.


    Not working for me either, assuming I am using it right. Tried setting the bar to off when creating all units and also tried setting them to off on unit highlighting.

    After writing the above, I looked in the data editor a bit and found the solution. In the unit actor, edit the field UI - Status Bar Flags. That'll turn them off and they cannot be displayed by pressing ALT.


    As i'm doing top-down view without any actual fast camera movements, I can just pan the camera with an offset and a timer (only active on hero movement). Not the way I wanted to solve it, but unless there is some other way, it'll have to do.
     
  16. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    Ahh, thanks for finding the flags. I'm sure you can edit that selection box somehow...maybe with the full retail version.

    An offset is the way I've got mine set up too. As I said though, you could set the camera to follow an incredibly small unit that constantly moves beside your character. If the offset works for you though, then go with that. No point changing what works.
     
  17. Sensang

    Sensang TH.net Regular

    Ratings:
    +7 / 0 / -0
    Have you started the map once? I've imported a whole lot of triggers to learn from. Those are actually disabled... But as i said in my post, the important thing is the HackNSlay library and that thing works. Although I've changed it a little since then. But not too much... I'm actually waiting for the release to see the full capabilities of the editor before I waste any more time on a system that might just not work cuz click events are laggy as hell. And I really wonder if they wont support mouse pointing at all...

    That would be so tragic for maps like that :banghead:
     

Share This Page