Khamukkamu said:What operation can I use to force move a party AFTER it has spawned?
Or is there a way to check terrain before the party is spawned?
you can use party operations to relocate a party, it doesn't matter the type (a lord army or a town). You can even use map operations to get a valid location nearby (water or land).
IIRC the party spawns on the same terrain as the reference center (worth testing IF it is the case with the latest versions).
VC uses this script to remove a bandit lair that spawns on invalid locations (too close to a center, or in the water, or too close to the water)
Code:
#script_spawn_lairs
# INPUT: spawn point
# OUTPUT: none
("spawn_lairs", [
(store_script_param, ":bandit_spawn_point", 1),
(party_get_slot, ":bandit_lair_party", ":bandit_spawn_point", slot_party_lair_party),
(try_begin),
(le, ":bandit_lair_party", "p_spawn_points_end"),
(party_get_slot, ":bandit_template", ":bandit_spawn_point", slot_party_bandit_type),
(set_spawn_radius, 10), #chief cambiado
(party_template_get_slot, ":bandit_lair_template", ":bandit_template", slot_party_template_lair_type),
(gt, ":bandit_lair_template", 0),
(spawn_around_party, ":bandit_spawn_point", ":bandit_lair_template"),
(assign, ":new_camp", reg0),
(party_set_slot, ":new_camp", slot_party_type, spt_bandit_lair),
(str_store_party_name, s4, ":new_camp"),
#(party_set_flags, ":new_camp", pf_icon_mask, 1),
(party_get_current_terrain, ":new_camp_terrain", ":new_camp"),
## (position_get_z, ":elevation", pos4),
## (position_get_y, ":lair_y", pos4),
(assign, ":center_too_close", 0),
(try_for_range, ":center", centers_begin, centers_end),
(eq, ":center_too_close", 0),
(store_distance_to_party_from_party, ":distance", ":new_camp", ":center"),
(lt, ":distance", 5),
(assign, ":center_too_close", 1),
(try_end),
(party_get_slot, ":flags", ":bandit_spawn_point", slot_party_spawn_flags),
(try_begin),
(eq, ":center_too_close", 0),
(store_and, reg1, ":flags", spsf_coastal),
(neq, reg1, 0), #landed sea raiders
(neq, ":new_camp_terrain", rt_water),
(neq, ":new_camp_terrain", rt_river),
(neq, ":new_camp_terrain", rt_bridge),
(party_get_position, pos4, ":new_camp"),
(map_get_water_position_around_position, pos5, pos4, 4),
(party_set_slot, ":bandit_spawn_point", slot_party_lair_party, ":new_camp"),
(party_set_flags, ":new_camp", pf_disabled, 1),
(else_try),
(eq, ":center_too_close", 0),
(store_and, reg1, ":flags", spsf_coastal|spsf_seaborne),
(eq, reg1, 0), #land bandits
(neq, ":new_camp_terrain", rt_water),
(neq, ":new_camp_terrain", rt_river),
(neq, ":new_camp_terrain", rt_bridge),
#keep icon out of water
(party_get_position, pos4, ":new_camp"),
(try_begin),
(map_get_water_position_around_position, pos5, pos4, 1),
(assign, ":center_too_close", 1),
(else_try),
(party_set_slot, ":bandit_spawn_point", slot_party_lair_party, ":new_camp"),
(party_set_flags, ":new_camp", pf_disabled, 1),
(assign, ":center_too_close", 0),
(try_end),
(eq, ":center_too_close", 0),
(else_try),
(remove_party, ":new_camp"),
(try_end),
(try_end),
]),
map_get_water_position_around_position can fail (so it won't allow a bandit lair too close to the coast line, which would put the icon in the water), and it also checks for the terrain type.