• 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.

Host recognition system

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
make a player variable and name it : Host (case sensitive)

then put this in your map's custom script (I'm Not going to explain every line but if you want to know , send me a message)

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

and here is the trigger to get the host's name.
Warcraft_3_host.png


if u don't get it , just donwload the map !

Keywords:
Host , System
Contents

Host Test (Map)

Reviews
08:38, 8th Jul 2014 BPower: Not 100% failure restistant. Considering the amount of code this is rather a snippet for the JASS section than a resource for the spell section. Rejected

Moderator

M

Moderator

08:38, 8th Jul 2014
BPower:

Not 100% failure restistant.
Considering the amount of code this is rather a snippet for the JASS section than a resource for the spell section.

Rejected
 
I have to say this submission I find rather hilarious, considering two resources down is another host system which contains This post which just so happens to be the system code for this submission, sure some of the lines are swapped/altered slightly, but it is amazingly similar, and also explains the failure rate of this

Failure rate statement: http://www.hiveworkshop.com/forums/2550084-post4.html
 
Yeah, you can certainly reduce the failurerate by doing it multiple times (provided you compile the results to find a most consistent result), though there will always be a small one and as the other thread already raised - it doesn't function so well with bot-hosted games, which WC3 is almost exclusively now.

Edit: really though this is more of a code snippet than a full resource, and as said, not even something you yourself created - if you want to keep it in the resource section, you /must/ credit the original sources
 
Vote for removal.

Such script exists for years now, plus it does not belong to Spells section. Jass resources or Small code snippets is the best place for such snippets.

GG for ctrl+c + ctrl+v.
Btw, 2 submissions related to host detection within the same day. Unfortunatelly both fail. "Author" of this thread probably doesnt know when "his" code does work and when it actually doesnt.
 
Level 10
Joined
Aug 21, 2010
Messages
316
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

Posted by Xonok
JASS:
call FlushGameCache(InitGameCache("gamehost.w3v"))
set udg_gamehost = InitGameCache("gamehost.w3v")
call StoreInteger ( udg_gamehost, "host", "host", GetPlayerId ( GetLocalPlayer () ) )
call TriggerSyncStart ()
call SyncStoredInteger ( udg_gamehost, "host", "host" )
call TriggerSyncReady ()
set udg_Host = GetStoredInteger ( udg_gamehost, "host", "host" )
call FlushStoredMission(udg_gamehost,"host")

Yes this is definitely stolen from wc3c
 
Top