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

GUI Votekick system crash

Status
Not open for further replies.
Level 9
Joined
May 27, 2006
Messages
498
I was trying to make a votekick system for my map. I made the system and when i typed command "-votekick 2" W3 crashed... I dont know why... xD I think there is something with the first trigger, because W3 crashed just after i entered the votekick command. Anyway, here are all the triggers of my system:



Variables:
aa_vote_in_progress - BDLBQ, used to stop starting new vote if there is another running already.
aa_kick_player_num - C, number of player that is being voted to kick him.
aa_[number]_have_voted - BDLBQ, used to stop players voting 2 times on one votekick.
yesvotes - C, number of votes to kick player.
novotes - C, number of votes to dont kick player.
Gladiators - C, here used as number of voting players.


  • call votekick
    • Events
      • Player - Player 1 (Red) types a chat message containing -votekick as Part (?)
      • Player - Player 2 (Blue) types a chat message containing -votekick as ... etc. etc. for 10 player (red - lightblue)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • aa_vote_in_progress Equal to True
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) the text: |cff8080FFVote hint...
          • Skip remaining actions
        • Else - Actions
      • Set aa_vote_in_progress = True
      • Trigger - Turn off (This trigger)
      • Trigger - Turn on kick and end votekick <gen>
      • If ((Entered chat string) Equal to (-votekick + (String((Integer A))))) then do (For each (Integer A) from 1 to 10, do (Set aa_kickplayer_num = (Integer A))) else do (Do nothing)
      • Game - Display to (All players) the text: ((Name of (Triggering player)) + ( has started votekick against |cffffcc00 + ((Name of (Player(aa_kickplayer_num))) + |r.)))
      • Trigger - Turn on vote yes 1 <gen>
      • Trigger - Turn on vote yes 2 <gen>
      • Trigger - Turn on vote yes 3 <gen> ... etc etc for 10 player (red - lightblue)
      • -------- -------------------------------------------------------------------- --------
      • Trigger - Turn on vote no 1 <gen>
      • Trigger - Turn on vote no 2 <gen>
      • Trigger - Turn on vote no 3 <gen> ... etc etc for 10 player (red - lightblue)
      • -------- -------------------------------------------------------------------- --------
      • Set aa_1_have_voted = False
      • Set aa_2_have_voted = False
      • Set aa_3_have_voted = False
      • Set aa_4_have_voted = False
      • Set aa_5_have_voted = False
      • Set aa_6_have_voted = False
      • Set aa_7_have_voted = False
      • Set aa_8_have_voted = False
      • Set aa_9_have_voted = False
      • Set aa_10_have_voted = False
      • Set yesvotes = 0
      • Set novotes = 0
      • Wait 30.00 seconds
      • Trigger - Run kick and end votekick <gen> (ignoring conditions)

  • kick and end votekick
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
      • (yesvotes + novotes) Equal to Gladiators
    • Actions
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off vote no 1 <gen>
      • Trigger - Turn off vote no 2 <gen>
      • Trigger - Turn off vote no 3 <gen> ... etc etc up to 10 times.
      • Trigger - Turn off vote no 10 <gen>
      • Trigger - Turn off vote yes 1 <gen>
      • Trigger - Turn off vote yes 2 <gen>
      • Trigger - Turn off vote yes 3 <gen> ... etc etc up to 10 times.
      • Set aa_vote_in_progress = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • yesvotes Equal to novotes
        • Then - Actions
          • Game - Display to (All players) the text: (|cff8080FFVote hint -|r + Vote failed - 50% players voted |cffffcc00yes|r, 50% player voted |cffffcc00no|r. Draw.)
          • Set yesvotes = 0
          • Set novotes = 0
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • yesvotes greater than novotes
        • Then - Actions
          • Set yesvotes = 0
          • Set novotes = 0
          • Game - Defeat (Player(aa_kickplayer_num)) with the message: You have been votek...
          • Unit Group - Pick every unit in (Units owned by (Player(aa_kickplayer_num))) and do (Unit - Remove (Picked unit) from the game)
          • Game - Display to (All players) the text: (|cff8080FFVote hint -|r + Vote |cffffcc00passed|r.)
          • Game - Display to (All players) the text: (|cff8080FFVote hint -|r + ((Name of (Player(aa_kickplayer_num))) + has been voteckied.))
          • Game - Display to (All players) the text: (|cff8080FFVote hint -|r + ( + ((String((100 - (novotes x 10)))) + % players voted |cffffcc00yes|r.)))
        • Else - Actions
          • Set yesvotes = 0
          • Set novotes = 0
          • Game - Display to (All players) the text: (|cff8080FFVote hint -|r + Vote |cffffcc00failed|r.)
          • Game - Display to (All players) the text: (|cff8080FFVote hint -|r + ( + ((String((100 - (yesvotes x 10)))) + % players voted |cffffcc00no|r.)))

  • vote yes 1 (same for player 2, 3, ..., 10)
    • Events
      • Player - Player 1 (Red) types a chat message containing -yes as exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • aa_1_have_voted Equal to False
        • Then - Actions
          • Set yesvotes = (yesvotes + 1)
          • Game - Display to (Player group((Triggering player))) the text: |cff8080FFVote hint...
          • Set aa_1_have_voted = True
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: |cff8080FFVote hint...

  • vote no 1 (same for player 2, 3, ..., 10)
    • Events
      • Player - Player 1 (Red) types a chat message containing -no as exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • aa_1_have_voted Equal to False
        • Then - Actions
          • Set novotes = (novotes + 1)
          • Game - Display to (Player group((Triggering player))) the text: |cff8080FFVote hint...
          • Set aa_1_have_voted = True
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: |cff8080FFVote hint...
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
If ((Entered chat string) Equal to (-votekick + (String((Integer A))))) then do (For each (Integer A) from 1 to 10, do (Set aa_kickplayer_num = (Integer A))) else do (Do nothing)

That line is pointless, Integer A is a defined value and thus it will only work if it's that value.

Since it will be 0, none of your player vars will be initialized (and thus will be 0), and the game will crash when it tries to use one of them, since it will look for the -1th player when you use those variables.
 
Level 9
Joined
May 27, 2006
Messages
498
Ah, i thought that Integers A and B are not exact values, and may be used as number, that is not defined, that could mean both ex 2 and 7 in one trigger, but in different lines... So, i have to make new line/trigger for each player that may be voted?
 
Level 9
Joined
May 27, 2006
Messages
498
I`ve never knew what are substrings made for... ;P Anyway, great thanks for help :) I`ll check it.

EDIT:
Yay! It works! It really works! Great thanks again! :D

EDIT2:
Ok, the crash problem has been solved, but there is another... After the first votekick ends, and i want to start second one, nothing happens =/

New version of call vote trigger:

  • call votekick (new)
    • Events
      • Player - Player 1 (Red) types a chat message containing -votekick as Part (?)
      • Player - Player 2 (Blue) types a chat message containing -votekick as ... etc. etc. for 10 player (red - lightblue)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • aa_vote_in_progress Equal to True
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) the text: |cff8080FFVote hint...
          • Skip remaining actions
        • Else - Actions
      • Trigger - Turn off (This trigger)
      • Set aa_kickplayer_num = (Integer((Substring((Entered chat string), 11, (Length of (Entered chat string))))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Player(aa_kickplayer_num)) slot status) Equal to leaves the game
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) the text: |cff8080FFVote hint...
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Player(aa_kickplayer_num)) slot status) Equal to not used
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) the text: |cff8080FFVote hint...
          • Skip remaining actions
        • Else - Actions
      • Game - Display to (All players) the text: ((|cff8080FFVote hint -|r + (|cffffcc00 + (Name of (Triggering player)))) + ( |rhas started votekick against |cffffcc00 + ((Name of (Player(aa_kickplayer_num))) + |r.)))
      • Set aa_vote_in_progress = True
      • Trigger - Turn on vote yes 1 <gen>
      • Trigger - Turn on vote yes 2 <gen>
      • Trigger - Turn on vote yes 3 <gen> ... etc etc for 10 players (red - lightblue)
      • -------- -------------------------------------------------------------------- --------
      • Trigger - Turn on vote no 1 <gen>
      • Trigger - Turn on vote no 2 <gen>
      • Trigger - Turn on vote no 3 <gen> ... etc etc for 10 players (red - lightblue)
      • -------- -------------------------------------------------------------------- --------
      • Set aa_1_have_voted = False
      • Set aa_2_have_voted = False
      • Set aa_3_have_voted = False
      • Set aa_4_have_voted = False
      • Set aa_5_have_voted = False
      • Set aa_6_have_voted = False
      • Set aa_7_have_voted = False
      • Set aa_8_have_voted = False
      • Set aa_9_have_voted = False
      • Set aa_10_have_voted = False
      • Set yesvotes = 0
      • Set novotes = 0
      • ~Lines starting one shot timer, doesnt matter, the problem occured before i added them.

kick and end votekick trigger wasn`t changed.
 
Last edited:
Level 9
Joined
May 27, 2006
Messages
498
Oh, its setting the variable false, but i forgot to translate that line... And by "NO" i meant "False", by "YES" i meant "True"... Bad translation ;PP

EDIT:
Today i have solved the problem why i couldnt call vote second time...

  • call votekick
    • Events
      • Player - Player 1 (Red) types a chat message containing -votekick as Part (?)
      • Player - Player 2 (Blue) types a chat message containing -votekick as ... etc. etc.
    • Conditions
    • Actions
      • ...
      • -------- That was one of the first lines of my call vote trigger... I forgot to add turn on (call votekick) line in second trigger... --------
      • Trigger - Turn off (This trigger)
      • ...

...Humilination >.>

EDIT2: Yay, i fixed the problem, now the system works perfectly! ;P Link: GUI Votekick System v.0,81
 
Last edited:
Status
Not open for further replies.
Top