Extended Use Of GetHost()
A tutorial by: Don CorleoneDescriptionSome of you might know about the GetHost() JASS script that was invented by Tennis from
WC3Jass. Therefore, I decided to post a tutorial on how to extend the possibilites within the GetHost() using GUI triggers. In this 4 step tutorial I will teach you a little on how to use it.
Step 1The codeThe GetHost() code looks like this:
- Code:
-
//Copyed from Don Corleone's tutorial on CodeCraft
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
Step 2The VariableCreate a new variable, name it "Host", set the variable type to "Player (player)", do not check out the Aray box and leave the initial value at none like done in the picture below. You will use the variable later to extend the usage of GetHost()
Step 3Call the scirptWhen you want the GetHost to be activated you will need too call the custum script. Wich can be done by using this trigger:
- Code:
-
Events:
Map Initialization
Conditions:
Actions:
Custom Script: call GetHost()
Ok so now you have done the basic GetHost() triggers and variables. So now the tutorial really starts. When we are done you will be able to:
-Display who is the host with a text trigger.
Step 4Display who is hostThis can be done with a simple trigger. All you need to do is to create a trigger that looks like the one in the picture below:
This displays the text containing "THEHOSTSNAME" is the host! He may kick people from the game.
NOTE: I wrote this myself!