• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Help with Trigger Command (If Possible)

Status
Not open for further replies.
Level 2
Joined
Mar 14, 2009
Messages
9
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
 
Level 14
Joined
Jun 15, 2016
Messages
749
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:
....
to show your code instead of pastebin.
 
Level 2
Joined
Mar 14, 2009
Messages
9
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...

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).
 
Level 2
Joined
Mar 14, 2009
Messages
9
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:
....
to show your code instead of pastebin.

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.
 
Level 2
Joined
Mar 14, 2009
Messages
9
Ah, I get it. So stack of spells will overwrite other's position when randomly adding them, correct? Unfortunately, no program can handle that complexity afaik.

However, depends on how unique of your spells are. You can try this temporary solution: Dummy and Order String. Understand what I mean?

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:
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 >.<
 
Level 2
Joined
Mar 14, 2009
Messages
9
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.

I need a check that works for the main Else Command because these aren't cutting it.

Code:
(Triggering unit) Equal to HeroGroups[1]
                        ((Triggering unit) has an item of type |c001CE6B9Mana Shield|r) Equal to True
                        ManaShield[1] Less than 11
 
Level 14
Joined
Jun 15, 2016
Messages
749
- 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:
Level 2
Joined
Mar 14, 2009
Messages
9
Code:
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
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
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.
You wonder why the problem is so common? If it were possible then it would not be a common problem.
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.
Such ability type spamming might be prone to degrading map load performance. Again why no one has done it before.
- 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.
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.
 
Level 14
Joined
Jun 15, 2016
Messages
749
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.

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)
 
Level 11
Joined
Jun 2, 2004
Messages
849
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.
 
Status
Not open for further replies.
Top