• 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] Creating a dummy player?

Status
Not open for further replies.
Level 14
Joined
Dec 12, 2012
Messages
1,007
Hello all,

I have a problem with my latest map. I want to use a dummy player that has complete vision of the map. As there are not many players on the map (2 or 4), I chose player(11), which should be the last of them all.

The problem is, if I have observers in the game, they also have full sight of the map (they somehow share the vision of player(11)... How can this be avoided? Which players view observers normally get?

Greetings,
lfh
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
And in jass it's from Player(12) to Player(15) included.
There are some constant integers in blizzard.j for the player index :

JASS:
constant integer   bj_PLAYER_NEUTRAL_VICTIM         =  13
constant integer   bj_PLAYER_NEUTRAL_EXTRA          =  14

And in common.j :

JASS:
    constant integer            PLAYER_NEUTRAL_PASSIVE          = 15
constant integer            PLAYER_NEUTRAL_AGGRESSIVE       = 12

Don't ask me why it's splitted into these two libraries instead of just written inside common.j :croll:
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Hm yes, that would be interessting.

Unfortunatly I have another problem with my observers. I use the following code to determine wether a specifiv texttag should be visible for a certain player:

JASS:
local location myLoc = GetUnitLoc(udg_unitBM)
local string myString = null
local integer counter
local player aktualPlayer
local player obsPlayer
local force aktualForce


set myString = "test"
set counter = 0
set dummyPlayer = Player(13)

call SetTextTagPos(udg_myText,GetLocationX(myLoc),GetLocationY(myLoc),200)
call SetTextTagTextBJ(udg_myText,"",12)

    loop

        exitwhen (counter > 11)
 
        set aktualPlayer = Player(counter)
        set aktualForce = GetForceOfPlayer(aktualPlayer)

        if (IsUnitVisible(udg_unitBM, aktualPlayer) == true ) and ( IsUnitVisible(udg_unitBM, dummyPlayer) == false )  then
            call SetTextTagTextBJ(udg_myText,myString,12)
            call SetTextTagColorBJ(udg_myText,100,35,30,0)
            call ShowTextTagForceBJ( true, udg_myText, aktualForce )
        elseif ( IsUnitVisible(udg_unitBM, aktualPlayer) == true ) and ( IsUnitVisible(udg_unitBM, dummyPlayer) == true ) then
            call SetTextTagTextBJ(udg_myText,myString,12)
            call SetTextTagColorBJ(udg_myText,100,0,0,0)
            call ShowTextTagForceBJ( true, udg_myText, aktualForce )
        else
            call ShowTextTagForceBJ( false, udg_myText, aktualForce )
        endif

        set counter = counter + 1

        call DestroyForce(aktualForce)
        set aktualForce = null
        set aktualPlayer = null

    endloop

call RemoveLocation(myLoc)

set myLoc = null
set myString = null
set dummyPlayer = null

In the loop, I check the visibility of udg_unitBM according to all players in the map (from player(0) to player(11)).

This works, but if I observe a game from the perspective of a player that can not see udg_unitBM, the observer can still see the texttag, allthough the unit is invisible (hidden in fog of war) to him.

Why is that?

Greetings,
lfh
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
I wonder... would it be possible to hack your own common.j to include additional neutral player slots?

Well, you can edit and import a custom common.j in your map, and yes you can add constants or even variables (and also some native functions from common.ai), or even custom function if you want ...

But there are just constants, that doesn't really matter if it's splitted in these two files, however it's still silly ...

@looking_for_help : just create texttags with GetLocalPlayer, it won't desync.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
@looking_for_help : just create texttags with GetLocalPlayer, it won't desync.

Well, creating the texttags is not really the problem (this works well), but the visibility of the texttags.

I want that the texttags are treated like units: All player that can see the texttag (by their field of view) should see it.

This works like I realized it in the code shown above but there is the problem: If I watch a replay from the view of one of these players and turn the FoW off during the replay, then I don't see the texttag of the enemy player because he is not in my field of view (although I can see him, because FoW is turned of).

Thats my problem basically.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
so i can't help you with only guessing what you are meaning

Maybe if I explain the problem a little bit more detailed?

I made two screenshots to display the problem. On the first one can see the blademaster performing a critical strike and therefore the texttag with the damage of 74 (a little bit small in the picture).

If I look at the same sceen from the same point of view, but with fog of war turned on, I don't see the texttag with the damage. And thats exactly what I want. That the visiblity of my texttags is treated like the texttags of e.g. critical strike or shadow strike etc.

wc3scrnshot122212175224.jpg


wc3scrnshot122212175229.jpg


Greetings,
lfh
 
Status
Not open for further replies.
Top