• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Host Presses Esc

Status
Not open for further replies.
Level 4
Joined
Jun 25, 2008
Messages
67
Is there anyway i could get that in a single line for a GUI trigger in custom script, but for an event, would that work at all? or would that not work, and i should just make the whole trigger in JASS?
 
Level 11
Joined
Apr 6, 2008
Messages
760
Edit:

Never mind can't have custom scripe in event do this instead

JASS:
library GetHost initializer init

function init takes nothing returns nothing
    set udg_Host = GetLocalPlayer()
endfunction

endlibrary

put this in the map header. create a global player variable named host
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
This will get the first player that the scripts run for (which I assume is Player 0), not the host.
There was a script to find the host which is based upon response-speed from the players, so it's almost always correct (unless the host has a computer from the sixties or so...) but I can't find it right now.
 
Level 9
Joined
Apr 5, 2008
Messages
529
JASS:
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

Just have a global player variable called Host (or udg_Host if you use globals/endglobals), then run this.
Just run it before you register your event.
 
Status
Not open for further replies.
Top