ok, I want to add an option so the player can choose to make the screen bloody when injured. Example below:
When I've done presentation overlay's before I've just displayed it once, but this one would need to dynamically change. Its working decent, but the screen seems to be flickering so I think I need some help with the code design....
BRF File - I created a few semi-transparent textures that cover the screen
module_meshes.py - few different texture variations (25% health, 50% health, etc)
module_mission_templates.py - if the player is <= 75% health and $player_damage <= 0 then display a presentation
module_presentations.py - checks the player's current health, display a mesh, if their health changes then stop the presentation and it will be restarted by the MT trigger.
So the above code works, but it seems to be flickering on the screen like its opening/closing really fast.... Originally I tried putting the create_mesh_overlay in ti_on_presentation_run, and that worked decent, but it just seemed to be stacking the meshes on top of each other. What I really need is a way to clear the overlay and then I could reload it?
When I've done presentation overlay's before I've just displayed it once, but this one would need to dynamically change. Its working decent, but the screen seems to be flickering so I think I need some help with the code design....
BRF File - I created a few semi-transparent textures that cover the screen
module_meshes.py - few different texture variations (25% health, 50% health, etc)
Code:
("player_damage_25", 0, "player_damage_25", 0, 0, 0, 0, 0, 0, 1, 1, 1),
("player_damage_50", 0, "player_damage_50", 0, 0, 0, 0, 0, 0, 1, 1, 1),
("player_damage_75", 0, "player_damage_75", 0, 0, 0, 0, 0, 0, 1, 1, 1),
module_mission_templates.py - if the player is <= 75% health and $player_damage <= 0 then display a presentation
Code:
#SW - new player_damage
common_player_damage = (0, 0, 0, [
#(neg|conversation_screen_is_active),
(le, "$player_damage", 0),
],
[
(get_player_agent_no, ":player_agent"),
#(agent_is_alive, ":player_agent"),
(store_agent_hit_points,":player_hp",":player_agent",0), # set absolute to 1 to retrieve actual hps, otherwise will return relative hp in range [0..100]
(try_begin),
(le, ":player_hp", 75),
(assign, "$player_damage", 1),
#(display_message, "@prsnt_player_damage..."),
(start_presentation, "prsnt_player_damage"),
(try_end),
])
module_presentations.py - checks the player's current health, display a mesh, if their health changes then stop the presentation and it will be restarted by the MT trigger.
Code:
#SW - new presentation for player_damage
("player_damage", prsntf_read_only, 0, [ #must use prsntf_read_only or you cannot attack
(ti_on_presentation_load,
[
(presentation_set_duration, 999999),
#check the players health
(get_player_agent_no, ":player_agent"),
(store_agent_hit_points,":player_hp",":player_agent",0), # set absolute to 1 to retrieve actual hps, otherwise will return relative hp in range [0..100]
(try_begin),
(le, ":player_hp", 25),
(assign, "$player_damage", 25),
(assign, ":mesh", "mesh_player_damage_25"),
(else_try),
(le, ":player_hp", 50),
(assign, "$player_damage", 50),
(assign, ":mesh", "mesh_player_damage_50"),
(else_try),
(le, ":player_hp", 75),
(assign, "$player_damage", 75),
(assign, ":mesh", "mesh_player_damage_75"),
(else_try),
(assign, "$player_damage", 0),
(assign, ":mesh", 0),
(try_end),
#display the mesh if necessary
(try_begin),
(neq, ":mesh", 0),
#(display_message, "@create_mesh_overlay..."),
(create_mesh_overlay, reg1, ":mesh"),
(position_set_x, pos1, 0),
(position_set_y, pos1, 0),
(overlay_set_position, reg1, pos1),
(try_end),
]),
(ti_on_presentation_run,
[
#check the players health
(get_player_agent_no, ":player_agent"),
(store_agent_hit_points,":player_hp",":player_agent",0), # set absolute to 1 to retrieve actual hps, otherwise will return relative hp in range [0..100]
(try_begin),
(neq, ":player_hp", "$player_damage"),
(assign, "$player_damage", 0),
#(display_message, "@presentation_set_duration 0..."),
(presentation_set_duration, 0),
(try_end),
]),
]),
So the above code works, but it seems to be flickering on the screen like its opening/closing really fast.... Originally I tried putting the create_mesh_overlay in ti_on_presentation_run, and that worked decent, but it just seemed to be stacking the meshes on top of each other. What I really need is a way to clear the overlay and then I could reload it?