OSP Kit QoL Towerclock

Users who are viewing this thread

From modders to modders :smile:
Just add towerclock to scene props. Makes the town scene more atmospheric and alive. Show current calradian ingame time.



[SCENE] TowerClock for M&B Warband
v.1.0 (April 30, 2020)
by AndyYa
Fully compatable with other mods.
Adds a new scene props to your mod.

INSTALLATION
------------

Module System is required.
- copy the *.dds into your module's\Textures folder
- copy the *.brf into your module's\Resource folder
- edit your module.ini add load_mod_resource = mmc_clock
Modify your module system.

-add to module_scene_props.py
### Towerclock ###
("zzz_towerclock",0,"clock_obj","0", []),
("zzz_towerclock_hh",sokf_moveable,"clock_hand_h","0", []),
("zzz_towerclock_hm",sokf_moveable,"clock_hand_m","0", []),

-add to module_triggers.py
### Towerclock trigger 1 ###
(1, 0, 0,#create new or add to existing same trigger but upper than Towerclock trigger 2
[(assign, "$g_mmc_minutes", -1)],
[]),
### Towerclock trigger 2 ###
### Trigger updates 0.25 = 15 ingame minutes, 0.1 = 6 ingame minutes, 0.05=3 min , 0.017=1 min, etc
(0.017, 0, 0,
[],
[(try_begin),
(eq, "$g_mmc_minutes", -1),
(assign, "$g_mmc_minutes", 0),
(else_try),
(val_add, "$g_mmc_minutes", 1),
(try_end),
]
),

-add to module_scripts.py
### Towerclock ###
# script_mt_turn_clock_hands
# Input: none
# Output: none
("mt_turn_clock_hands",
[(try_begin),
# 12 hour am pm clock
(store_time_of_day, ":timeofday"),
(try_begin),
(ge,":timeofday",12),
(assign, reg4, 1),
(val_sub, ":timeofday", 12),
(else_try),
(assign, reg4, 0),
(try_end),
(try_begin),
(eq, ":timeofday", 0),
(assign, ":timeofday", 12),
(try_end),
(assign, reg3, ":timeofday"),
# Here ends 12 hour am pm clock
(assign, reg21, "$g_mmc_minutes"),
(try_begin),
(le, "$g_mmc_minutes",9),
(str_store_string, s21, "@0{reg21}"),
(else_try),
(str_store_string, s21, "@{reg21}"),
(try_end),
(str_store_string, s2, "@{reg3}:{s21}{reg4?PM:AM}"),
(display_message, "@Calradian time is {s2}"),
(try_end),
(store_mul, ":h_angle", reg3, 30 ),
(store_mul, ":m_angle", "$g_mmc_minutes", 6 ),
(scene_prop_get_num_instances, ":num_instances_of_hh", "spr_zzz_towerclock_hh"),
(try_for_range, ":cur_instance", 0, ":num_instances_of_hh"),
(scene_prop_get_instance, ":c_hand_hour", "spr_zzz_towerclock_hh", ":cur_instance"),
(ge, ":c_hand_hour", 0),
(prop_instance_get_position, pos1, ":c_hand_hour"),
(try_begin),
(is_between, ":m_angle", 60, 359),
(store_div, ":h_angle_add", ":m_angle", 12),
(val_add, ":h_angle", ":h_angle_add"),
(try_end),
(position_rotate_y, pos1, ":h_angle"),
(prop_instance_animate_to_position, ":c_hand_hour", pos1, 100),
(try_end),
(scene_prop_get_num_instances, ":num_instances_of_hm", "spr_zzz_towerclock_hm"),
(try_for_range, ":cur_instance", 0, ":num_instances_of_hm"),
(scene_prop_get_instance, ":c_hand_minute", "spr_zzz_towerclock_hm", ":cur_instance"),
(ge, ":c_hand_minute", 0),
(prop_instance_get_position, pos1, ":c_hand_minute"),
(position_rotate_y, pos1, ":m_angle"),
(prop_instance_animate_to_position, ":c_hand_minute", pos1, 100),
(try_end),
]),

-add to module_mission_templates.py -> "town_center", "village_center"
#create new or add to existing same trigger
(1, 0, ti_once,
[],
[(call_script,"script_mt_turn_clock_hands")]),

###
Compile
###
Add to your scene. In editor mod set the minute and hour hands to 12 o’clock.
###
Enjoy

Credits: DennisH2010

In editor mod set the hour and the minute hand at 12 o’clock.

Download from google drive
Nexus
 
Last edited:
Back
Top Bottom