Adding Ability Trigger

TheCrystal

New Member
Reaction score
36
I've been working on this trigger for two days, and I'm beggining to loose it, I can't take it much more.. Here it is.

This is on Map Init, less lines of code and easier to fix if I figure out later I make a typo.
Code:
Player Group - Pick every player in (All players) and do (Actions)
    Loop - Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                Trigger - Add to HeroAbilityNames <gen> the event (Player - (Player((Integer A))) types a chat message containing 'hero as A substring)
                Trigger - Add to HeroAbilityNames <gen> the event (Player - (Player((Integer A))) types a chat message containing @hero as A substring)
So, that sets the Events.
Now, for the trigger itself.

Code:
Actions
    If ((Substring((Entered chat string), 6, (Length of (Entered chat string)))) Equal to acidbomb) then do (Set HeroAbilities = Acid Bomb) else do (Do nothing)
    If ((Substring((Entered chat string), 6, (Length of (Entered chat string)))) Equal to avatar) then do (Set HeroAbilities = Avatar) else do (Do nothing)

[COLOR="Red"] Etc[/COLOR], It's a long trigger.

    If ((Substring((Entered chat string), 6, (Length of (Entered chat string)))) Equal to trueshotaura) then do (Set HeroAbilities = Trueshot Aura) else do (Do nothing)
    If ((Substring((Entered chat string), 6, (Length of (Entered chat string)))) Equal to unholyaura) then do (Set HeroAbilities = Unholy Aura) else do (Do nothing)
    If ((Substring((Entered chat string), 6, (Length of (Entered chat string)))) Equal to vampiricaura) then do (Set HeroAbilities = Vampiric Aura) else do (Do nothing)
    If ((Substring((Entered chat string), 6, (Length of (Entered chat string)))) Equal to vengeance) then do (Set HeroAbilities = Vengeance) else do (Do nothing)
    If ((Substring((Entered chat string), 6, (Length of (Entered chat string)))) Equal to volcano) then do (Set HeroAbilities = Volcano) else do (Do nothing)
    If ((Substring((Entered chat string), 6, (Length of (Entered chat string)))) Equal to voodoospirits) then do (Set HeroAbilities = Voodoo Spirits) else do (Do nothing)
    If ((Substring((Entered chat string), 6, (Length of (Entered chat string)))) Equal to warstomp) then do (Set HeroAbilities = War Stomp) else do (Do nothing)
    If ((Substring((Entered chat string), 6, (Length of (Entered chat string)))) Equal to wateryminion) then do (Set HeroAbilities = Watery Minion) else do (Do nothing)
    If ((Substring((Entered chat string), 6, (Length of (Entered chat string)))) Equal to windwalk) then do (Set HeroAbilities = Wind Walk) else do (Do nothing)
    If (HeroAbilities Equal to Useless Ability (Shade)) then do (Skip remaining actions) else do (Do nothing)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Level of HeroAbilities for AAU) Equal to 0
        Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Substring((Entered chat string), 1, 5)) Equal to 'hero
                Then - Actions
                    Unit - Add HeroAbilities to AAU
                    Unit - Set level of HeroAbilities for AAU to 1
                Else - Actions
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Level of HeroAbilities for AAU) Less than or equal to 5
        Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Substring((Entered chat string), 1, 5)) Equal to 'hero
                Then - Actions
                    Unit - Set level of HeroAbilities for AAU to ((Level of HeroAbilities for AAU) + 1)
                Else - Actions
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Substring((Entered chat string), 1, 5)) Equal to @hero
        Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Level of HeroAbilities for AAU) Greater than or equal to 1
                Then - Actions
                    Unit - Remove HeroAbilities from AAU
                Else - Actions
        Else - Actions
    Set HeroAbilities = Useless Ability (Shade)

Anyways, that's the whole trigger I've used recently. The last if/thens are to check if the event is either @hero, which it removes the ability after @hero.
The first two are to check if it's 'heroABILITY, it checks if it's either A, unlearned which it adds it and sets it to 1, and if it already has it it adds one level to it.

So, I test it, it adds the Useless Ability and the ability I want it to add, the ability is already level 3 though, which shouldn't happen. So, I then type @heroABILITY, The ability and the useless ability is removed. After a couple of removing and adding abilities, it only removes the Useless ability, and if I type @heroABILITY again it removes the ability. Then it happens again, all over again.


I don't get why it would do this, I've tried it numerous times differently.
I've also tried this action.
Code:
If (((Substring((Entered chat string), 1, 5)) Equal to 'hero) and ((Level of HeroAbilities for AAU) Equal to 0)) then do (Unit - Add HeroAbilities to AAU) else do (If (((Substring((Entered chat string), 1, 5)) Equal to 'hero) and ((Level of HeroAbilities for AAU) Not equal to 0)) then do (Unit - Set level of HeroAbilities for AAU to ((Level of HeroAbilities for AAU) + 1)) else do (Do nothing))
It adds the ability to level two, if I try to upgrade it it gets all weird, the ability only shows effects, targets all, and has 0 range, 0 cooldown..

Code:
If ((Level of HeroAbilities for AAU) Greater than 0) then do (Unit - Set level of HeroAbilities for AAU to ((Level of HeroAbilities for AAU) + 1)) else do (If ((Level of HeroAbilities for AAU) Equal to 0) then do (Unit - Add HeroAbilities to AAU) else do (Do nothing))
Sometimes the same thing would happen, it adds it at level two and then it wont add it to the point it's all weird.

Code:
If (((Level of HeroAbilities for AAU) Equal to 0) and ((Substring((Entered chat string), 1, 5)) Equal to 'hero)) then do (Unit - Add HeroAbilities to AAU) else do (If ((Level of HeroAbilities for AAU) Less than or equal to 5) then do (Unit - Set level of HeroAbilities for AAU to ((Level of HeroAbilities for AAU) + 1)) else do (If (((Substring((Entered chat string), 1, 5)) Equal to @hero) and ((Level of HeroAbilities from AAU) else Do (Do Nothing)
I started out using this one.

Can anyone suggest to me a action/series of actions to do this?
And can you actually Null the Ability Variable? This may solve the Useless Ability adding problem.


Edit: I'll ALSO explain the purpos of the ability.
1, player types 'heroflamestrike
2. It adds the Hero Ability Flamestrike, level 1.
ERROR: Instead, it adds the Hero Ability Flamestrike, level 3, aswell as the Useless Ability (attempt at nulling the ability)
 

Builder Bob

Live free or don't
Reaction score
249
You're right, it's a long trigger. I can spot one mistake this far though.

When the following line is true
Code:
        If - Conditions
            (Level of HeroAbilities for AAU) Equal to 0
this line will also be true
Code:
        If - Conditions
            (Level of HeroAbilities for AAU) Less than or equal to 5
since you add the ability with the first, and increase it with the other, it will be set to two.

However, that doesn't explain how the abilities added are set to 3.

Try making better use of else, to see if that can help clear up some problems.
 

TheCrystal

New Member
Reaction score
36
I'm not sure what to do with the "Else", because I've made one condition with one action in the Then, it works, but if I added a second condition it was level 2.

I've re-arranged it, and about to test.

Alright, when I test it the Useless ability is added still, but a "Remove Useless Ability" at the Adding Section should fix that, right?

And it starts out level two, still.

Here's the modified version, just a added condition and a little rearrangement at the end.
Code:
    If (HeroAbilities Equal to Useless Ability (Shade)) then do (Skip remaining actions) else do (Do nothing)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Level of HeroAbilities for AAU) Greater than or equal to 1
            (Level of HeroAbilities for AAU) Less than or equal to 5
        Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Substring((Entered chat string), 1, 5)) Equal to 'hero
                Then - Actions
                    Unit - Set level of HeroAbilities for AAU to ((Level of HeroAbilities for AAU) + 1)
                Else - Actions
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Level of HeroAbilities for AAU) Equal to 0
        Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Substring((Entered chat string), 1, 5)) Equal to 'hero
                Then - Actions
                    Unit - Add HeroAbilities to AAU
                    Unit - Set level of HeroAbilities for AAU to 1
                Else - Actions
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Substring((Entered chat string), 1, 5)) Equal to @hero
        Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Level of HeroAbilities for AAU) Greater than or equal to 1
                Then - Actions
                    Unit - Remove HeroAbilities from AAU
                Else - Actions
        Else - Actions
    Set HeroAbilities = Useless Ability (Shade)

Edit: Now it's gone back to level 3. . .
Edit2: Just thought you should know, useless ability is now based off Attribute Bonus, 0 stats, 5 levels (since sometimes the ability gets weirded out), and is hidden upon given to the unit.
 

TheCrystal

New Member
Reaction score
36
I don't need that Pick every player in all player do I? Lol, I see your point.

Anyways, i re-arranged the triggers once more, as I said in my other post, changed Useless Ability to a "Unseeable" ability (Attribute bonus).

Code:
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Level of HeroAbilities for AAU) Greater than or equal to 1
            (Level of HeroAbilities for AAU) Less than or equal to 5
        Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Substring((Entered chat string), 1, 5)) Equal to 'hero
                Then - Actions
                    Unit - Set level of HeroAbilities for AAU to ((Level of HeroAbilities for AAU) + 1)
                Else - Actions
        Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Substring((Entered chat string), 1, 5)) Equal to 'hero
                Then - Actions
                    Unit - Add HeroAbilities to AAU
                    Unit - Set level of HeroAbilities for AAU to 1
                    Unit - Set level of HeroAbilities for AAU to 1
                Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Substring((Entered chat string), 1, 5)) Equal to @hero
        Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Level of HeroAbilities for AAU) Greater than or equal to 1
                Then - Actions
                    Unit - Remove HeroAbilities from AAU
                Else - Actions
        Else - Actions
    Set HeroAbilities = Useless ability




Nevermind Yall, Aceheart found out the problem. The event occures twice when a player does it, so it caused the problem.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top