Set host variable?

Dimaspy

New Member
Reaction score
19
First of all, I know nothing of JASS. However, what I'd like to add to my map is a system that looks up who is the host, and then set that player to a variable.

Would be good, because then the host would get a few commands to use, such as a kick system, and the maps would be moron-free :)
 

SFilip

Gone but not forgotten
Reaction score
634

Dimaspy

New Member
Reaction score
19
I searched, but it was way too many threads to look through.
However, this code sets a game cache? In what way can this affect a player who is writing for example -kick 1 to really be able to kick that player?
I was thinking more like to add this host to Players or alike. Maybe integer.

Is it possible to work this through a condition;
(Triggering Player) Equal To Host
?
 

bbfreak

New Member
Reaction score
0
No, i think thats the only way. Just put this in yur map header.

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

Then use this:

Custom script: call GetHost()
 

SFilip

Gone but not forgotten
Reaction score
634
> this code sets a game cache?
Yes, that is needed in order to detect the host, but the actual thing gets stored in a variable called Host of type Player which you must create.
After running GetHostAverage (Custom Script: call GetHostAverage()) this variable will be set to match the host.
 

Dimaspy

New Member
Reaction score
19
Ah, right, now I get it.

But another question, in these codes, are they already made to store the data in "Host" player-variable? As this call GetHostAverage(), when running this it will store the host data, from the "Cache" game cache-variable to the "Host" variable?
 

Ice Bane

Member
Reaction score
5
What kind of variable should it be and what to name it? How do this work? I'm really new in scripting.
 

substance

New Member
Reaction score
34
Would be good, because then the host would get a few commands to use, such as a kick system, and the maps would be moron-free :)

But what if the host is the moron >_<. The best way to go about a kick system, imo, is good ol democracy.
 

Ice Bane

Member
Reaction score
5
But how should I create a trigger that finds the host?
WHAAA, I don't get it! <.< It's so confusing.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top