• 🏆 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!

[Solved] Removing ability with chat string

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi! I'm trying to remove abilities based on -forget (like GoH) but I'm having problems with it.

  • Preloads
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- Skills and Skill Name --------
      • Set Skill[1] = Entangling Roots
      • Set Skill[2] = Envenomed Strike
      • Set Skill[3] = Pulverize
      • Set Skill[4] = Throw Rock
  • Forget Skill
    • Events
      • Player - Player 1 (Red) types a chat message containing -forget as A substring
      • Player - Player 2 (Blue) types a chat message containing -forget as A substring
      • Player - Player 3 (Teal) types a chat message containing -forget as A substring
      • Player - Player 4 (Purple) types a chat message containing -forget as A substring
      • Player - Player 5 (Yellow) types a chat message containing -forget as A substring
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Substring((Entered chat string), 9, (Length of (Entered chat string)))) Equal to (Name of Skill[(Integer A)])
              • (Substring((Entered chat string), 1, 7)) Equal to -forget
            • Then - Actions
              • Player - Add (Level of Skill[(Integer A)] for Heroes[1]) to (Triggering player) Current lumber
              • Unit - Remove Skill[(Integer A)] from Heroes[1]
            • Else - Actions
 
Last edited:

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
  • (Substring((Entered chat string), 9, (Length of (Entered chat string)))) Equal to (Name of Skill[(Integer A)])
Start from 9 not 8.

Additonaly:
- you could replace (Integer A) with custom integer parameter
- add conditions from placement of "-forget":

  • Forget Skill
    • Events
      • Player - Player 1 (Red) types a chat message containing -forget as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 7)) Equal to -forget
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
I followed your first and third suggestions. Didn't understand the second one :) Replace (Interger A) with what? which custom integer parameter?... I mean,I have like 8 (Interger A)

It didn't work though =/ I'm testing with '-forget Throw Rock' and doesn't remove the skill.

Edit: Works doing it the 'dumb' way:

  • Preloads
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- Skills and Skill Name --------
      • Set Skill[1] = Entangling Roots
      • Set SkillName[1] = (Name of Skill[1])
      • Set Skill[2] = Envenomed Strike
      • Set SkillName[2] = (Name of Skill[2])
      • Set Skill[3] = Pulverize
      • Set SkillName[3] = (Name of Skill[3])
      • Set Skill[4] = Throw Rock
      • Set SkillName[4] = (Name of Skill[4])
 
Last edited:

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Omg, I see that second part of "substring" comparison is bad too. I've omited it, in case I was in hurry.

  • (Substring((Entered chat string), 9, (Length of (Entered chat string)))) Equal to (Name of Skill[(Integer A)])
It's an comparison found in 'String' -> Game - Ability Name. Btw, you haven't even declared 'SkillName[]' in first script.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I'm lost in the mid of everything... I'm confused :D

EDIT: It took my some time, but I finally understood everything. Edited the triggers in the first post to the one I actually have working. Thanks a lot for your help :)
 
Status
Not open for further replies.
Top