Pumpkin Lord
Aye Forge,
I decided to release the codes of some of the features I once released in Vyrn OSP about a year ago or so.
HP shield works in giving agents 'hp shields' that makes the agents basicly immortal until their HP shield is broken. After that, agents will start to get hit as they should. You can give any NPC the whatever HP you want. The amount of HP shield a troop has is set in game_start scripts but you can make it dependant on STR attiribute too.
I wanted to control each NPC manually since it was an attempt on hardcore fantasy RPG. Feel free to use or edit any part you want as long as you give credits.
Having said that, I am no coder in IRL and code could use improvements. It is a WIP. Do whatever you want with it.
Happy modding!
1 - ) Firstly, add these two mission triggers on mission_templates.py and later on add the name of the triggers on any template you want.
vyrn_hp_shield - > Basicly converts the hp shield that is set in game_scripts to the relevant agents on the scene
vyrn_hp_shield1 - > Handles the hp shield in runtime. It will make the result of any damage that is done on an agent with a hp shield that is still not broken (Greater than 0) zero.
vyrn_hp_shield2 - > Somehow I needed this. I don't know, I am not a nitpicky coder. It just makes the damage default again.
2 - ) After that, add these to anywhere in module_constants.py
3 - ) Then, we need to determine the amount of HPs each troop has. You can basicly do that in game_start in module_scripts.py. Here is an example of how I did:
Cheers!
I decided to release the codes of some of the features I once released in Vyrn OSP about a year ago or so.
HP shield works in giving agents 'hp shields' that makes the agents basicly immortal until their HP shield is broken. After that, agents will start to get hit as they should. You can give any NPC the whatever HP you want. The amount of HP shield a troop has is set in game_start scripts but you can make it dependant on STR attiribute too.
I wanted to control each NPC manually since it was an attempt on hardcore fantasy RPG. Feel free to use or edit any part you want as long as you give credits.
Having said that, I am no coder in IRL and code could use improvements. It is a WIP. Do whatever you want with it.
Happy modding!
1 - ) Firstly, add these two mission triggers on mission_templates.py and later on add the name of the triggers on any template you want.
vyrn_hp_shield - > Basicly converts the hp shield that is set in game_scripts to the relevant agents on the scene
vyrn_hp_shield1 - > Handles the hp shield in runtime. It will make the result of any damage that is done on an agent with a hp shield that is still not broken (Greater than 0) zero.
vyrn_hp_shield2 - > Somehow I needed this. I don't know, I am not a nitpicky coder. It just makes the damage default again.
Code:
vyrn_hp_shield = (
ti_on_agent_spawn, 0, 0, [],
[
(store_trigger_param_1, ":spawned"),
(agent_is_active, ":spawned"),
(agent_is_alive, ":spawned"),
(agent_is_human, ":spawned"),
(agent_get_troop_id, ":spawnedtrp", ":spawned"),
(troop_get_slot, ":hp_sh", ":spawnedtrp", slot_troop_hp_shield),
(agent_set_slot, ":spawned", slot_agent_hp_shield, ":hp_sh"),
#(assign, reg2, ":hp_sh"),
#(str_store_troop_name, s33, ":spawnedtrp"),
#(display_message, "@{s33}: {reg2} set hp shield."),
])
vyrn_hp_shield1 = (
ti_on_agent_hit, 0, 0, [],
[
(store_trigger_param_1, ":game1"),
(store_trigger_param_3, ":damage1"),
(agent_is_active, ":game1"),
(agent_is_alive, ":game1"),
(agent_is_human, ":game1"),
(agent_get_slot, ":has_shield1", ":game1", slot_agent_hp_shield),
(gt, ":has_shield1", 0),
(agent_get_slot, ":current_hp_shield", ":game1", slot_agent_hp_shield),
(val_sub, ":current_hp_shield", ":damage1"),
(agent_set_slot, ":game1", slot_agent_hp_shield, ":current_hp_shield"),
(assign, reg3, ":current_hp_shield"),
# (display_message, "@Hp shield: {reg3} left."),
(try_begin),
(ge, ":damage1", 5),
(agent_set_animation, ":game1", "anim_vyrn_hit_effect"),
(try_end),
(set_trigger_result, 0),
])
vyrn_hp_shield2 = (
ti_on_agent_hit, 0, 0, [],
[
(store_trigger_param_1, ":game2"),
(store_trigger_param_3, ":damage2"),
(agent_is_active, ":game2"),
(agent_is_alive, ":game2"),
(agent_is_human, ":game2"),
(agent_get_slot, ":has_shield2", ":game2", slot_agent_hp_shield),
(eq, ":has_shield2", 0),
(set_trigger_result, ":damage2"),
])
2 - ) After that, add these to anywhere in module_constants.py
Code:
#VYRN Constants
slot_agent_hp_shield = 27
slot_troop_hp_shield = 28
3 - ) Then, we need to determine the amount of HPs each troop has. You can basicly do that in game_start in module_scripts.py. Here is an example of how I did:
Code:
(try_begin),
(troop_set_slot, "trp_player", slot_troop_hp_shield, 100),
(troop_set_slot, "trp_blue_raven", slot_troop_hp_shield, 5000),
(try_end),
Cheers!