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

[Trigger] BUG at my Chat System

Status
Not open for further replies.
Level 9
Joined
May 27, 2012
Messages
116
Well I've made a custom chat system and its pretty basic but there is a error.
The system is about that you set in the channel you want to speak in.
But then you change from channel ''0'' (the base one) it just don't work.
But channel 1 works...

//Commands//
-c (shows you the channel you are in)
-channel <NUMBER> (sets a new channel)
-mute on (unable you from talk)
-mute off (enable you from talk)

  • Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- colours --------
      • Set PlayerColours[1] = |CFFFF0000
      • Set PlayerColours[2] = |CFF0000FF
      • Set PlayerColours[3] = |CFF18E7BD
      • Set PlayerColours[4] = |CFF520084
      • Set PlayerColours[5] = |CFFFFFF00
      • Set PlayerColours[6] = |CFFFF8A08
      • Set PlayerColours[7] = |CFF18BE00
      • Set PlayerColours[8] = |CFFE759AD
      • Set PlayerColours[9] = |CFF949694
      • Set PlayerColours[10] = |CFF7BBEF7
      • Set PlayerColours[11] = |CFF086142
      • Set PlayerColours[12] = |CFF4A2800
        • Do Multiple ActionsFor each (Integer A) from 1 to 12, do (Actions)
          • Loop - Actions
            • Set PlayerNames[(Integer A)] = (PlayerColours[(Integer A)] + ((Name of (Player((Integer A)))) + |r: ))
            • Set RCCS_PlayerChannel[(Player number of (Triggering player))] = 0
            • Player Group - Add (Triggering player) to RCCS_RadioChannel[0]
      • -------- Player Names --------
        • Do Multiple ActionsFor each (Integer A) from 1 to 12, do (Actions)
          • Loop - Actions
            • Player - Set name of (Player((Integer A))) to ...
  • Typing
    • Events
      • Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
      • Player - Player 2 (Blue) types a chat message containing <Empty String> as A substring
      • Player - Player 3 (Teal) types a chat message containing <Empty String> as A substring
      • Player - Player 4 (Purple) types a chat message containing <Empty String> as A substring
      • Player - Player 5 (Yellow) types a chat message containing <Empty String> as A substring
      • Player - Player 6 (Orange) types a chat message containing <Empty String> as A substring
      • Player - Player 7 (Green) types a chat message containing <Empty String> as A substring
      • Player - Player 8 (Pink) types a chat message containing <Empty String> as A substring
      • Player - Player 9 (Gray) types a chat message containing <Empty String> as A substring
      • Player - Player 10 (Light Blue) types a chat message containing <Empty String> as A substring
      • Player - Player 11 (Dark Green) types a chat message containing <Empty String> as A substring
      • Player - Player 12 (Brown) types a chat message containing <Empty String> as A substring
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RCCS_Mute[(Player number of (Triggering player))] Equal to (==) False
        • Then - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Substring((Entered chat string), 1, 1)) Not equal to (!=) -
            • Then - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RCCS_PlayerChannel[(Player number of (Triggering player))] Equal to (==) 0
                • Then - Actions
                  • Game - Display to (All players) for 5.00 seconds the text: ([C- + (Open + (] + (PlayerNames[(Player number of (Triggering player))] + (Entered chat string)))))
                • Else - Actions
                  • Game - Display to RCCS_RadioChannel[RCCS_PlayerChannel[(Player number of (Triggering player))]] for 5.00 seconds the text: ([C- + ((String(RCCS_PlayerChannel[(Player number of (Triggering player))])) + (] + (PlayerNames[(Player number of (Triggering player))] + (Entered chat string)))))
            • Else - Actions
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) for 1.00 seconds the text: |cffff5e5e[Muted]|r
  • Change Channel
    • Events
      • Player - Player 1 (Red) types a chat message containing -channel as A substring
      • Player - Player 2 (Blue) types a chat message containing -channel as A substring
      • Player - Player 3 (Teal) types a chat message containing -channel as A substring
      • Player - Player 4 (Purple) types a chat message containing -channel as A substring
      • Player - Player 5 (Yellow) types a chat message containing -channel as A substring
      • Player - Player 6 (Orange) types a chat message containing -channel as A substring
      • Player - Player 7 (Green) types a chat message containing -channel as A substring
      • Player - Player 8 (Pink) types a chat message containing -channel as A substring
      • Player - Player 9 (Gray) types a chat message containing -channel as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -channel as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -channel as A substring
      • Player - Player 12 (Brown) types a chat message containing -channel as A substring
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RCCS_Mute[(Player number of (Triggering player))] Equal to (==) False
        • Then - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer((Substring((Entered chat string), 9, 13)))) Less than or equal to (<=) 6000
            • Then - Actions
              • Set TempInt = RCCS_PlayerChannel[(Player number of (Triggering player))]
              • Player Group - Remove (Triggering player) from RCCS_RadioChannel[TempInt]
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • RCCS_PlayerChannel[(Player number of (Triggering player))] Not equal to (!=) 0
                    • (Number of players in RCCS_RadioChannel[RCCS_PlayerChannel[(Player number of (Triggering player))]]) Equal to (==) 1
                  • Then - Actions
                    • Custom script: call DestroyForce(udg_RCCS_RadioChannel[udg_TempInt])
                  • Else - Actions
              • Set TempInt = (Integer((Substring((Entered chat string), 9, 13))))
              • Set RCCS_PlayerChannel[(Player number of (Triggering player))] = TempInt
              • Player Group - Add (Triggering player) to RCCS_RadioChannel[TempInt]
            • Else - Actions
        • Else - Actions
The Rest of the triggers has nothing to do with this so no need of posting them.
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
It is because "RCCS_Radio_Channel" is only initialized for index 0 and 1 (see the variable editor's "Array size").
Any index higher than 1 does not contain a player group (and thus you cannot add players to it).
But instead of changing the array size, I believe it would be better to do this (in the trigger "Change Channel":

  • Custom script: if udg_RCCS_RadioChannel[udg_TempInt] == null then
  • Custom script: set udg_RCCS_RadioChannel[udg_TempInt] = CreateForce()
  • Custom script: endif
Add these right after you set the TempInt for the changed channel.

  • Change Channel
    • Events
      • Player - Player 1 (Red) types a chat message containing -channel as A substring
      • Player - Player 2 (Blue) types a chat message containing -channel as A substring
      • Player - Player 3 (Teal) types a chat message containing -channel as A substring
      • Player - Player 4 (Purple) types a chat message containing -channel as A substring
      • Player - Player 5 (Yellow) types a chat message containing -channel as A substring
      • Player - Player 6 (Orange) types a chat message containing -channel as A substring
      • Player - Player 7 (Green) types a chat message containing -channel as A substring
      • Player - Player 8 (Pink) types a chat message containing -channel as A substring
      • Player - Player 9 (Gray) types a chat message containing -channel as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -channel as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -channel as A substring
      • Player - Player 12 (Brown) types a chat message containing -channel as A substring
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RCCS_Mute[(Player number of (Triggering player))] Equal to False
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer((Substring((Entered chat string), 9, 13)))) Less than or equal to 6000
            • Then - Actions
              • Set TempInt = RCCS_PlayerChannel[(Player number of (Triggering player))]
              • Player Group - Remove (Triggering player) from RCCS_RadioChannel[TempInt]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RCCS_PlayerChannel[(Player number of (Triggering player))] Not equal to 0
                  • (Number of players in RCCS_RadioChannel[RCCS_PlayerChannel[(Player number of (Triggering player))]]) Equal to 1
                • Then - Actions
                  • Custom script: call DestroyForce(udg_RCCS_RadioChannel[udg_TempInt])
                • Else - Actions
              • Set TempInt = (Integer((Substring((Entered chat string), 9, 13))))
              • Custom script: if udg_RCCS_RadioChannel[udg_TempInt] == null then
              • Custom script: set udg_RCCS_RadioChannel[udg_TempInt] = CreateForce()
              • Custom script: endif
              • Set RCCS_PlayerChannel[(Player number of (Triggering player))] = TempInt
              • Player Group - Add (Triggering player) to RCCS_RadioChannel[TempInt]
            • Else - Actions
        • Else - Actions
 
Status
Not open for further replies.
Top