• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Time Shift System (Variable Dusk/Dawn)

Status
Not open for further replies.
Level 6
Joined
Feb 2, 2005
Messages
205
Hi there,
First of all i don't know if i'm in the Right Part of the Forums for this.... :confused:
but i created a Time Shift system, which alters the Dawn and Dusk Times of a map. I want some Feedback on the System tought, how to improve or what to add.

Generally i edited the blizzard.j file to change from constants to variables. The Whole system is attached to this Thread.

Heres the Trigger for the TimeShift

JASS:
function Trig_ADayEnds_Actions takes nothing returns nothing
local string array dayn
local string array monthn
local boolean ly
local integer a
local integer b
local integer c
//Set the Names of the Weekdays :)
set dayn[1]="Monday"
set dayn[2]="Tuesday"
set dayn[3]="Wednesday"
set dayn[4]="Thursday"
set dayn[5]="Friday"
set dayn[6]="Saturday"
set dayn[7]="Sunday"
//Set the Names of the Month
set monthn[1]="January" //31
set monthn[2]="February" //28 29
set monthn[3]="March"   //31
set monthn[4]="April"   //30
set monthn[5]="May"     //31
set monthn[6]="June"    //30
set monthn[7]="July"    //31
set monthn[8]="August"  //31
set monthn[9]="September"//30
set monthn[10]="October" //31
set monthn[11]="November" //30
set monthn[12]="December" //31

// Only Edit below Stuff if you know what you're doing
// Gets if the Year should have 366 days
set a = ModuloInteger(udg_year,4)
set b = ModuloInteger(udg_year,100)
set c = ModuloInteger(udg_year, 400)
    if (( a == 0 and ( b != 0 or c == 0))) then
        set ly = true
    else
        set ly = false
    endif

//changes TOD time
set udg_day=udg_day+1
   if udg_day > 21 or udg_month > 6 then
       //Timeshift Increased Night ~2 TOD minutes
       set bj_TOD_DAWN=bj_TOD_DAWN + 0.06
       set bj_TOD_DUSK=bj_TOD_DUSK - 0.06
   else
       //Timeshift Increased Day ~2 TOD minutes
       set bj_TOD_DAWN=bj_TOD_DAWN - 0.06
       set bj_TOD_DUSK=bj_TOD_DUSK + 0.06
   endif
//Debug Message to get Dawn/Dusk Times
//call BJDebugMsg(R2S(bj_TOD_DAWN)+"<-Dawn  I  Dusk->"+R2S(bj_TOD_DUSK))

//sets the weekday
set udg_weekday=udg_weekday+1
    if udg_weekday >= 8 then
        set udg_weekday=1
    elseif udg_day == 20 and udg_month == 6 then
    //sets fixed Time on this Date DO NOT CHANGE
    set bj_TOD_DAWN=4.
    set bj_TOD_DUSK=20.
    elseif udg_day >= 28 and udg_month == 2 and ly == false then
        set udg_month = udg_month +1
        set udg_day = 1
    elseif udg_day >= 29 and udg_month == 2 and ly == true then
        set udg_month = udg_month +1
        set udg_day = 1
    elseif udg_day >=30 and (udg_month == 4 or udg_month == 6 or udg_month == 9 or udg_month == 11) then
        set udg_month = udg_month +1
        set udg_day = 1
    elseif udg_day >=31 and (not((udg_month == 4 or udg_month == 6 or udg_month == 9 or udg_month == 11))) then
        set udg_month = udg_month +1
        set udg_day = 1
    elseif udg_month == 12 and udg_day == 31 then
        set udg_year = udg_year + 1
        set udg_month = 1
    endif
call BJDebugMsg("Today it's "+dayn[udg_weekday]+" the "+ I2S(udg_day)+". "+monthn[udg_month]+" "+I2S(udg_year))
endfunction

//===========================================================================
function InitTrig_TimeShift takes nothing returns nothing
    set gg_trg_TimeShift = CreateTrigger(  )
    call TriggerRegisterGameStateEventTimeOfDay( gg_trg_TimeShift, EQUAL, 0.00 )
    call TriggerAddAction( gg_trg_TimeShift, function Trig_ADayEnds_Actions )
endfunction

System can be found in the Spell Section
 
Last edited:
Level 6
Joined
Feb 2, 2005
Messages
205
Thx for finding a typo :)

hmm the names are some sort of keeping it oldstyle xD
well i'll rename them tomorrw.

Huh there come to my mind i forgot to take out the Debugmessage for dusk and dawn time...

Edit: Updated the Script, map was not updated
Edit2: Updated Map with the new script.
 
Last edited:
Status
Not open for further replies.
Top