HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Problem with UnitShareVision

08-29-2009, 09:34 PM#1
Fluff
This should give the player that casts the ability vision of all enemy "kings" which are in a unit array. After 10 seconds the player will lose vision of these units. Right now this doesn't give any vision changes.

Collapse JASS:
function Trig_Vision_Actions takes nothing returns nothing
    local integer i = 0
    local player p = GetOwningPlayer(GetSpellAbilityUnit())
    call DisplayTextToForce(GetPlayersAll(), "ding")
    loop
        if ( GetPlayerAlliance(Player(i), p, ALLIANCE_SHARED_VISION) == false ) then
            call UnitShareVision( udg_King[i+1], p, true )
        endif
        set i = i + 1
        exitwhen i >= 12
    endloop
    //
    call TriggerSleepAction(10)
    set i = 0
    //
    loop
        if ( GetPlayerAlliance(Player(i), p, ALLIANCE_SHARED_VISION) == false ) then
            call UnitShareVision( udg_King[i+1], p, false )
        endif
        set i = i + 1
        exitwhen i >= 12
    endloop
endfunction

I use the message "ding" to make sure the trigger fires, and it does.

EDIT: I also tried the UnitShareVisionBJ and that didn't work, though I don't really see the difference between the two except that the BJ takes the boolean first.
08-29-2009, 09:46 PM#2
Zerzax
Add a "ding" inside your loop conditional. If that doesn't fire, something might be wrong with the if statement. Also, it might be better to start your king array from the 0 index (a standard thing to do, but probably optional).
08-29-2009, 10:00 PM#3
Fluff
Dang, I feel dumb right now because I realized that I didn't set my king variable at map initialization, but rather after a 35 second delay. Every time I tested it I didn't wait long enough. Took me about 48 hours to figure that out :/ Thanks, anyway Zerzax