" Local Time " ? - Exists?

Demi666

New Member
Reaction score
127
okay so i just woundered, is it possible to make a local daytime?

like its 13:00 for player 1 red
and 14:00 for player 2 blue ?

i cant seem to find anything that matches what im looking for
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
it's a bit strange of a request.
if the "global" gametime is not good enough for you, and not even to e.g. give player 1 a +3 hour bias and player 4 a -6 hour bias, then you could still go on and have global reals for each player containing their "custom" time.
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
well, whatever you're doing, if there is a direct relation between the (one and only) gametime and your playertime, which can be expressed by a function, then there'll barely be any need to even create variables. I'll create some anywhoo to show you what I mean

e.g.
JASS:

globals
  real time_p1
  real time_p2
  real time_p3
  real time_p4
endglobals

function DoSomething takes nothing returns nothing
local real gametime=GetFloatGameState(ConvertFGameState(2))  //game time of day
set time_p1= gametime - 1.0 // game time of day minus 1 hour
set time_p2= gametime + 1.0 // game time of dy plus one hour
set time_p3=SquareRoot(time_p1+time_p2)+GetRandomReal(0,gametime) //whatever sort of time
set time_p4=gametime //game time of day again
call DoWhatEver(Player(0),time_p1)
endfunction


If necessary, create a real array for your time, or if those few kb an array consumes are too much, then a little function that allocates player number and player time will do as well. If you'd constantly like to access your player times in various instances, then it will be wise to have a function which constantly runs and constantly readjusts/updates the individual player times. Have the function run as often per second as accurately your need your time. Otherwise, if things are rather simple just calculate your time locally.
Hope that helps

EDIT: fixing some
 

SerraAvenger

Cuz I can
Reaction score
234
JASS:
function Trig_TryThis_Actions takes nothing returns nothing
     if GetLocalPlayer() == Player(0) then // Can be any player instead of Player(0)
        call SetTimeOfDay( 12 )
    endif
endfunction


Might work, not sure if this is battle.net friendly.

seems weird to me...
handle > gamestate > fgamestate

Global variables of type fgamestate:

common.j:
GAME_STATE_TIME_OF_DAY


Thus you change a handle for a local player. If you ask me, this will cause a server split....

greets, davey
 

SFilip

Gone but not forgotten
Reaction score
634
> this will cause a server split
I agree, this can't turn out good.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
> this will cause a server split

Aye, I suspected it too, but Demi666 can always try to test it.

If this doesn't work, there nothing will work.
 

Demi666

New Member
Reaction score
127
well could you please give me full code? long time since i read jass or even touched WE i kind of need to copy / paste sorry lol^^ im making a map atm :)

so i have to read upp on jass when i have the time :) thanks
 

Silvenon

New Member
Reaction score
19
Can I bump my quick questions when we're still on the GetLocalPlayer() topic? Sorry, I just need those answers :). I would've written the code you asked for if I knew.

Can you "GetLocalPlayer" (that's a verb) ShowUnit and SetUnitVertexColor?
 

Silvenon

New Member
Reaction score
19
Darn!!! That sucks...... Is there any way to hide a unit for only one player? (I don't mean set it's alpha to 0 because then you can still see the shadow)
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>Darn!!! That sucks...... Is there any way to hide a unit for only one player? (I don't mean set it's alpha to 0 because then you can still see the shadow)
I wonder if this works:
JASS:
function ShowUnitForPlayer takes player p,unit u , boolean Show returns nothing
    if GetLocalPlayer() == p then
        call ShowUnit(u,Show)
    endif
endfunction
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
> ~GaLs~

Did you read Chocobo's post? No, it will not work.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
> You sure it's not the other way around?

What Chocobo said makes more sense. You can always test it.
 
Z

Zouflain

Guest
If a unit that is hidden on one screen but not another, I am almost certain that causes a split. Essentially, the computer with the unit hidden is left asking "okay, so what the crap just did that anyway?"
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
The game doesn't desync from stuff that one player can see and another can't.

It desyncs if that unit only exists for one player.
Seeing is different though.

As for the colors, well, a unit only has its current color.
It doesn't have a different set for each player...
 

SFilip

Gone but not forgotten
Reaction score
634
> You sure it's not the other way around?
It makes sense to me, a unit hidden with ShowUnit cannot be, for instance, attacked, while the one "hidden" with vertex coloring can and works pretty much like a normal unit.
Do correct me if I'm wrong though.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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