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

Advanced votekick tutorial just 6 triggers needed

Level 2
Joined
Dec 23, 2007
Messages
3
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:
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:
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:
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:
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:
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
 

Attachments

  • votekick system.w3x
    19.1 KB · Views: 447
Top