Host finding Jass Trigger

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

Black-Hole
Forum Fanatic
Posts: 315
Joined: October 16th, 2007, 7:32 pm

Host finding Jass Trigger

Post by Black-Hole »

Code: Select all

//TESH.scrollpos=24
//TESH.alwaysfold=0
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

Code: Select all

Choosing Host
    Events
        Map initialization
    Conditions
    Actions
        Custom script: call GetHost()
For somereason when the game starts it dosnt pick the host? It dosnt pick anyone can someone help em please
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Host finding Jass Trigger

Post by weirdone2 »

And how would you know it doesn't get host I don't see any code their to do anything once the host is found.
User avatar
JJ2197
Legendary Genius
Posts: 1311
Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah

Re: Host finding Jass Trigger

Post by JJ2197 »

Yea add like:
call DisplayTextToForce(GetPlayersAll(),I2S(GetPlayerId(udg_host)))
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Host finding Jass Trigger

Post by Aero »

Dont run that script at map initialization, run it at least a few seconds after game has started. It seems to yield much better results.
User avatar
Ozzapoo
The Flying Cow!
Posts: 2196
Joined: November 2nd, 2007, 10:34 pm
Location: Melbourne

Re: Host finding Jass Trigger

Post by Ozzapoo »

How does this script get the host anyway...
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Host finding Jass Trigger

Post by Aero »

This stores an integer in every players' gamecache equal to their id+1
call StoreInteger ( g, "Map", "Host", GetPlayerId(GetLocalPlayer ())+1)

When working correctly, this block of code will sync all the players' stored integers to that of the host.
call TriggerSyncStart ()
call SyncStoredInteger ( g, "Map", "Host" )
call TriggerSyncReady ()

Therefore, this will return the id of the host.
set udg_Host = Player( GetStoredInteger ( g, "Map", "Host" )-1)
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: Host finding Jass Trigger

Post by initialD »

I wonder why Icefrog didn't use this host tracing system to track don't the host and let only the host to type commands for game mode.

It's kinda annoying everytime the host has to be player blue.
It's also impossible for the host to be Scourge team if it was normal mode.(ie. team pick)