HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Shared Hero Icons

04-01-2009, 12:14 AM#1
cohadar
Have you ever wanted to see hero icons of your allied players?
(without being able to control them)

Collapse JASS:
scope ShowAllyIcons initializer Init 

//===========================================================================
// The trick is to give advanced control but not shared control
// That way you see allied hero icons, but cannot control them
//===========================================================================
private function SetAlliance takes player sourcePlayer, player otherPlayer returns nothing
    call SetPlayerAllianceStateAllyBJ(        sourcePlayer, otherPlayer, true  )
    call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_SHARED_VISION, true)
    //call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_SHARED_CONTROL, true)
    call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_SHARED_ADVANCED_CONTROL, true)
endfunction

//===========================================================================
private function Conditions takes nothing returns boolean
    return true
endfunction

//===========================================================================
//  Sets same alliances between 7 starting players
//===========================================================================
private function Actions takes nothing returns nothing
    local integer i = 0
    local integer j
    loop
        exitwhen i>=6
        set j = i + 1
        loop
            exitwhen j>=7
            call SetAlliance(Player(i), Player(j))
            call SetAlliance(Player(j), Player(i))
            set j = j + 1
        endloop
        set i = i + 1
    endloop
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( trig, 0.00 )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions )
endfunction

endscope


Now I have a problem with this, it works but for up to 5 players in one team.
(One hero icon and 4 allied icons are always shown)
So it is great idea for 5vs5 AoS maps

But if you want to make 7 player map (7 samurai, 7 illidans ...)
It does not work because wc3 reserves 3 hero slots for player's heroes,
so only 4 can be used for allies.
(see the attached map)

Can anyone find a solution for this to work for 7 players?
Attached Files
File type: w3xAllied Hero Icons.w3x (10.5 KB)
04-01-2009, 12:21 AM#2
Anitarf
I can't think of anything other than creating a hidden copy of each player's hero for every other player and then somehow make it unselectable/uncontrolable while keeping the icon visible and then for each hero update the hp and mp of all it's copies.
04-01-2009, 12:44 AM#3
Captain Griffen
There's a function for that. GUI has it too. Something to do with reserving icon slots or something. Set that to one, and it's fine.
04-01-2009, 12:50 AM#4
Fledermaus
call SetReservedLocalHeroButtons(1)

EDIT: Griff beat me to it.
04-01-2009, 12:56 AM#5
Rising_Dusk
I've used something that works like this in the past and have already implemented a similar library of my own design in the next OD.
04-01-2009, 01:03 AM#6
Szythe
Is there a way to disable the resources multiboard?
04-01-2009, 01:07 AM#7
Rising_Dusk
Yeah, enable another multiboard. If you don't want that one showing, just disable the other multiboard after enabling it.
04-01-2009, 06:46 AM#8
wraithseeker
doesn't work.

Collapse JASS:
local multiboard mb = CreateMultiboard()
    call MultiboardDisplay(mb,true)
    call MultiboardDisplay(mb,false)
04-01-2009, 07:33 AM#9
wraithseeker
Collapse JASS:
scope ShowAllyIcons initializer Init 

//===========================================================================
// The trick is to give advanced control but not shared control
// That way you see allied hero icons, but cannot control them
//===========================================================================
private function SetAlliance takes player sourcePlayer, player otherPlayer returns nothing
    call SetPlayerAllianceStateAllyBJ(        sourcePlayer, otherPlayer, true  )
    call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_SHARED_VISION, true)
    //call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_SHARED_CONTROL, true)
    call SetPlayerAlliance(sourcePlayer, otherPlayer, ALLIANCE_SHARED_ADVANCED_CONTROL, true)
endfunction

//===========================================================================
private function Conditions takes nothing returns boolean
    return true
endfunction

//===========================================================================
//  Sets same alliances between 7 starting players
//===========================================================================
private function Actions takes nothing returns nothing
    local integer i = 0
    local integer j
    local multiboard mb = CreateMultiboard()
    call MultiboardDisplay(mb,true)
    call MultiboardSuppressDisplay(true)
    call SetReservedLocalHeroButtons(1)
    loop
        exitwhen i>=6
        set j = i + 1
        loop
            exitwhen j>=11
            call SetAlliance(Player(i), Player(j))
            call SetAlliance(Player(j), Player(i))
            set j = j + 1
        endloop
        set i = i + 1
    endloop
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( trig, 0.00 )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions )
endfunction

endscope

Here's a better verison of this one, I claim no credit, just editing some parts.
04-01-2009, 08:06 AM#10
cohadar
I am going to 50-cent some people.
04-01-2009, 05:05 PM#11
TheKid
...all you did was add multi-board code to get rid of the player resources multi-board... this script is for adding everybody's hero-icon to your screen, not removing the player resources board.
04-01-2009, 06:47 PM#12
Rising_Dusk
Quote:
Originally Posted by wraithseeker
doesn't work.
You're clearly doing it wrong, then. What is likely happening is that since you, you know, haven't actually made the multiboard any size, it has nothing to display. Try making a multiboard 1x1, showing it, pausing for a few seconds to verify that it makes the other disappear (it does), and then hide it again.
04-01-2009, 09:16 PM#13
TheKid
Pretty quick to jump to the conclusion that it doesn't work at all, aren't you wraithseeker?
04-01-2009, 09:51 PM#14
Kwah
I think giving advanced shared control without giving normal emulates this.

Doesn't it?
04-02-2009, 02:26 AM#15
Bobo_The_Kodo
Quote:
I think giving advanced shared control without giving normal emulates this.

Doesn't it?

Uhh, that is the whole point of this thread

Did you even read first post?