• 🏆 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!

TimeAPI

Status
Not open for further replies.

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
JASS:
native GetTimeSeconds  takes nothing returns integer // seconds (0 - 60)
native GetTimeMinutes  takes nothing returns integer // minutes (0 - 59)
native GetTimeHours    takes nothing returns integer // hour (0 - 23)
native GetTimeMonth    takes nothing returns integer // month (0 - 11, 0 = January)
native GetTimeDayWeek  takes nothing returns integer // day of week (0 - 6, 0 = Sunday)
native GetTimeDayMonth takes nothing returns integer // day of month (1 - 31)
native GetTimeDayYear  takes nothing returns integer // day of year (0 - 365)
native GetTimeYear     takes nothing returns integer // year since 1900

Tutorial: N/A
Download: N/A
Native Set Type: Single Player or WarSoc
Release: 0.03alpha
Other: N/A
 
Level 5
Joined
Jun 26, 2007
Messages
63
Nice job Mindy! Thanks for adding my ideas. :smile:
-Saitek

[EDIT]

Here's a trigger that syncs the system clock with the Warcraft 3 game clock.

JASS:
function Trig_Real_Time_Actions takes nothing returns nothing  
call SetTimeOfDay((I2R(GetTimeHours())) + (I2R(GetTimeMinutes()))/60 + 
(I2R(GetTimeSeconds()))/3600) 
endfunction 
//===========================================================================
 function InitTrig_Real_Time takes nothing returns nothing
  set gg_trg_Real_Time = CreateTrigger( )
  call TriggerRegisterTimerEventPeriodic( gg_trg_Real_Time, 30.00 )
  call TriggerRegisterTimerEventSingle( gg_trg_Real_Time, 0.00 )
  call TriggerAddAction( gg_trg_Real_Time, function Trig_Real_Time_Actions )
  call SetTimeOfDayScale(0.0055) 
endfunction
The time is re synced every 30 seconds just in case someone pauses the game thus pausing the WC3 clock.

Note: This will only work in single player.
In a LAN or Bnet game it will cause a desync.

Have fun! :thumbs_up:
 
Last edited:
Status
Not open for further replies.
Top