Village Raids
The inability for the player to flee from an encroaching enemy while raiding a village has been a frequently voiced "beef" throughout the forum. Not having seen anyone look into this, I thought I'd do so and post what I worked out.
For whatever they are worth, the following minor bits of code/tweaks allow the player's party to behave akin to an NPC lord's party during a village raid: they can move within a certain radius of the village with the raid continuing and if they move beyond this radius, the raid is terminated. At half the limit distance, a menu appears, asking if the player wants to continue the raid, serving as a warning.
Since some Native code needs to be tweaked, I've marked the edited Native code with three comment hashes ###
I've included notes to indicate lines that could be commented out to force the player to hold Spacebar or CTRL+Spacebar for time to pass...this would also give them more fine tuned control for reacting to an enemy party. I've marked these lines ###OPTIONAL COMMENT OUT
The inability for the player to flee from an encroaching enemy while raiding a village has been a frequently voiced "beef" throughout the forum. Not having seen anyone look into this, I thought I'd do so and post what I worked out.
For whatever they are worth, the following minor bits of code/tweaks allow the player's party to behave akin to an NPC lord's party during a village raid: they can move within a certain radius of the village with the raid continuing and if they move beyond this radius, the raid is terminated. At half the limit distance, a menu appears, asking if the player wants to continue the raid, serving as a warning.
Since some Native code needs to be tweaked, I've marked the edited Native code with three comment hashes ###
I've included notes to indicate lines that could be commented out to force the player to hold Spacebar or CTRL+Spacebar for time to pass...this would also give them more fine tuned control for reacting to an enemy party. I've marked these lines ###OPTIONAL COMMENT OUT
This Native trigger needs to be tweaked
Add this trigger immediately following the above.
Code:
#Player raiding a village
# This trigger will check if player's raid has been completed and will lead control to village menu.
(1,
[
(ge,"$g_player_raiding_village",1),
(try_begin),
(neq, "$g_player_is_captive", 0),
#(rest_for_hours, 0, 0, 0), #stop resting - abort
(assign,"$g_player_raiding_village",0),
### (else_try), ###Remove this entire Else-Try###
### (map_free), #we have been attacked during raid
### (assign,"$g_player_raiding_village",0),
(else_try),
(this_or_next|party_slot_eq, "$g_player_raiding_village", slot_village_state, svs_looted),
(party_slot_eq, "$g_player_raiding_village", slot_village_state, svs_deserted),
(start_encounter, "$g_player_raiding_village"),
(rest_for_hours, 0),
(assign,"$g_player_raiding_village",0),
(assign,"$g_player_raid_complete",1),
(else_try),
(party_slot_eq, "$g_player_raiding_village", slot_village_state, svs_being_raided),
(rest_for_hours_interactive, 3, 5, 1), #rest while attackable ###CHANGE rest_for_hours to rest_for_hours_interactive; ###OPTIONAL COMMENT OUT
(else_try),
(rest_for_hours, 0, 0, 0), #stop resting - abort
(assign,"$g_player_raiding_village",0),
(assign,"$g_player_raid_complete",0),
(try_end),
]),
Code:
(0.25,
[
(ge,"$g_player_raiding_village",1),
(store_distance_to_party_from_party, ":distance", "$g_player_raiding_village", "p_main_party"),
(try_begin),
(gt, ":distance", raid_distance),
(str_store_party_name_link, s1, "$g_player_raiding_village"),
(display_message, "@You have broken off your raid of {s1}."),
(call_script, "script_village_set_state", "$current_town", 0),
(party_set_slot, "$current_town", slot_village_raided_by, -1),
(assign, "$g_player_raiding_village", 0),
(rest_for_hours, 0, 0, 0), #stop resting - abort
(else_try),
(ge, ":distance", raid_distance / 2),
(map_free),
(jump_to_menu, "mnu_village_loot_continue"),
(try_end),
]),
Change (rest_for_hours, to (rest_for_hours_interactive, in the following menu options
Code:
(
"village_loot_no_resist",0,
//...//
[
("village_loot",[], "Plunder the village, then raze it.",
//...//
(rest_for_hours_interactive, 3, 5, 1), #rest while attackable (3 hours will be extended by the trigger) ###HERE ###OPTIONAL COMMENT OUT
(change_screen_return),
//...//
(
"village_loot_continue",0,
//...//
("disembark_yes",[],"Yes.",[ (rest_for_hours_interactive, 3, 5, 1), #rest while attackable (3 hours will be extended by the trigger) ###OPTIONAL COMMENT OUT
(change_screen_return),
]),