ceriux
Adventurer
Would be able to know what time it is in game time... since the blacksmith in edana only opens at 7 and i have no idea what time it is -.-
Jelly said:There's also a huge clock tower in Edana, which is actually a cool feature.
// Clock brush
{ game_spawn
setangle face.x 0
setprop ent_me speed 0
setvard local.lasthour -1
setvard local.lastminute -1
}
//Syncronize the time
{ worldevent_time
//~3300 speed == 1 rotation / second
if( local.updatehourhand ) callevent set_hour_hand PARAM1 PARAM3
if( local.updateminutehand ) callevent set_minute_hand PARAM2 PARAM3
}
{ set_hour_hand
if PARAM1 != local.lasthour
//Calculate the hour hand position
local L_HOUR_POSITION PARAM1
multiply L_HOUR_POSITION 30
local L_MIN_OFFSET PARAM1
divide L_MIN_OFFSET 60
multiply L_MIN_OFFSET 30
local L_HAND_POSITION L_HOUR_POSITION
add L_HAND_POSITION L_MIN_OFFSET
multiply L_HAND_POSITION -1
setangle face.x L_HAND_POSITION
setvard local.lasthour PARAM1
//Calulate the speed
local L_HAND_SPEED -3220 //Negative to go clockwise
divide L_HAND_SPEED 43200 //12 * 3600
multiply L_HAND_SPEED PARAM2
setprop ent_me avelocity $vec(L_HAND_SPEED,0,0)
}
{ set_minute_hand
if PARAM1 != local.lastminute
//Calculate the minute hand position
local L_HAND_POSITION PARAM1
divide L_HAND_POSITION 60
multiply L_HAND_POSITION 360
multiply L_HAND_POSITION -1
setangle face.x L_HAND_POSITION
setvard local.lastminute PARAM2
//Calulate the speed
local L_HAND_SPEED -3220 //Negative to go clockwise
divide L_HAND_SPEED 3600 //
multiply L_HAND_SPEED PARAM2
setprop ent_me avelocity $vec(L_HAND_SPEED,0,0)
}