Esempio n. 1
0
def heal_script(healer, target):
    if (obj_percent_hp(target) < 100):
        if (healer.name == 20003 and target.name == 14031):
            healer.cast_spell(spell_cure_moderate_wounds, target)
        if (healer.name == 20003 and target.name == 8071):
            healer.cast_spell(spell_cure_light_wounds, target)
        if (healer.name == 20001 and target.name == 8008):
            healer.cast_spell(spell_cure_critical_wounds, target)
        if (healer.name == 20001 and target.name == 14102):
            healer.cast_spell(spell_cure_serious_wounds, target)
        if (healer.name == 20001 and target.name == 20007):
            healer.cast_spell(spell_cure_moderate_wounds, target)
        game.timevent_add(heal_script, (healer, target), 700)
    return
Esempio n. 2
0
def san_end_combat(attachee, triggerer, generated_from_timed_event_call=0):
    if attachee.is_unconscious() == 1:
        return RUN_DEFAULT
    curr = attachee.stat_level_get(stat_hp_current) - attachee.stat_level_get(
        stat_subdual_damage)
    maxx = attachee.stat_level_get(stat_hp_max)
    xx = attachee.location & (0xFFFF)
    hp_percent_lareth = 100 * curr / maxx
    ggv400 = game.global_vars[400]
    ggv401 = game.global_vars[401]
    if generated_from_timed_event_call == 0 and game.global_flags[834] == 0:
        if ((ggv401 >> 15) & 7) == 1:
            closest_distance_1 = game.leader.distance_to(attachee)
            for pc in game.party:
                closest_distance_1 = min(closest_distance_1,
                                         pc.distance_to(attachee))

            if closest_distance_1 <= 25 or xx > 480:
                for ppq in range(3, 26):
                    game.timevent_add(san_start_combat,
                                      (attachee, triggerer, 1, ppq),
                                      ppq * 2500 + game.random_range(0, 20), 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

    if generated_from_timed_event_call == 0:
        # Wake up sleeping guy script
        bbb = attachee.obj_get_int(obj_f_critter_strategy)
        if bbb == 80:  # if using the 'seek beacon' strategy
            bbb = attachee.obj_get_int(
                obj_f_pad_i_0)  # retrieve previous strat
            attachee.obj_set_int(obj_f_critter_strategy, bbb)
            for obj in game.obj_list_cone(attachee, OLC_NPC, 20, 0, 360):
                if obj.name in range(14074, 14078) and obj != attachee:
                    obj_pad3 = obj.obj_get_int(obj_f_npc_pad_i_3)
                    if obj_pad3 & (2**8) != 0:  # is a beacon object
                        obj.destroy()
    #	if can_see_party(attachee):
    #		flash_signal(10)
    #		attachee.obj_set_int(obj_f_critter_strategy, 82)
    #	game.timevent_add(san_end_combat, ( attachee, triggerer, 1), 300, 1)
    #else:
    #	if can_see_party(attachee):
    #		flash_signal(10)
    #		attachee.obj_set_int(obj_f_critter_strategy, 82)
    dummy = 1
    return RUN_DEFAULT
Esempio n. 3
0
def san_join(attachee, triggerer):
    if (game.story_state <= 1 and game.global_flags[806] == 0):
        game.story_state = 2
    if (game.global_flags[340] == 1 and game.global_flags[806] == 0):
        # Playing demo version
        game.global_flags[834] = 1
        triggerer.begin_dialog(attachee, 380)

    # Make his surviving fellows disappear
    for obj in game.obj_list_vicinity(attachee.location, OLC_NPC):
        if obj.name in (range(14074, 14078)) and obj.stat_level_get(
                stat_hp_current) >= 0 and obj.leader_get() == OBJ_HANDLE_NULL:
            obj.runoff(obj.location - 3)
            game.global_vars[756] += 1
            game.timevent_add(destroy, (obj), 1000 + game.random_range(0, 200),
                              1)
    return RUN_DEFAULT
Esempio n. 4
0
def run_off(attachee, triggerer):
    record_time_stamp(425)
    for pc in game.party:
        attachee.ai_shitlist_remove(pc)
        attachee.reaction_set(pc, 50)
    attachee.runoff(attachee.location - 3)

    obj_list = game.obj_list_vicinity(attachee.location, OLC_NPC)
    for obj in game.obj_list_vicinity(attachee.location - 35, OLC_NPC):
        if not (obj in obj_list):
            obj_list += (obj, )
    for obj in game.obj_list_vicinity(attachee.location + 35, OLC_NPC):
        if not (obj in obj_list):
            obj_list += (obj, )
    for obj in game.obj_list_vicinity(attachee.location + 60, OLC_NPC):
        if not (obj in obj_list):
            obj_list += (obj, )
    for obj in obj_list:
        if obj.name in (range(14074, 14078)) and obj.stat_level_get(
                stat_hp_current) >= 0 and obj.leader_get() == OBJ_HANDLE_NULL:
            obj.runoff(obj.location - 3)
            game.global_vars[756] += 1
            game.timevent_add(destroy, (obj), 1000 + game.random_range(0, 200),
                              1)


#	if game.global_flags[277] == 0:
##Raimol rats the party out to the traders
#		for obj in game.party:
#			if obj.name == 8050:
#				a = game.encounter_queue
#				b = 1
#				for enc_id in a:
#					if enc_id == 3000:
#						b = 0
#				if b == 1:
#					game.global_flags[420] = 1
#					game.encounter_queue.append(3000)
    return RUN_DEFAULT
Esempio n. 5
0
def san_start_combat(attachee, triggerer):
    if attachee.map == 5067 and attachee.name in [
            14174, 14175, 14177, 13002
    ]:  ## ToEE level 2 - big bugbear room scripting
        xx, yy = location_to_axis(attachee.location)
        if xx >= 416 and xx <= 434 and yy >= 350 and yy <= 398:  # big bugbear room
            if get_v('bugbear_room_timevent_count') < 5:
                game.timevent_add(
                    bugbear_room_increment_turn_counter,
                    (get_v('bugbear_room_turn_counter') + 1), 750
                )  # reset flag in 750ms; in this version, time is frozen, so it will only take place next turn
                inc_v('bugbear_room_timevent_count')
            pcs_in_east_hallway = 0
            pcs_in_south_hallway = 0
            pcs_in_inner_south_hallway = 0

            yyp_east_max = 355
            xxp_inner_max = 416
            for obj in game.party[0].group_list():
                xxp, yyp = location_to_axis(obj.location)
                if yyp >= 355 and yyp <= 413 and xxp >= 405 and xxp <= 415 and obj.is_unconscious(
                ) == 0:
                    pcs_in_east_hallway += 1
                    if yyp > yyp_east_max:
                        yyp_east_max = yyp
                if yyp >= 414 and yyp <= 422 and xxp >= 405 and xxp <= 455:
                    pcs_in_south_hallway += 1
                if yyp >= 391 and yyp <= 413 and xxp >= 416 and xxp <= 455:
                    pcs_in_inner_south_hallway += 1
                    if xxp > xxp_inner_max:
                        xxp_inner_max = xxp

            bugbears_near_door = []
            bugbears_near_south_entrance = []

            for bugbear_dude in game.obj_list_vicinity(
                    location_from_axis(416, 359), OLC_NPC):
                if bugbear_dude.name in [
                        14174, 14175, 14177
                ] and willing_and_capable(bugbear_dude):
                    xxb, yyb = location_to_axis(bugbear_dude.location)
                    if xxb >= 416 and xxb <= 434 and yyb >= 350 and yyb < 372:
                        bugbears_near_door.append(bugbear_dude)
                    ## TODO - fear

            for bugbear_dude in game.obj_list_vicinity(
                    location_from_axis(425, 383), OLC_NPC):
                if bugbear_dude.name in [
                        14174, 14175, 14177
                ] and willing_and_capable(bugbear_dude):
                    xxb, yyb = location_to_axis(bugbear_dude.location)
                    if xxb >= 416 and xxb <= 434 and yyb >= 372 and yyb <= 399:
                        bugbears_near_south_entrance.append(bugbear_dude)

            if pcs_in_inner_south_hallway == 0 and pcs_in_south_hallway == 0 and pcs_in_east_hallway > 0:
                # PCs in east hallway only - take 3 turns to get there
                if get_v('bugbear_room_turn_counter') >= 3:
                    if yyp_east_max <= 395:
                        yyb_base = yyp_east_max + 20
                        xxb_base = 406
                    else:
                        xxb_base = 416
                        yyb_base = 415
                    bb_index = 0
                    bb_x_offset_array = [0, 0, 1, 1, 2, 2, -1, -1]
                    bb_y_offset_array = [0, 1, 0, 1, 0, 1, 0, 1]
                    for bugbear_dude in bugbears_near_south_entrance:
                        if bugbear_dude != attachee and bb_index <= 7:
                            bugbear_dude.move(
                                location_from_axis(
                                    xxb_base + bb_x_offset_array[bb_index],
                                    yyb_base + bb_y_offset_array[bb_index]),
                                0.0, 0.0)
                            bugbear_dude.attack(game.leader)
                            bb_index += 1

            elif pcs_in_inner_south_hallway > 0 and pcs_in_south_hallway == 0 and pcs_in_east_hallway == 0:
                #PCs in inner south hallway only - take 3 turns to reach
                if get_v('bugbear_room_turn_counter') >= 3:
                    if xxp_inner_max <= 440:
                        xxb_base = xxp_inner_max + 15
                        yyb_base = 406
                        bb_x_offset_array = [0, 0, 1, 1, 2, 2, 0, 0]
                        bb_y_offset_array = [0, -1, 0, -1, 0, -1, 1, 2]
                    else:
                        xxb_base = 450
                        yyb_base = 415
                        bb_x_offset_array = [0, 0, 1, 1, 2, 2, -1, -1]
                        bb_y_offset_array = [0, 1, 0, 1, 0, 1, 0, 1]
                    bb_index = 0

                    for bugbear_dude in bugbears_near_door:
                        if bugbear_dude != attachee and bb_index <= 7:
                            bugbear_dude.move(
                                location_from_axis(
                                    xxb_base + bb_x_offset_array[bb_index],
                                    yyb_base + bb_y_offset_array[bb_index]),
                                0.0, 0.0)
                            bugbear_dude.attack(game.leader)
                            bb_index += 1

    ## THIS IS USED FOR BREAK FREE
    #found_nearby = 0
    #for obj in game.party[0].group_list():
    #	if (obj.distance_to(attachee) <= 3 and obj.stat_level_get(stat_hp_current) >= -9):
    #		found_nearby = 1
    #if found_nearby == 0:
    #	while(attachee.item_find(8903) != OBJ_HANDLE_NULL):
    #		attachee.item_find(8903).destroy()
    #	if (attachee.d20_query(Q_Is_BreakFree_Possible)): # workaround no longer necessary!
    #		create_item_in_inventory( 8903, attachee )


##		attachee.d20_send_signal(S_BreakFree)

#################################
# Spiritual Weapon Shenanigens	#
#################################
    Spiritual_Weapon_Begone(attachee)
    return RUN_DEFAULT
Esempio n. 6
0
def council_events():
    ### this script is fired from first_heartbeat in the Hommlet Exterior map 5001
    if (game.leader.map == 5001 and game.global_vars[435] == 4
            and game.global_flags[435] == 0 and game.global_flags[432] == 1):
        #### spawns everyone that was inside Towne Hall
        game.global_flags[435] = 1
        burne = game.obj_create(14453, location_from_axis(578, 406))
        burne.scripts[10] = 0
        burne.scripts[19] = 0
        burne.obj_set_int(obj_f_critter_description_unknown, 20000)
        burne.move(location_from_axis(578, 406), 0.0, 0.0)
        burne.rotation = 1
        destroy_weapons(burne, 4058, 0, 0)
        jaroo = game.obj_create(14005, location_from_axis(583, 412))
        jaroo.scripts[10] = 0
        jaroo.scripts[19] = 0
        jaroo.obj_set_int(obj_f_critter_description_unknown, 20001)
        jaroo.move(location_from_axis(583, 412), 0.0, 0.0)
        jaroo.rotation = 0
        destroy_weapons(jaroo, 4047, 4111, 0)
        rufus = game.obj_create(14006, location_from_axis(571, 407))
        rufus.scripts[10] = 0
        rufus.scripts[19] = 0
        rufus.obj_set_int(obj_f_critter_description_unknown, 8071)
        rufus.move(location_from_axis(571, 407), 0.0, 0.0)
        rufus.rotation = 3
        terjon = game.obj_create(14007, location_from_axis(570, 412))
        terjon.scripts[10] = 0
        terjon.scripts[19] = 0
        terjon.obj_set_int(obj_f_critter_description_unknown, 20003)
        terjon.move(location_from_axis(570, 412), 0.0, 0.0)
        terjon.rotation = 4.5
        destroy_weapons(terjon, 4124, 6054, 0)
        renton = game.obj_create(14012, location_from_axis(583, 409))
        renton.scripts[10] = 0
        renton.scripts[19] = 0
        renton.obj_set_int(obj_f_critter_description_unknown, 20007)
        renton.move(location_from_axis(583, 409), 0.0, 0.0)
        renton.rotation = 1
        destroy_weapons(renton, 4096, 4036, 6074)
        nevets = game.obj_create(14102, location_from_axis(576, 407))
        nevets.scripts[10] = 0
        nevets.scripts[19] = 0
        nevets.obj_set_int(obj_f_critter_description_unknown, 20058)
        nevets.move(location_from_axis(576, 407), 0.0, 0.0)
        nevets.rotation = 3
        miller = game.obj_create(14031, location_from_axis(571, 412))
        miller.scripts[10] = 0
        miller.scripts[19] = 0
        miller.obj_set_int(obj_f_critter_description_unknown, 20026)
        miller.move(location_from_axis(571, 412), 3.0, 0.0)
        miller.rotation = 3
        miller.condition_add_with_args("Prone", 0, 0)
        gundi = game.obj_create(14016, location_from_axis(582, 411))
        gundi.scripts[10] = 0
        gundi.scripts[19] = 0
        gundi.obj_set_int(obj_f_critter_description_unknown, 20011)
        gundi.move(location_from_axis(582, 411), -10.0, -10.0)
        gundi.rotation = 3
        gundi.condition_add_with_args("Prone", 0, 0)
        crybaby = game.obj_create(14002, location_from_axis(575, 417))
        crybaby.move(location_from_axis(575, 417), 0.0, 0.0)
        crybaby.scripts[10] = 0
        crybaby.scripts[19] = 0
        crybaby.rotation = 5.5
        crybaby.scripts[19] = 0
        crybaby.object_flag_unset(OF_OFF)
        if (game.global_vars[436] == 4):
            game.timevent_add(proactivity, (crybaby, 3000), 2000)
        else:
            game.timevent_add(proactivity, (crybaby, 3000), 7000)

        randy1 = game.random_range(1, 2)
        randy1 = 2
        #remove randomness for testing purposes
        if (randy1 == 1):
            gremag = game.obj_create(14014, location_from_axis(365, 653))
            gremag.condition_add_with_args("Invisible", 0, 0)
            gremag.object_flag_set(OF_DONTDRAW)
            rannos = game.obj_create(14018, location_from_axis(366, 655))
            rannos.condition_add_with_args("Invisible", 0, 0)
            rannos.object_flag_set(OF_DONTDRAW)
            dlg_popup = game.obj_create(14806, location_from_axis(364, 653))
        else:
            gremag = game.obj_create(14014, location_from_axis(318, 495))
            gremag.condition_add_with_args("Invisible", 0, 0)
            gremag.object_flag_set(OF_DONTDRAW)
            rannos = game.obj_create(14018, location_from_axis(320, 496))
            rannos.condition_add_with_args("Invisible", 0, 0)
            rannos.object_flag_set(OF_DONTDRAW)
            dlg_popup = game.obj_create(14806, location_from_axis(317, 494))
            #dlg_popup.object_flag_unset(OF_DONTDRAW)
            #dlg_popup.object_flag_unset(OF_CLICK_THROUGH)
        #### damage section, tough ones:
        if (game.global_vars[436] != 4):
            lightly_damage(renton)
            lightly_damage(terjon)
            lightly_damage(rufus)
            lightly_damage(jaroo)
            lightly_damage(burne)
            game.timevent_add(heal_script, (terjon, rufus), 8500)
            game.timevent_add(heal_script, (jaroo, renton), 9500)
        #### damage section, frail but important ones:
        if (game.global_vars[436] != 4):
            if (game.global_vars[436] != 6 and game.global_vars[436] != 7):
                lightly_damage(nevets)
                lightly_damage(gundi)
                game.timevent_add(heal_script, (jaroo, gundi), 700)
                game.timevent_add(heal_script, (jaroo, nevets), 5800)
            else:
                heavily_damage(nevets)
                heavily_damage(gundi)
        #### damage section, frail and unimportant ones:
        if (get_v(436) != 4):
            if (get_v(436) == 3):
                lightly_damage(miller)
                game.timevent_add(float_comment, (terjon, 3000), 3500)
                game.timevent_add(heal_script, (terjon, miller), 3510)
            else:
                heavily_damage(miller)
    return
Esempio n. 7
0
def san_start_combat(attachee,
                     triggerer,
                     generated_from_timed_event_call=0,
                     talk_stage=-999):
    if attachee.is_unconscious() == 1:
        return RUN_DEFAULT

    #if generated_from_timed_event_call == 0 and attachee.distance_to( party_closest(attachee) ) > 45:
    #	attachee.move( party_closest(attachee).location, 0 , 0)
    #	for pp in range(0, 41):
    #		attachee.scripts[pp] = 998
    #	game.leader.ai_follower_add(attachee)
    #	#game.timevent_add( lareth_abandon, (attachee, triggerer), 20, 1)
    #

    curr = attachee.stat_level_get(stat_hp_current) - attachee.stat_level_get(
        stat_subdual_damage)
    maxx = attachee.stat_level_get(stat_hp_max)
    xx = attachee.location & (0xFFFF)
    hp_percent_lareth = 100 * curr / maxx
    ggv400 = game.global_vars[400]
    ggv401 = game.global_vars[401]
    pad3 = attachee.obj_get_int(obj_f_npc_pad_i_3)

    if (attachee.map == 5005) and (party_too_far_from_lareth(attachee)) and (
            generated_from_timed_event_call == 0):
        if ((pad3 & (2**2)) == 0):
            # Delay for one round, letting him cast Shield of Faith - he'll need it :)
            pad3 |= (2**2)
            attachee.obj_set_int(obj_f_npc_pad_i_3, pad3)
            return
        # Party is too far from Lareth, gotta nudge him in the right direction
        # spawn a beacon and change Lareth's strat to approach it
        if xx > 478:
            beacon_loc = 498L + ((550L) << 32)
        else:
            beacon_loc = 487L + ((540L) << 32)
        obj_beacon = game.obj_create(14074, beacon_loc)
        obj_beacon.object_flag_set(OF_DONTDRAW)
        obj_beacon.object_flag_set(OF_CLICK_THROUGH)
        obj_beacon.move(beacon_loc, 0, 0)
        obj_beacon.stat_base_set(stat_dexterity, -30)
        obj_beacon.obj_set_int(obj_f_npc_pad_i_3, 2**8)
        obj_beacon.attack(game.leader)
        obj_beacon.add_to_initiative()

        attachee.obj_set_int(
            obj_f_pad_i_0, attachee.obj_get_int(
                obj_f_critter_strategy))  # Record original strategy
        attachee.obj_set_int(obj_f_critter_strategy,
                             80)  # set Lareth's strat to "seek beacon"

        grease_detected = 0
        for spell_obj in game.obj_list_cone(closest_pc_1, OLC_GENERIC, 40, 0,
                                            360):
            # Check for active GREASE spell object
            if spell_obj.obj_get_int(obj_f_secretdoor_dc) == 200 + (1 << 15):
                grease_detected = 1
                grease_obj = spell_obj
        if grease_detected:
            # In case Lareth slips and doesn't execute his san_end_combat (wherein the beacon object is destroyed) - spawn a couple of timed events to guarantee the beacon doesn't survive
            game.timevent_add(kill_beacon_obj, (obj_beacon, attachee), 3700, 1)
            game.timevent_add(kill_beacon_obj, (obj_beacon, attachee), 3900, 1)
        return RUN_DEFAULT

    # strategy 81 - Approach Party strategy
    if attachee.obj_get_int(obj_f_critter_strategy
                            ) == 81 and generated_from_timed_event_call == 0:
        if can_see_party(attachee):
            attachee.obj_set_int(obj_f_critter_strategy, 82)

    if attachee.obj_get_int(obj_f_critter_strategy
                            ) != 81 and generated_from_timed_event_call == 0:
        # Should Lareth cast Obscuring Mist?
        # First, find closest party member - the most likely target for an archer
        closest_pc_1 = game.leader
        for pc in game.party[0].group_list():
            if pc.distance_to(attachee) < closest_pc_1.distance_to(attachee):
                closest_pc_1 = pc

        # Then, check for spell objects with the Obscuring Mist ID, which are also identified as active
        player_in_obscuring_mist = 0
        for spell_obj in game.obj_list_cone(closest_pc_1, OLC_GENERIC, 30, 0,
                                            360):
            if spell_obj.obj_get_int(obj_f_secretdoor_dc) == 333 + (
                    1 << 15) and spell_obj.distance_to(closest_pc_1) <= 17.5:
                player_in_obscuring_mist = 1

        player_cast_web = 0
        player_cast_entangle = 0
        for spell_obj in game.obj_list_vicinity(attachee.location,
                                                OLC_GENERIC):
            if spell_obj.obj_get_int(obj_f_secretdoor_dc) == 531 + (1 << 15):
                player_cast_web = 1
            if spell_obj.obj_get_int(obj_f_secretdoor_dc) == 153 + (1 << 15):
                player_cast_entangle = 1

        # Assess level of ranged weapon threat
        ranged_threat = 0
        for pc in game.party[0].group_list():
            pc_weap = pc.item_worn_at(3).obj_get_int(obj_f_weapon_type)
            if pc_weap in [14, 17, 46, 48, 68] and pc.is_unconscious() == 0:
                # 14 - light crossbow
                # 17 - heavy crossbow
                # 46 - shortbow
                # 48 - longbow
                # 68 - repeating crossbow
                if ranged_threat == 0:
                    ranged_threat = 1
                if pc.has_feat(feat_point_blank_shot) or (
                        pc.stat_level_get(stat_level_fighter) +
                        pc.stat_level_get(stat_level_ranger)) >= 1:
                    if ranged_threat < 2:
                        ranged_threat = 2
                if pc.has_feat(feat_precise_shot) and (
                        pc.stat_level_get(stat_level_fighter) +
                        pc.stat_level_get(stat_level_ranger)) >= 1:
                    if ranged_threat < 3:
                        ranged_threat = 3

        if (attachee.map == 5005
                and xx > 478) and ((ggv401 >> 25) & 3 == 0) and (
                    (ranged_threat == 3) or
                    (ranged_threat > 1 and player_in_obscuring_mist == 1) or
                    (ranged_threat > 0 and
                     (player_cast_entangle or player_cast_web))):
            # Cast Obscuring Mist, if:
            #  1. Haven't cast it yet  - (ggv401 >> 25) & 3
            #  2. Ranged threat exists (emphasized when player casts web or is in obscuring mist)
            # Give him a potion of Obscuring Mist, to simulate him having that scroll (just like I do...)
            if attachee.item_find_by_proto(8899) == OBJ_HANDLE_NULL:
                attachee.item_get(game.obj_create(8899, attachee.location))
            ggv401 += 1 << 25
            game.global_vars[401] = ggv401
            lareth_is_threatened = 0
            if closest_pc_1.distance_to(attachee) <= 3:
                lareth_is_threatened = 1
            if lareth_is_threatened == 1:
                attachee.obj_set_int(obj_f_critter_strategy,
                                     85)  # Obscuring Mist + 5ft step
            else:
                attachee.obj_set_int(obj_f_critter_strategy,
                                     86)  # Just Obscuring Mist
        elif (pad3 &
              (2**1) == 0) and (player_cast_entangle or player_cast_web):
            attachee.obj_set_int(obj_f_critter_strategy, 87)  # Dispel strat
            pad3 |= (2**1)
            attachee.obj_set_int(obj_f_npc_pad_i_3, pad3)
        elif attachee.map == 5005 and player_entrenched_in_corridor(attachee):
            attachee.obj_set_int(obj_f_critter_strategy, 89)
        else:
            attachee.obj_set_int(obj_f_critter_strategy, 82)

    if (hp_percent_lareth < 50) and (generated_from_timed_event_call == 0
                                     or generated_from_timed_event_call == 1
                                     and talk_stage == 667):

        if (ggv400 & (2**6)) == 0:
            found_pc = OBJ_HANDLE_NULL
            obj_list = game.obj_list_vicinity(attachee.location, OLC_NPC)

            # Extending the range a little...

            for obj in game.obj_list_vicinity(attachee.location - 35, OLC_NPC):
                if not (obj in obj_list):
                    obj_list += (obj, )

            for obj in game.obj_list_vicinity(attachee.location + 35, OLC_NPC):
                if not (obj in obj_list):
                    obj_list += (obj, )

            for obj in obj_list:
                for pc in game.leader.group_list():
                    if pc.type == obj_t_pc and pc.is_unconscious() == 0:
                        found_pc = pc
                    #if obj.name in ([attachee.name] + range(14074, 14078)):
                    obj.ai_shitlist_remove(pc)
                    obj.reaction_set(pc, 50)
                    obj.remove_from_initiative(obj)
                    if pc.type == obj_t_npc:
                        pc.ai_shitlist_remove(obj)
                for obj2 in game.obj_list_vicinity(attachee.location, OLC_ALL):
                    if obj2.type == obj_t_pc or obj2.type == obj_t_npc:
                        obj2.reaction_set(obj, 50)
                        try:
                            obj2.ai_shitlist_remove(obj)
                        finally:
                            dummy = 1
                        obj2.remove_from_initiative(obj2)

            if generated_from_timed_event_call == 0:
                game.timevent_add(san_start_combat,
                                  (attachee, triggerer, 1, 667), 100, 1)
            elif found_pc != OBJ_HANDLE_NULL:
                ggv400 |= 2**6
                game.global_vars[400] = ggv400
                game.global_flags[834] = 1
                found_pc.begin_dialog(attachee, 160)
                return SKIP_DEFAULT

    elif generated_from_timed_event_call == 0 and game.global_flags[834] == 0:
        if ((ggv401 >> 15) & 7) == 0:
            ggv401 += 1 << 15
            game.global_vars[401] = ggv401
        elif ((ggv401 >> 15) & 7) == 1:
            closest_distance_1 = game.leader.distance_to(attachee)
            for pc in game.party:
                closest_distance_1 = min(closest_distance_1,
                                         pc.distance_to(attachee))
            if closest_distance_1 < 45:
                for ppq in range(3, 26):
                    game.timevent_add(san_start_combat,
                                      (attachee, triggerer, 1, ppq),
                                      ppq * 2500 + game.random_range(0, 20), 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

    elif generated_from_timed_event_call == 1 and game.global_flags[834] == 0:
        if (hp_percent_lareth > 75) and (
                ggv400 & (2**4)) == 0 and attachee.d20_query(Q_Prone) == 0:
            if talk_stage >= 3 and ((ggv401 >> 15) & 31) == 2:
                attachee.float_line(6000, triggerer)
                game.sound(4201, 1)
                game.sound(4201, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 3 and ((ggv401 >> 15) & 31) == 3:
                game.sound(4202, 1)
                game.sound(4202, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 3 and ((ggv401 >> 15) & 31) == 4:
                game.sound(4203, 1)
                game.sound(4203, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

            elif talk_stage >= 8 and ((ggv401 >> 15) & 31) == 5:
                attachee.float_line(6001, triggerer)
                game.sound(4204, 1)
                game.sound(4204, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 8 and ((ggv401 >> 15) & 31) == 6:
                game.sound(4205, 1)
                game.sound(4205, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

            elif talk_stage >= 13 and ((ggv401 >> 15) & 31) == 7:
                attachee.float_line(6002, triggerer)
                game.sound(4206, 1)
                game.sound(4206, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 13 and ((ggv401 >> 15) & 31) == 8:
                game.sound(4207, 1)
                game.sound(4207, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

            elif talk_stage >= 18 and ((ggv401 >> 15) & 31) == 9:
                attachee.float_line(6003, triggerer)
                game.sound(4208, 1)
                game.sound(4208, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 18 and ((ggv401 >> 15) & 31) == 10:
                game.sound(4209, 1)
                game.sound(4209, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

            elif talk_stage >= 22 and ((ggv401 >> 15) & 31) == 11:
                attachee.float_line(6004, triggerer)
                game.sound(4210, 1)
                game.sound(4210, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 22 and ((ggv401 >> 15) & 31) == 12:
                attachee.float_line(6004, triggerer)
                game.sound(4211, 1)
                game.sound(4211, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 22 and ((ggv401 >> 15) & 31) == 13:
                attachee.float_line(6004, triggerer)
                game.sound(4212, 1)
                game.sound(4212, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

        elif (hp_percent_lareth <= 75) and (ggv400 & (2**4)) == 0:
            if ((ggv401 >> 15) & 31) > 2:
                attachee.float_line(6005, triggerer)
                game.sound(4200, 1)
                game.sound(4200, 1)
            game.timevent_add(san_start_combat, (attachee, triggerer, 1, 667),
                              5500, 1)
            ggv400 |= 2**4
            game.global_vars[400] = ggv400

    #################################
    # Spiritual Weapon Shenanigens	#
    #################################
    Spiritual_Weapon_Begone(attachee)

    return RUN_DEFAULT