WB Coding Help with a script?

Currently viewing this thread:

So the goal of this script is to spawn a quest-related NPC, Alric, inside a castle. He's not a lord, nor does he have a party or move around in the campaign map - he's supposed to be completely static. The script as it is now works, as in Alric actually spawns. Trouble is when another lord from his faction actually visits the castle, the game doesn't "acknowledge" Alric and spawns the lord on his position, causing him to despawn. I know an easy fix to this would be to just assign him an entry point that regular lords don't typically use, but I don't want poor Alric to spend the entire game facing a wall and I don't wanna get into scene editing. How do can I "trick" the game into thinking of my NPC as a lord and not spawn other visiting lords on top of him?


(assign, ":cur_pos", 16),
(try_begin),
(eq, ":castle_scene", "scn_castle_25_interior"),
(set_visitor, ":cur_pos", "trp_alric"),
(try_end),
 
Ok, so through some creative editing of the enter_court script, I seem to have gotten it to work:
Code:
 ("enter_court",
    [
      (store_script_param_1, ":center_no"),
      
      (assign, "$talk_context", tc_court_talk),
      
      (set_jump_mission,"mt_visit_town_castle"),
      (party_get_slot, ":castle_scene", ":center_no", slot_town_castle),
      (modify_visitors_at_site,":castle_scene"),
      (reset_visitors),
      #Adding guards
      (store_faction_of_party, ":center_faction", ":center_no"),
      (faction_get_slot, ":guard_troop", ":center_faction", slot_faction_guard_troop),
      (try_begin),
        (le, ":guard_troop", 0),
        (assign, ":guard_troop", "trp_swadian_infantry"),
      (try_end),
      (set_visitor, 6, ":guard_troop"),
      (set_visitor, 7, ":guard_troop"),

      (assign, ":cur_pos", 16),
      (call_script, "script_get_heroes_attached_to_center", ":center_no", "p_temp_party"),
      (party_get_num_companion_stacks, ":num_stacks","p_temp_party"),
      (try_for_range, ":i_stack", 0, ":num_stacks"),
        (party_stack_get_troop_id, ":stack_troop","p_temp_party",":i_stack"),
        (lt, ":cur_pos", 32), # spawn up to entry point 32
        (set_visitor, ":cur_pos", ":stack_troop"),
        (val_add,":cur_pos", 1),
      (try_end),
      (try_for_range, ":cur_troop", heroes_begin, heroes_end),
        (troop_slot_eq, ":cur_troop", slot_troop_occupation, slto_kingdom_lady),
        (troop_slot_eq, ":cur_troop", slot_troop_cur_center, ":center_no"),
        (lt, ":cur_pos", 32), # spawn up to entry point 32
        (set_visitor, ":cur_pos", ":cur_troop"),
        (val_add,":cur_pos", 1),
      (try_end),

###ALRIC
(try_begin),
(eq, ":castle_scene", "scn_castle_25_interior"),
(set_visitor, ":cur_pos", "trp_alric"),
(try_end),
###ALRIC

      (jump_to_scene,":castle_scene"),
      (scene_set_slot, ":castle_scene", slot_scene_visited, 1),
      (change_screen_mission),
  ]),
I've highlighted my changes in red in case anyone's interested. I normally don't like to mess with core scripts like this unless I'm absolutely certain of what I'm doing - which I wasn't here - but everything seems to be working fine for now.
 
Last edited by a moderator:
Upvote 0
Top Bottom