1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[General] Help with Trigger Command (If Possible)

Discussion in 'World Editor Help Zone' started by Unitonia, Jun 16, 2018.

Tags:
  1. Unitonia

    Unitonia

    Joined:
    Mar 14, 2009
    Messages:
    9
    Resources:
    0
    Resources:
    0
    I'm trying to make a Custom Hero Survival with proper hotkeys. For example, If the skill is in Position X 0 and Y 0 then it'll have Hotkey Q, if it's in position X 1 and Y 0 then it'll have Hotkey W.

    I'm not sure how to change an abilities hotkey to what I want it to be. (I was hoping CustomHotkeys.txt would work however, it doesn't seem to work for custom games.) If I could get this to work I could clean up my code a lot more and make the hotkey be set depending on where the skill is on the X,Y axis in my heroes abilities.

    Thanks a lot for any help!

    Here's my code so far.
    Can I use a trigger to adjust a skills Activate and De-activate hotkeys? | HIVE

    My code doesn't have to change the skill description if I'm able to make sure the hotkeys are consistent with where they are positioned in the heroes abilities. So I'll be able to delete a lot of the random junk I have in there LOL
     
  2. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,205
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    No you can't change hotkeys of abilities with triggers if that's what you're asking, anyway I don't see any purpose to modify the hotkey and its position at same time several times...
     
  3. Unregret

    Unregret

    Joined:
    Jun 15, 2016
    Messages:
    748
    Resources:
    1
    Maps:
    1
    Resources:
    1
    You just need to change skill positions and hotkeys right inside object data editor (In your case, it's custom Mana Shield). No need to make things too complicated for you.

    By the way, you can write down:
    Code (Text):
    ....
    to show your code instead of pastebin.
     
  4. Unitonia

    Unitonia

    Joined:
    Mar 14, 2009
    Messages:
    9
    Resources:
    0
    Resources:
    0
    The reason I was trying to adjust them was because I want heroes to be able to buy their abilities. And one of the common problems I notice in Custom Hero Survivals is you end up having 2-3 abilities that have the same hotkey, or the hotkeys make no sense whatsoever. I found a Ghetto fix which is making 7 skills all with different hotkeys and having a series of really complicated checks to confirm which skill to give you (and to make sure you can't get the same skill twice). It's a mess however, it's working I guess... just wish there was a more intuitive way.

    Here's the Ghetto Fix:
    Example of Troll Code | HIVE

    And I have 6 other versions of this for the six other Mana Shields (with hotkeys being Q (X0, Y2), W (X1, Y2), E (X2, Y2), R (X3, Y2), D (X1, Y1), F (X2, Y1), G (X3, Y1).
     
  5. Unitonia

    Unitonia

    Joined:
    Mar 14, 2009
    Messages:
    9
    Resources:
    0
    Resources:
    0
    Yea but how do I do that when I'm making a shop that sells you spells? If I wasn't going to have over 100 + Spells this would be much easier however, I'm not entirely sure how to do this besides creating 7 versions of every spell I have with different hotkeys.
     
  6. Unitonia

    Unitonia

    Joined:
    Mar 14, 2009
    Messages:
    9
    Resources:
    0
    Resources:
    0
    I kinda found a solution (but it's messing with me for some reason... and I'm not sure why lmfao). Also I don't know what you mean by the dummy + order string :( I haven't used the editor since like 2011 I just got back into it recently and forgot A TON OF STUFF.

    Code (Text):
    Mana Shield Q
        Events
            Unit - A unit Acquires an item
        Conditions
        Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Triggering unit) Equal to HeroGroups[1]
                    ((Triggering unit) has an item of type |c001CE6B9Mana Shield|r) Equal to True
                    ManaShield[1] Less than 11
                    AbilitiesLearned[1] Equal to 1
                Then - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            ManaShield[1] Equal to 1
                        Then - Actions
                            Unit - Add Mana Shield |cffffcc00(Q)|r  to HeroGroups[1]
                            Unit - Set level of Mana Shield |cffffcc00(Q)|r  for HeroGroups[1] to ManaShield[1]
                            Set ManaShield[1] = (ManaShield[1] + 1)
                            Set AbilitiesLearned[1] = (AbilitiesLearned[1] + 1)
                            Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                            Trigger - Turn off Mana Shield W <gen>
                            Trigger - Turn off Mana Shield E <gen>
                            Trigger - Turn off Mana Shield R <gen>
                            Trigger - Turn off Mana Shield D <gen>
                            Trigger - Turn off Mana Shield F <gen>
                            Trigger - Turn off Mana Shield G <gen>
                        Else - Actions
                            Do nothing
                Else - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            (Triggering unit) Equal to HeroGroups[1]
                            ((Triggering unit) has an item of type |c001CE6B9Mana Shield|r) Equal to True
                            ManaShield[1] Less than 11
                        Then - Actions
                            Unit - Set level of Mana Shield |cffffcc00(Q)|r  for HeroGroups[1] to ManaShield[1]
                            Set ManaShield[1] = (ManaShield[1] + 1)
                            Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                        Else - Actions
                            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                If - Conditions
                                    (Item-type of (Item being manipulated)) Equal to |c001CE6B9Mana Shield|r
                                Then - Actions
                                    Player - Add 100 to Player 1 (Red) Current lumber
                                    Game - Display to Player Group - Player 1 (Red) the text: You've already maxe...
                                    Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                                Else - Actions
                                    Do nothing

    Mana Shield W
        Events
            Unit - A unit Acquires an item
        Conditions
        Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Triggering unit) Equal to HeroGroups[1]
                    ((Triggering unit) has an item of type |c001CE6B9Mana Shield|r) Equal to True
                    ManaShield[1] Less than 11
                    AbilitiesLearned[1] Equal to 2
                Then - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            ManaShield[1] Equal to 1
                        Then - Actions
                            Unit - Add Mana Shield |cffffcc00(W)|r  to HeroGroups[1]
                            Unit - Set level of Mana Shield |cffffcc00(W)|r  for HeroGroups[1] to ManaShield[1]
                            Set ManaShield[1] = (ManaShield[1] + 1)
                            Set AbilitiesLearned[1] = (AbilitiesLearned[1] + 1)
                            Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                            Trigger - Turn off Mana Shield Q <gen>
                            Trigger - Turn off Mana Shield E <gen>
                            Trigger - Turn off Mana Shield R <gen>
                            Trigger - Turn off Mana Shield D <gen>
                            Trigger - Turn off Mana Shield F <gen>
                            Trigger - Turn off Mana Shield G <gen>
                        Else - Actions
                            Do nothing
                Else - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            (Triggering unit) Equal to HeroGroups[1]
                            ((Triggering unit) has an item of type |c001CE6B9Mana Shield|r) Equal to True
                            ManaShield[1] Less than 11
                        Then - Actions
                            Unit - Set level of Mana Shield |cffffcc00(W)|r  for HeroGroups[1] to ManaShield[1]
                            Set ManaShield[1] = (ManaShield[1] + 1)
                            Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                        Else - Actions
                            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                If - Conditions
                                    (Item-type of (Item being manipulated)) Equal to |c001CE6B9Mana Shield|r
                                Then - Actions
                                    Player - Add 100 to Player 1 (Red) Current lumber
                                    Game - Display to Player Group - Player 1 (Red) the text: You've already maxe...
                                    Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                                Else - Actions
                                    Do nothing

    Set Variable
        Events
            Player - Player 1 (Red) types a chat message containing -Skill as An exact match
        Conditions
        Actions
            Set AbilitiesLearned[1] = (AbilitiesLearned[1] + 1)
     
    Just so you know what you're looking at... I have it adding 1 to an integer variable called AbilitiesLearned so I know how many skills I already know (So I know which ability hotkey to give them). I have 5 other versions of this code however, I felt like giving you 2 examples is probably good enough since the others are more or less the same just with a different spell being learned.

    The one problem I'm having is... when I make AbilitiesLearned = 2 forcibly with the trigger I have at the very end it's not giving me Mana Shield (W) when it should be... and I'm not exactly sure why.


    I wish it gave me the option to change a skills hotkey through a trigger AHHHHH. This would be so much easier... I can change a skills tooltip however, hotkey is a no go lmfao (WE NEED WC4!!!)



    Edit: Hmm... actually now that I'm looking at it more... I think it has something to do with my 2nd Else Command... but I'm not sure exactly how to fix this >.<
     
  7. Unitonia

    Unitonia

    Joined:
    Mar 14, 2009
    Messages:
    9
    Resources:
    0
    Resources:
    0
    I need a check that works for the main Else Command because these aren't cutting it.

    Code (Text):
    (Triggering unit) Equal to HeroGroups[1]
                            ((Triggering unit) has an item of type |c001CE6B9Mana Shield|r) Equal to True
                            ManaShield[1] Less than 11
     
  8. Unregret

    Unregret

    Joined:
    Jun 15, 2016
    Messages:
    748
    Resources:
    1
    Maps:
    1
    Resources:
    1
    - You create 7 custom blank spells. Name: Q, W, E,.... for your hero.
    - Create 7 different dummies which will remain forever on the map when the map start.
    - When you sell a spell in your shop (it have to have a unique order string), for each integer from 1 to 7, set it to Q, W, E... and add that spell to your corresponding number-dummy.
    - Set tooltips of 7 custom blank spell, based on each sold spell.
    - When you cast one of 7 blank spells. Order dummy to move instant to your location and cast that spell for you instead.

    :3 You will understand what I mean, Because Spell Steal in Dota also follow almost the same rule. :3
     
    Last edited: Jun 17, 2018
  9. Unitonia

    Unitonia

    Joined:
    Mar 14, 2009
    Messages:
    9
    Resources:
    0
    Resources:
    0
    Code (Text):
    Mana Shield Q
        Events
            Unit - A unit Acquires an item
        Conditions
            AbilitiesLearned[1] Equal to 1
        Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Triggering unit) Equal to HeroGroups[1]
                    ((Triggering unit) has an item of type |c001CE6B9Mana Shield|r) Equal to True
                    ManaShield[1] Less than 11
                    AbilitiesLearned[1] Equal to 1
                Then - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            ManaShield[1] Equal to 1
                        Then - Actions
                            Unit - Add Mana Shield |cffffcc00(Q)|r  to HeroGroups[1]
                            Unit - Set level of Mana Shield |cffffcc00(Q)|r  for HeroGroups[1] to ManaShield[1]
                            Set ManaShield[1] = (ManaShield[1] + 1)
                            Set AbilitiesLearned[1] = (AbilitiesLearned[1] + 1)
                            Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                            Trigger - Turn off Mana Shield W <gen>
                            Trigger - Turn off Mana Shield E <gen>
                            Trigger - Turn off Mana Shield R <gen>
                            Trigger - Turn off Mana Shield D <gen>
                            Trigger - Turn off Mana Shield F <gen>
                            Trigger - Turn off Mana Shield G <gen>
                        Else - Actions
                            Do nothing
                Else - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            (Triggering unit) Equal to HeroGroups[1]
                            ((Triggering unit) has an item of type |c001CE6B9Mana Shield|r) Equal to True
                            ManaShield[1] Less than 11
                            ManaShield[1] Greater than 1
                        Then - Actions
                            Unit - Set level of Mana Shield |cffffcc00(Q)|r  for HeroGroups[1] to ManaShield[1]
                            Set ManaShield[1] = (ManaShield[1] + 1)
                            Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                        Else - Actions
                            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                If - Conditions
                                    (Item-type of (Item being manipulated)) Equal to |c001CE6B9Mana Shield|r
                                Then - Actions
                                    Player - Add 100 to Player 1 (Red) Current lumber
                                    Game - Display to Player Group - Player 1 (Red) the text: You've already maxe...
                                    Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                                Else - Actions
                                    Do nothing

    Mana Shield W
        Events
            Unit - A unit Acquires an item
        Conditions
        Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Triggering unit) Equal to HeroGroups[1]
                    ((Triggering unit) has an item of type |c001CE6B9Mana Shield|r) Equal to True
                    ManaShield[1] Less than 11
                    AbilitiesLearned[1] Equal to 2
                Then - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            ManaShield[1] Equal to 1
                        Then - Actions
                            Unit - Add Mana Shield |cffffcc00(W)|r  to HeroGroups[1]
                            Unit - Set level of Mana Shield |cffffcc00(W)|r  for HeroGroups[1] to ManaShield[1]
                            Set ManaShield[1] = (ManaShield[1] + 1)
                            Set AbilitiesLearned[1] = (AbilitiesLearned[1] + 1)
                            Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                            Trigger - Turn off Mana Shield Q <gen>
                            Trigger - Turn off Mana Shield E <gen>
                            Trigger - Turn off Mana Shield R <gen>
                            Trigger - Turn off Mana Shield D <gen>
                            Trigger - Turn off Mana Shield F <gen>
                            Trigger - Turn off Mana Shield G <gen>
                        Else - Actions
                            Do nothing
                Else - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            (Triggering unit) Equal to HeroGroups[1]
                            ((Triggering unit) has an item of type |c001CE6B9Mana Shield|r) Equal to True
                            ManaShield[1] Less than 11
                            ManaShield[1] Greater than 1
                        Then - Actions
                            Unit - Set level of Mana Shield |cffffcc00(W)|r  for HeroGroups[1] to ManaShield[1]
                            Set ManaShield[1] = (ManaShield[1] + 1)
                            Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                        Else - Actions
                            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                If - Conditions
                                    (Item-type of (Item being manipulated)) Equal to |c001CE6B9Mana Shield|r
                                Then - Actions
                                    Player - Add 100 to Player 1 (Red) Current lumber
                                    Game - Display to Player Group - Player 1 (Red) the text: You've already maxe...
                                    Item - Remove (Item carried by HeroGroups[1] of type |c001CE6B9Mana Shield|r)
                                Else - Actions
                                    Do nothing
     
    Just posting this to show someone else don't mind this xD
     
  10. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,695
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    You wonder why the problem is so common? If it were possible then it would not be a common problem.
    Such ability type spamming might be prone to degrading map load performance. Again why no one has done it before.
    This, except for some abilities you can give them to the hero instead of the dummy and order the hero to cast them. By setting the command card button of an ability to -1,-1 it will not show in the command card but units can still be ordered to cast it by triggers.

    One might also need 3 different sets of the 7 dummy abilities. One for instant cast, one for point cast and one for unit target cast. Even more sets may be needed for more complex targeting logic such as point and unit or only certain units.
     
  11. Unregret

    Unregret

    Joined:
    Jun 15, 2016
    Messages:
    748
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I agree. Still, the downside of this system is you cannot have custom spell icons showing in your hero. It's still better than create 7 different versions of each spell, though.
    I hope he understand about order string, before it's too late. (when he realize that spells with same order string will cast at the same time when only one of them casting)
     
  12. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,207
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Others and I have done this, too, already, duplicating abilities for hotkeys.
     
  13. Kaijyuu

    Kaijyuu

    Joined:
    Jun 2, 2004
    Messages:
    848
    Resources:
    0
    Resources:
    0
    A more realistic fix may in fact be to only have dummy abilities on the hero.

    The new natives let you change icons and tooltips. You make 21 dummy abilities (7 unit, 7 point, and 7 no target) times the number of player slots, hand those to the player, and trigger all the effects.

    This is still a godawful number of abilities but probably less than 7x your entire ability roster, which for a custom hero map is usually 60+ abilities.

    EDIT: Actually one hiccup would be area targeted spells, since you can't dynamically modify their area of effect via triggers. Standardizing aoe across all abilities would probably not affect gameplay balance much though.