1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Ride into the sunset with the 32nd Modeling Contest. The contest is optionally paired. Best of luck, people!
    Dismiss Notice
  4. This adventure has come to an end. Congratulate our heroes in the 16th Mini Mapping Contest Results.
    Dismiss Notice
  5. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  6. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Advanced votekick tutorial just 6 triggers needed

Discussion in 'Trigger (GUI) Editor Tutorials' started by marcotjuhhhh, Jan 6, 2008.

  1. marcotjuhhhh

    marcotjuhhhh

    Joined:
    Dec 23, 2007
    Messages:
    3
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Welcome to my tutorial on how to create advanced votekicks, what do I mean with this you ask? Well, instead of typing -votekick <number or color>
    just type:\votekick and a dialog shows up which is first of lots easier.

    Tutorial note: i am using world editor unlimited, and i dont know when i am using a function of WEU :D

    1.the variables
    we only need 6 variables

    1. kind of variable: player
    Name variable:nominatedkick

    2. kind of variable: player
    Name variable:Host

    3. kind of variable: integer[2]
    Name variable:votes

    4. kind of variable: dialog[2]
    Name variable:votekickdialog

    5. kind of variable: dialogbuttons[14](depends how much players you want in your map
    Name variable:votekickbutton

    6. kind of variable: votekicktimer
    Name variable:timer

    now we set-up the variables lets start the host finding code.
    at the start of the triggers (the header) is a blue map (TFT) with the mapname.w3x.
    click on that trigger and now you get a big white box with the text "costum Script code" above.
    now add this code there

    Code (Text):
    function GetHost takes nothing returns nothing
        local gamecache g = InitGameCache("Map.w3v")
        call StoreInteger ( g, "Map", "Host", GetPlayerId(GetLocalPlayer ())+1)
        call TriggerSyncStart ()
        call SyncStoredInteger ( g, "Map", "Host" )
        call TriggerSyncReady ()
        set udg_Host = Player( GetStoredInteger ( g, "Map", "Host" )-1)
        call FlushGameCache( g )
        set g = null
    endfunction
    now we have our hostfinding code: credits of that code goes 2 Tennis

    now lets start with the initializion
    create a new trigger called initializion
    now add
    Code (Text):
    event: map initializion or elapsed time 0.5 seconds
    conditions: NONE
    actions:costum script:call GetHost()
    change the title of votekickdialog[1] to select player to kick:
    pick every player in al players and do actions-
    loop
    IF THEN ELSE
    CONDITION:picked player not equal to Host
    controller of picked player equal to user
    playerslot of picked user equal to used
    (repeat following IF THEN ELSE for all players)
    THEN: if then else:
    condition:picked player equal to player 1
    then:create dialogbutton for votekickdialog[1] labelled: votekick <playername triggering player
    set variable: dialogbutton[1] is last created button
    (note: the following 2 buttons are the yes and no votes)
    create dialogbutton for votekickdialog[2] labelled: yes
    set variable: dialogbutton[13] is last created button
    create dialogbutton for votekickdialog[2] labelled: no
    set variable: dialogbutton[14] is last created button
    else: -
    now we have our ini, we can start calling it

    3: calling the vote:
    new trigger called: callvote
    Code (Text):
    event:player 1 types \votekick as exact match
    player 2 types \votekick as exact match
    (repeat till player 12)
    actions:show dialog votekickdialog[1]
    send gamemessage:Player <playername of triggering player> started a vote
    this is our call trigger, now our votetrigger
    Code (Text):
    events:a button of votekickdialog[1] is pressed
    conditions: NONE
    actions: if then else
    IF:button being pressed equal to votekickbutton[1]
    then:comment:This is player 1
    gamemessage:player <name of triggering player> has voted against <name of player 1>
    trigger: turn off trigger <callingvotetrigger>
    start timer: votekicktimer for <disired time>(i say 20 seconds)
    set variable:nominatedkick=player 1
    wait 2 seconds
    gamemessage: you have 15 seconds to vote....
    wait 1 second
    pick every player in all players and do actions
    IF THEN ELSE
    IF:picked player not equal to nominatedkick
    picked player controller equal to user
    THEN: show dialogvotekick[2] for picked player
    now you can call the votekick but how about the votes? lets do it right away!
    Code (Text):
    event:timer votekicktimer expires
    conditions: NONE
    actions:IF THEN ELSE
    if:votes[1] is greater or equal to votes[2]
    THEN:gamemessage:player <playername of nominatedkick> is kicked out of the game
    defeat nominatedkick with message: you got votekicked!
    set variable: votekick[1]= 0
    set variable: votekick[2]= 0
    pick every player in all players and do actions:
    (repeat following IF THEN ELSE for all players)
    THEN: if then else:
    condition:picked player equal to player 1
    [picked player equal to is playing
    picked player equal to user
    then:create dialogbutton for votekickdialog[1] labelled: votekick <playername triggering player
    set variable: dialogbutton[1] is last created button
    turn on <callingvotetrigger>
    ELSE:
    IF THEN ELSE
    IF: votes[1] is lesser then votes[2]
    then: game message:Player < playername of nominated> is not kicked, to less YES votes
    set variable: votekick[1]= 0
    set variable: votekick[2]= 0
    turn on <callingvotetrigger>

    now we have our call vote, ini , and playercheck vote, lets set-up the voting

    call the trigger:votes
    [CODE]event:a button of votekickdialog[2] is clicked
    conditions: NONE
    actions: IF THEN ELSE
    IF: clicked button equal to votekickbuttons[13]
    THEN:set votes[1]+1
    ELSE: SET votes[2]+1
    this was our votekick system:: good luck with improving this system
    creators note: i recommend to view the map included here, i added some options so its is a little better :), if you want to use my votekick, it would be great if you added some credits to me, marcotjuhhhh :) well, hf,gl,gg
     

    Attached Files:

  2. busterkomo

    busterkomo

    Joined:
    Jun 17, 2007
    Messages:
    1,423
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Please use trigger/jass tags, or at least use real GUI, not this self typed form.
     
  3. Earth-Fury

    Earth-Fury

    Joined:
    Feb 18, 2004
    Messages:
    538
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    • If you're using triggers in your tutorial, use the Trigger tags. ()
    • If you're using JASS in your tutorial, use the JASS tags. ()
    http://www.hiveworkshop.com/forums/announcement.php?f=283

    Also, posting a system with almost no explination of what it does, in psudo-code GUI, is generally NOT considerd to be a tutorial.