Show a timer window to only one player

M

Mikechaos

Guest
It's just cause my both problem were timer problem, so i post in same topic...

Though someone delete some post on this topic so my reference changed.

My problem is on post 29.

OK so i now got TFT.
Someone asked me to do a timer like i did in my map.
He needed a timer that was shown when a hero died, so the owner of that hero could know when he would be back alive.

The problem is the time is show only to the first person dying. Others get a window Timer but with no time.

(ill give you bot trigger (gui and jass)) They are exactly the same.

here
GUI :

Sorry for the confusion...
 

3ICE

Cool Member
Reaction score
3
W.E. Bug!

:D Damn pesky World Editor Bugs :D
The following two triggers don't work for multiplayer.
It works fine for red, but the rest of the players don't see the actual time countdown.

JASS:
function x takes nothing returns nothing
//locals
    local timer T
    local timerdialog TW=CreateTimerDialog(T)
//endlocals
    call TimerStart(T,30.00,false,null) //Start 30 sec Countdown
    call TimerDialogSetTitle(TW,&quot;TW&quot;) //Set title to TW <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />
    if (GetLocalPlayer()==Player(0))then //This works <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile    :)" loading="lazy" data-shortname=":)" />
        call TimerDialogDisplay(TW,true) //Show to Red (Works Fine)
    endif
    if (GetLocalPlayer()==Player(1))then //nope <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite3" alt=":(" title="Frown    :(" loading="lazy" data-shortname=":(" />
        call TimerDialogDisplay(TW,true) //Show to Blue
    endif //(But he cannot see the time because its bugged)
    call TriggerSleepAction(30.00) //Wait 30 sec for the timer to expire
    call DestroyTimerDialog(TW<i>) //Destroy Timer Window
endfunction
function InitTrig_x takes nothing returns nothing
    set gg_trg_x=CreateTrigger()
    call TriggerRegisterPlayerChatEvent(gg_trg_x,Player(0),&quot;&quot;,false)
    call TriggerAddAction(gg_trg_x,function x)
endfunction</i>

JASS:
function X takes nothing returns nothing
//locals
    local integer i=GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))
//Returns Player Number of Owner of Triggering Unit
    local timer array t
    local timerdialog array tw
//endlocals
    if(GetUnitTypeId(GetTriggerUnit())==&#039;Edem&#039;) then //Is Demon Hunter?
        call TimerStart(t<i>,10.00,false,null) //Start the timer
        set tw<i>=CreateTimerDialog(t<i>) //Create Timer Window
        call TimerDialogSetTitle(tw<i>,GetPlayerName(ConvertedPlayer(i)))
//Set Timer Window Title
        if(GetLocalPlayer()==ConvertedPlayer(i))then //Get Player
            call TimerDialogDisplay(tw<i>,true) //Show to Player
        endif
        call TriggerSleepAction(10.00) //Wait 10 sec for the timer to expire
        call DestroyTimerDialog(tw<i>) //Destroy Timer Window
    endif
endfunction
function InitTrig_X takes nothing returns nothing
    set gg_trg_X=CreateTrigger()
    call TriggerRegisterEnterRectSimple(gg_trg_X,gg_rct_X)
    call TriggerAddAction(gg_trg_X,function X)
endfunction</i></i></i></i></i></i>


(Untested but im 90% sure that these triggers won't work for blue, teal, purple, etc)
 
M

Mikechaos

Guest
So in fact, it's my trigger, optimise and changed?

Maybe the only solution would be to make a var for each player (timer and window)...
 

Sooda

Diversity enchants
Reaction score
318
I suggest you to get Warcraft TFT. Until that use this function:
JASS:
function RoC_TimerDialogDisplayForPlayerBJ takes boolean show, timerdialog td, player whichPlayer returns nothing
    if (GetLocalPlayer() == whichPlayer) then
        // Use only local code (no net traffic) within this block to avoid desyncs.
        call TimerDialogDisplay(td, show)
    endif
endfunction

Place that function into your map header. You don' t know what is map header ? Well it is above all of your triggers and has your map name on it. It looks something like this:

<YourMapName>.w3m

and there is written into Custom Script Code Comment:
WorldEditor said:
Enter map-specific custom script code below. This text will be included in the map script after variables are declared and before any trigger code.
Can' t find it still ? Use forum search and for search word "Map Header" (Without "").
In Warcraft RoC you can' t use custom script lines ? If not convert your trigger to JASS and when you want to show timer window or hide for spesific player use this function call:
JASS:
    call RoC_TimerDialogDisplayForPlayerBJ(udg_showTimerWindow,udg_whichTimerWindow,udg_whichPlayer)

where:
"udg_showTimerWindow" is boolean variable. When this variable is true it will show timer window specified. If false it will hide timer window specified.
"udg_whichTimerWindow" is timer window variable and as you can guess your timer window.
"udg_whichPlayer" is player variable to who will timer window shown or hidden.

Keep in mind all variables need to have "udg_" (without "") prefix before your made variable name. If you would create player variable with name "MyMazePlayer" and want to show something to that player you would use it in function call as "udg_MyMazePlayer". All is case sensitive.
Good way to implement this function call is to first make your trigger in GUI. Then when you have done convert it to custom script and add as a last function call RoC_TimerDialogDisplayForPlayerBJ.
 
M

Mikechaos

Guest
Hmm sooda... Read the post please. We are on Tft and we know all what you said...

Also, you should convert your BJ to natives (if you don't do it, i suggest you to do it then)
And UDG_ only makes the var global. If you wanna have a local var you don't need it.

Also, the function you gave us is already implement in code and is not the problem actually.

Anyway, next time, before helping others, make sure that what you are saying is answering the question.

Though it is appreciate you tried to help, so don't take it personal and be mad. Your intention was right.
If i miss understood something you said, then just correct me. It might happen since :
-Slept only 3 hours last night
-It is late and i am really tired
-Had a 11 hours day, at work.
-before that, i waited 2 hours To get my freakin book for school.

Anyway, i got it working by using a timer var for each player. I will post my trigger later cause it isn't finish, though it takes lot more time than a simple array.

Thank You.

Mikechaos
 

Sooda

Diversity enchants
Reaction score
318
> Hmm sooda... Read the post please. We are on Tft and we know all what you said...

You wan' t before. Thread started with question about RoC and within 3 pages nobody didn' t posted right code what would worked for RoC so I just took it from TFT. No hard feelings.

> And UDG_ only makes the var global. If you wanna have a local var you don't need it.

Where you read/ who told you that ? "udg_" is just a prefix (name, part of string) it hasn' t nothing to do with making it global or local. To get actual local variable (Not global) you have to write each variable at the start of your actions (Or you will get syntax errors.). It looks like this:
JASS:
local variableType variableName


> Anyway, next time, before helping others, make sure that what you are saying is answering the question.

It wasn' t wrong either. In TFT there is like a action to show timer window to only specific player.
 
M

Mikechaos

Guest
> You wan' t before. Thread started with question about RoC and within 3 pages nobody didn' t posted right code what would worked for RoC so I just took it from TFT. No hard feelings.

There is on page two.
And there in the post where I put My code (for my last question) (post #28 if it didn't change)
And I had No hard feelings (and i know you didn't had either).

> Where you read/ who told you that ? "udg_" is just a prefix (name, part of string) it hasn' t nothing to do with making it global or local. To get actual local variable (Not global) you have to write each variable at the start of your actions (Or you will get syntax errors.). It looks like this:

Ya i know how to create local variable.
And ya "udg_" is just a prefix. YOu missed understood what I was trying to say. "Udg_" doesn't make the var global, i mean, you can't create a local var, then add Udg_ in front of it and use it as a global.
But it tell the world editor that that var is a global.
Don't know if you get the difference between what I wanted to say (indeed, I just re read it and it was really confusing) and what you understood.

> It wasn' t wrong either. In TFT there is like a action to show timer window to only specific player.

And I didn't said it was wrong, It was not answering the question, that's it.
 
M

Mikechaos

Guest
Bumb..

So i know i find out how to do it (just gotta Not use array)

But exide, if i'm not mistaken, made it work.

If you don't know what i'm talking about, I will explain it again.

I want to create a timer that only one person can see (cause it is suppose to be secrete, so I can't show the window to everyone or people will know it)
So i created arrays.
The window is, indeed, being show to only one person. That was easy.
But only the host, I think, can see the time. Other people see a window, but no time.
Finaly, I discover that it was the timer array who was maybe bugged..
So if anyone knows a way to do it with an timer array, it would be appreciate (in fact, it's just to know if there is a way to pass around that bug)

Else, I will do it in jass, with local. Maybe it will work and will know force me to do a trigger for each simple player.
Else, well I will do it with global, each player with his own timer var and an array timer window for all.

This is like 2-3 weeks i asked that question and never got any answer. Only people that didn't read and answered question that were already answer.

Thank you in advance.

I will post my result with local when it will be done.
 

Exide

I am amazingly focused right now!
Reaction score
448
The trigger I used shows only one timer to the owner of the dying unit, and removes it. -Only if one hero dies. My map only allowed 1 hero per player, though, so that wasn't a problem.

This is what my trigger looks like:

JASS:

function Trig_Hero_Respawning_Func027C takes nothing returns boolean
    local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
    return id&lt;5
endfunction

function Trig_Hero_Respawning_Conditions takes nothing returns boolean
    if ( ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true ) ) then
        return true
    endif
    if ( Trig_Hero_Respawning_Func027C() ) then
        return true
    endif
    return false
endfunction

function Trig_Hero_Respawning_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local real time = 2.5
    local location loc = GetRectCenter(gg_rct_Hero_Respawn_Region)
    local player owner = GetOwningPlayer(GetTriggerUnit())
    local unit hero = GetTriggerUnit()
    local integer a = GetHeroLevel(hero)
    local integer time

    if a &lt;= 9 then
        set time = 15+(5*a)  
    else
        set time = 60
    endif

    call DisplayTimedTextToForce( udg_All_Players, 10.00, &quot; &quot; )
    call DisplayTimedTextToForce( udg_All_Players, 10.00, ( &quot;|cff32cd32&quot; + ( GetPlayerName(owner) + &quot;&#039;s Hero has been killed!|r&quot; ) ) )
    call DisplayTimedTextToForce( udg_All_Players, 10.00, ( &quot;|cff32cd32&quot; + ( GetPlayerName(owner) + ( &quot;&#039;s Hero will respawn in &quot; + ( I2S( time) + &quot; seconds!|r&quot; ) ) ) ) )
    call TimerStart( t,time,false,null )
    call CreateTimerDialogBJ( t, ( &quot;|cff32cd32&quot; + &quot;Hero respawn in:|r&quot; ) )
    set udg_Timer_Window[GetConvertedPlayerId(owner)] = GetLastCreatedTimerDialogBJ()
    call TimerDialogDisplayBJ( false, GetLastCreatedTimerDialogBJ() )
    call TimerDialogDisplayForPlayerBJ( true, GetLastCreatedTimerDialogBJ(), owner)
    call TriggerSleepAction( I2R( time) )
    call TimerDialogDisplayForPlayerBJ( true, GetLastCreatedTimerDialogBJ(), owner)
    call DestroyTimerDialogBJ( udg_Timer_Window[GetConvertedPlayerId(owner)] )
    call PanCameraToTimedLocForPlayer( owner, loc, 0 )
    call ReviveHeroLoc( hero, loc, true )
    call RemoveLocation( loc)
    set loc = null
    set hero = null
    set owner = null
endfunction

//===========================================================================
function InitTrig_Hero_Respawning takes nothing returns nothing
    set gg_trg_Hero_Respawning = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Hero_Respawning, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Hero_Respawning, Condition( function Trig_Hero_Respawning_Conditions ) )
    call TriggerAddAction( gg_trg_Hero_Respawning, function Trig_Hero_Respawning_Actions )
endfunction


udg_Timer_Window
is a global Timer window array. (One for each player).
 
M

Mikechaos

Guest
> The trigger I used shows only one timer to the owner of the dying unit, and removes it. -Only if one hero dies. My map only allowed 1 hero per player, though, so that wasn't a problem.

Hmm I'm not sure i understood what you are saying.

My map allows only one hero per player (it's a maze, if some know what they are).

But, with that trigger, if two hero (different owner) die in same time, would it display one window, with a time, to both players? Cause that's what I want.
 

Exide

I am amazingly focused right now!
Reaction score
448
>But, with that trigger, if two hero (different owner) die in same time, would it display one window, with a time, to both players? Cause that's what I want.

Yes.
As far as I know. I haven't tried this trigger in a long time, but I'm 99% sure it does. (That's what I wanted to, when I made it.) -Try and see for yourself. :p
 
M

Mikechaos

Guest
Nan. I trust you.

So like i was saying, I think it's possible to make it with local since that's how this trigger seem to work.

I'll try it and post back my code here (I don't know when, don't have much time for my self lately)

Thank you.
 
M

Mikechaos

Guest
Aha.

Hmm in fact it's not really what i want to do, and like I said, I was pretty sure it was working with Locals.

Anyway. Thank you
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top