CodeCraft
Would you like to react to this message? Create an account in a few clicks or log in to continue.

CodeCraft

CodeCraft - A WarCraft III modding and helping site
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

 

 Extended use of GetHost()

Go down 
AuthorMessage
Don Corleone

Don Corleone


Posts : 21
Join date : 2008-07-13
Age : 31

Extended use of GetHost() Empty
PostSubject: Extended use of GetHost()   Extended use of GetHost() Icon_minitimeThu Jul 17, 2008 5:19 am

Extended Use Of GetHost()

A tutorial by: Don Corleone

Description
Some 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 1
The code

The 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 2
The Variable

Create 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()
Extended use of GetHost() WARvariable

Step 3
Call the scirpt

When 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 4
Display who is host

This 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:
Extended use of GetHost() WARTUT

This displays the text containing "THEHOSTSNAME" is the host! He may kick people from the game.

NOTE: I wrote this myself! tongue
Back to top Go down
http://www.codecraft.board-directory.net
 
Extended use of GetHost()
Back to top 
Page 1 of 1
 Similar topics
-
» [JASS] GetHost()

Permissions in this forum:You cannot reply to topics in this forum
CodeCraft :: Tutorials :: JASS Tutorials-
Jump to: