def kuf( c_name = -1): # Kill unfriendlies # c_name - of particular name if type(c_name) == type(1): for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC): if (moshe.reaction_get(game.party[0]) <= 0 or moshe.is_friendly(game.party[0]) == 0) and ( not (moshe.leader_get() in game.party) and moshe.object_flags_get() & OF_DONTDRAW == 0) and (moshe.name == c_name or c_name == -1): # moshe.critter_kill_by_effect() damage_dice = dice_new( '50d50' ) moshe.damage( game.party[0], 0, damage_dice ) elif type(c_name) == type('asdf'): for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC): if (moshe.reaction_get(game.party[0]) <= 0 or moshe.is_friendly(game.party[0]) == 0) and ( not (moshe.leader_get() in game.party) and moshe.object_flags_get() & OF_DONTDRAW == 0) and ( (str(moshe).lower().find(c_name.lower()) != -1) ): # moshe.critter_kill_by_effect() damage_dice = dice_new( '50d50' ) moshe.damage( game.party[0], 0, damage_dice )
def dsb(radius, ci = 0, hndl=0, nxy=0, cx =0, cy = 0, ec = 'normal'): # detect script bearers # floats their object name, description, and san_dying script # ec -> extra command # ec = 'strat' -> return strategy type, e.g.: type dsb(40, ec='s') in the console to reveal strategy type center = game.leader.location if ci != 0: center = ci if cx == 0 or cy == 0: cx, cy = location_to_axis(center) scriptee_list = [] for dude in game.obj_list_vicinity(center, OLC_NPC): dudex, dudey = location_to_axis(dude.location) if ( (dudex - cx)**2 + (dudey - cy)**2 ) <= radius**2: scriptee_list.append( (dude.name, dudex, dudey, dude.scripts[12]) ) if dude.name >= 14000: dude.float_mesfile_line( 'mes\\description.mes', dude.name, 1 ) elif dude.name >= 8000 and dude.name <=9000: dude.float_mesfile_line( 'oemes\\oname.mes', dude.name, 1 ) if str(ec) == 's': dude.float_mesfile_line( 'mes\\test.mes', dude.obj_get_int(obj_f_critter_strategy), 1) elif str(ec) == '15' or str(ec) == 'san_start_combat' or str(ec) == 'start_combat': if dude.scripts[15] != 0: #san_start_combat dude.float_mesfile_line( 'mes\\test.mes', dude.scripts[15], 1 ) elif str(ec) == '19' or str(ec) == 'san_heartbeat' or str(ec) == 'heartbeat': if dude.scripts[19] != 0: #san_start_combat dude.float_mesfile_line( 'mes\\test.mes', dude.scripts[19], 1 ) else: if dude.scripts[12] != 0: #san_dying dude.float_mesfile_line( 'mes\\test.mes', dude.scripts[12], 1 ) return scriptee_list
def alldie(): for obj in game.obj_list_vicinity( game.party[0].location, OLC_CRITTERS ): if obj not in game.party[0].group_list() and obj.name != 14455: obj.critter_kill_by_effect() # damage_dice = dice_new( '104d20' ) # obj.damage( OBJ_HANDLE_NULL, 0, damage_dice ) return 1
def tenc(): #test encroachment gescheft beac = ohn for npc in game.obj_list_vicinity(game.leader.location, OLC_NPC): if npc.name == 14811: beac = npc break countt_encroachers = 1 countt_all = 1 for npc in game.obj_list_vicinity(beac.location, OLC_NPC): beac.float_mesfile_line( 'mes\\test.mes', countt_all, 1 ) countt_all += 1 if is_far_from_party(npc, 48) and npc.is_unconscious() == 0: attachee.float_mesfile_line( 'mes\\test.mes', countt_encroachers, 2 ) countt_encroachers += 1 joe = party_closest(npc) encroach(npc, joe)
def tenc(): #test encroachment gescheft beac = ohn for npc in game.obj_list_vicinity(game.leader.location, OLC_NPC): if npc.name == 14811: beac = npc break countt_encroachers = 1 countt_all = 1 for npc in game.obj_list_vicinity(beac.location, OLC_NPC): beac.float_mesfile_line('mes\\test.mes', countt_all, 1) countt_all += 1 if is_far_from_party(npc, 48) and npc.is_unconscious() == 0: attachee.float_mesfile_line('mes\\test.mes', countt_encroachers, 2) countt_encroachers += 1 joe = party_closest(npc) encroach(npc, joe)
def nxy(radius): gladius = [] for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC): if moshe.distance_to(game.party[0]) <= radius: x,y = lta(moshe.location) gladius.append((moshe.name,x,y)) return gladius
def alldie(): for obj in game.obj_list_vicinity(game.party[0].location, OLC_CRITTERS): if obj not in game.party[0].group_list() and obj.name != 14455: obj.critter_kill_by_effect() # damage_dice = dice_new( '104d20' ) # obj.damage( OBJ_HANDLE_NULL, 0, damage_dice ) return 1
def fnl(obj_name, radius): gladius = [] for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC): if moshe.distance_to( game.party[0]) <= radius and moshe.name == obj_name: gladius.append(moshe) return gladius
def nxy(radius): gladius = [] for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC): if moshe.distance_to(game.party[0]) <= radius: x, y = lta(moshe.location) gladius.append((moshe.name, x, y)) return gladius
def san_enter_combat(attachee, triggerer, generated_from_timed_event_call=0): attachee.float_line(12058, triggerer) # "You have earned my wrath!" if (attachee.leader_get() == OBJ_HANDLE_NULL and (not attachee.has_wielded(1) or not attachee.has_wielded(4071))): attachee.item_wield_best_all() game.new_sid = 0 if attachee.map == 5005: ggv400 = game.global_vars[400] if (ggv400 & (2**0)) == 0: ggv400 |= 2**5 game.global_vars[400] = ggv400 for obj in game.obj_list_vicinity(location_from_axis(487, 537), OLC_NPC): if obj.name in range( 14074, 14078) and obj.leader_get() == OBJ_HANDLE_NULL: obj.npc_flag_unset(ONF_WAYPOINTS_DAY) obj.npc_flag_unset(ONF_WAYPOINTS_NIGHT) if triggerer.type == obj_t_pc or triggerer.leader_get( ) != OBJ_HANDLE_NULL: obj.attack(triggerer) else: obj.attack(game.leader) return RUN_DEFAULT
def hommletans_go_home(): moshe = game.obj_create(14460, location_from_axis(577, 412)) for npc in game.obj_list_vicinity(moshe.location, OLC_NPC): if (to_be_deleted_outdoors(npc) == 1): npc.destroy() moshe.destroy() moshe = game.obj_create(14460, location_from_axis(365, 653)) for npc in game.obj_list_vicinity(moshe.location, OLC_NPC): if (to_be_deleted_outdoors(npc) == 1): npc.destroy() moshe.destroy() moshe = game.obj_create(14460, location_from_axis(318, 495)) for npc in game.obj_list_vicinity(moshe.location, OLC_NPC): if (to_be_deleted_outdoors(npc) == 1): npc.destroy() moshe.destroy() return
def san_dying(attachee, triggerer): if should_modify_CR(attachee): modify_CR(attachee, get_av_level()) # if game.global_flags[277] == 0: ##Kalshane's idea for Raimol ratting the party out to the traders and triggering the assassination - put on hold # 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.encounter_queue.append(3000) # game.global_flags[420] = 1 record_time_stamp(425) if (attachee.leader_get() != OBJ_HANDLE_NULL): game.global_vars[29] = game.global_vars[29] + 1 game.global_flags[37] = 1 if (game.story_state <= 1): game.story_state = 2 return RUN_DEFAULT attachee.float_line(12014, triggerer) game.global_flags[37] = 1 if (game.story_state <= 1): game.story_state = 2 for pc in game.party: if (pc.reputation_has(18) == 1): pc.reputation_remove(18) attachee.float_line(12014, triggerer) game.party[0].reputation_add(15) if (game.global_flags[340] == 1): for obj in game.obj_list_vicinity(attachee.location, OLC_PC): if (is_safe_to_talk(attachee, obj)): game.global_flags[834] = 1 obj.begin_dialog(attachee, 370) attachee.float_line(12014, triggerer) elif (game.global_flags[62] == 0): for obj in game.obj_list_vicinity(attachee.location, OLC_PC): if (is_safe_to_talk(attachee, obj)): game.global_flags[834] = 1 obj.begin_dialog(attachee, 390) attachee.float_line(12014, triggerer) return RUN_DEFAULT
def buff_npc_two(attachee, triggerer): for obj in game.obj_list_vicinity(attachee.location, OLC_NPC): if (obj.name == 14424 and obj.leader_get() == OBJ_HANDLE_NULL): obj.cast_spell(spell_mirror_image, obj) if (obj.name == 14425 and obj.leader_get() == OBJ_HANDLE_NULL): obj.cast_spell(spell_owls_wisdom, obj) attachee.cast_spell(spell_bulls_strength, attachee) return RUN_DEFAULT
def killkos(): for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC): if (moshe.npc_flags_get() & ONF_KOS != 0 and moshe.npc_flags_get() & ONF_KOS_OVERRIDE == 0 and moshe.scripts[22] == 0 and moshe.leader_get() == ohn): # moshe.critter_kill_by_effect() damage_dice = dice_new( '50d50' ) moshe.damage( game.party[0], 0, damage_dice ) return
def tgd(hp_desired, radius): # tough guy detector # returns a list of critters with HP greater than [hp_desired] # list includes the critters "name" , HP, and XY coordinates gladius = [] for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC): if moshe.distance_to(game.party[0]) <= radius and moshe.stat_level_get(stat_hp_max) >= hp_desired: x,y = lta(moshe.location) gladius.append((moshe.name,'hp='+str(moshe.stat_level_get(stat_hp_max)),x,y)) return gladius
def buff_npc(attachee, triggerer): for obj in game.obj_list_vicinity(attachee.location, OLC_NPC): if (obj.name == 14424 and obj.leader_get() == OBJ_HANDLE_NULL): obj.turn_towards(attachee) obj.cast_spell(spell_mage_armor, obj) if (obj.name == 14425 and obj.leader_get() == OBJ_HANDLE_NULL): obj.turn_towards(attachee) obj.cast_spell(spell_shield_of_faith, obj) attachee.cast_spell(spell_shield_of_faith, attachee) return RUN_DEFAULT
def san_disband(attachee, triggerer): if (game.global_flags[806] == 0): for pc in game.party: attachee.ai_shitlist_remove(pc) attachee.reaction_set(pc, 50) for npc in game.obj_list_vicinity(attachee.location, OLC_NPC): for pc in game.party: npc.ai_shitlist_remove(pc) npc.reaction_set(pc, 50) return RUN_DEFAULT
def kf(): # Kill foes for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC): hostile = 0 for pc in game.party: if moshe.reaction_get(pc) <= 0: hostile = 1 if (hostile == 1 and moshe.leader_get() == ohn): # moshe.critter_kill_by_effect() damage_dice = dice_new('50d50') moshe.damage(game.party[0], 0, damage_dice)
def kf(): # Kill foes for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC): hostile = 0 for pc in game.party: if moshe.reaction_get( pc ) <= 0: hostile = 1 if (hostile == 1 and moshe.leader_get() == ohn): # moshe.critter_kill_by_effect() damage_dice = dice_new( '50d50' ) moshe.damage( game.party[0], 0, damage_dice )
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
def vlist(npc_name=-1): moshe = game.obj_list_vicinity(game.leader.location, OLC_NPC) if npc_name != -1: return_list = [] for obj in moshe: if type(npc_name) == type(1): if npc_name == obj.name: return_list.append(obj) elif type(npc_name) == type([1, 2]): if obj.name in npc_name: return_list.append(obj) return return_list else: return moshe
def vlist( npc_name = -1): moshe = game.obj_list_vicinity(game.leader.location, OLC_NPC) if npc_name != -1: return_list = [] for obj in moshe: if type(npc_name) == type(1): if npc_name == obj.name: return_list.append(obj) elif type(npc_name) == type( [1, 2]): if obj.name in npc_name: return_list.append(obj) return return_list else: return moshe
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
def fpn(name = -1, living_only = 1, multiple = 0): ## find PCs near for pc in game.obj_list_vicinity( game.leader.location, OLC_PC ): if type(name) == type(1): if (pc.name == name and multiple == 0): return pc elif name == -1 | multiple != 0: if living_only == 1 and pc.is_unconscious() == 1: continue if pc.name != name and multiple != 0: continue xx,yy = lta(pc.location) print str(pc) + ', name ID = ' + str(pc.name) + ', x = ' + str(xx) + ', y = ' + str(yy) pc.float_mesfile_line( 'mes\\test.mes', int(xx), 1 ) pc.float_mesfile_line( 'mes\\test.mes', int(yy), 1 ) elif type(name) == type('asdf'): if (str(pc).lower().find(name.lower()) != -1): return pc return OBJ_HANDLE_NULL
def lareth_troops_state(): seleucas = OBJ_HANDLE_NULL lareth_sarge_1 = OBJ_HANDLE_NULL lareth_sarge_2 = OBJ_HANDLE_NULL troop_count = 0 for obj in game.obj_list_vicinity(location_from_axis(490, 535), OLC_NPC): if obj.name == 14074: if obj.is_unconscious() == 0: troop_count += 1 else: curr = obj.stat_level_get(stat_hp_current) maxx = obj.stat_level_get(stat_hp_max) elif obj.name == 14077: seleucas = obj elif obj.name == 14075: lareth_sarge_1 = obj elif obj.name == 14076: lareth_sarge_2 = obj return 0
def fnn(name=-1, living_only=1, multiple=0): got_one = 0 for npc in game.obj_list_vicinity(game.leader.location, OLC_NPC): if type(name) == type(1): if (npc.name == name and multiple == 0): return npc elif name == -1 | multiple != 0: if living_only == 1 and npc.is_unconscious() == 1: continue if npc.name != name and multiple != 0: continue got_one = 1 xx, yy = lta(npc.location) print str(npc) + ', name ID = ' + str( npc.name) + ', x = ' + str(xx) + ', y = ' + str(yy) npc.float_mesfile_line('mes\\test.mes', int(xx), 1) npc.float_mesfile_line('mes\\test.mes', int(yy), 1) elif type(name) == type('asdf'): if (str(npc).lower().find(name.lower()) != -1): return npc if got_one == 0 and name == -1: fnn(living_only=0) return OBJ_HANDLE_NULL
def vlist3(radius): gladius = [] for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC): if moshe.distance_to(game.party[0]) <= radius: gladius.append(moshe) return gladius
def fnl(obj_name,radius): gladius = [] for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC): if moshe.distance_to(game.party[0]) <= radius and moshe.name == obj_name: gladius.append(moshe) return gladius
def dsb(radius, ci=0, hndl=0, nxy=0, cx=0, cy=0, ec='normal'): # detect script bearers # floats their object name, description, and san_dying script # ec -> extra command # ec = 'strat' -> return strategy type, e.g.: type dsb(40, ec='s') in the console to reveal strategy type # ci -> center location OR specify cx, cy center = game.leader.location if ci != 0 and type(ci) == type(1L): center = ci if type(ci) == type('start') and ec == 'normal': ec = ci # because sometimes I forget the ec in "dsb(ec = '...') if cx == 0 or cy == 0: cx, cy = location_to_axis(center) scriptee_list = [] for dude in game.obj_list_vicinity(center, OLC_NPC): dudex, dudey = location_to_axis(dude.location) if ((dudex - cx)**2 + (dudey - cy)**2) <= radius**2: scriptee_list.append((dude.name, dudex, dudey, dude.scripts[12])) if dude.name >= 14000: dude.float_mesfile_line('mes\\description.mes', dude.name, 1) elif dude.name >= 8000 and dude.name <= 9000: dude.float_mesfile_line('oemes\\oname.mes', dude.name, 1) if str(ec) == 's': dude.float_mesfile_line( 'mes\\test.mes', dude.obj_get_int(obj_f_critter_strategy), 1) elif str(ec) == '15' or str(ec) == 'san_start_combat' or str( ec) == 'start_combat': if dude.scripts[15] != 0: #san_start_combat dude.float_mesfile_line('mes\\test.mes', dude.scripts[15],
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
def vlist2(): # looks for nearby containers moshe = game.obj_list_vicinity(game.leader.location, OLC_CONTAINER) return moshe
def san_start_combat(attachee, triggerer): 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 ) if (attachee.name == 14328 and game.random_range(1, 100) <= 40): ## Bodak Death Gaze attachee.spells_pending_to_memorized() if (attachee.name == 14309 and game.random_range(1, 100) <= 25): ## Gorgon Breath Attack attachee.spells_pending_to_memorized() if (attachee.name == 14109 and game.random_range(1, 100) <= 25): ## Ice Lizard Breath Attack attachee.spells_pending_to_memorized() if (attachee.name == 14342 and attachee.has_wielded(4083)): ## Lamia attachee.item_find(4083).destroy() return RUN_DEFAULT if (attachee.name == 14342 and attachee.item_find(4083) == OBJ_HANDLE_NULL and game.random_range(1, 100) <= 50): create_item_in_inventory(4083, attachee) attachee.item_wield_best_all() if (attachee.name == 14295 and not attachee.d20_query(Q_Critter_Is_Blinded)): ## Basilisk attachee.spells_pending_to_memorized() if (attachee.name == 14258): ## Guardian Vrock game.global_vars[762] = game.global_vars[762] + 1 if (game.global_vars[762] >= 3): damage_dice = dice_new('1d8') game.particles('Mon-Vrock-Spores', attachee) for obj in game.obj_list_vicinity(attachee.location, OLC_CRITTERS): if (obj.distance_to(attachee) <= 10 and obj.name != 14258 and obj.name != 14361): obj.spell_damage(attachee, D20DT_POISON, damage_dice, D20DAP_UNSPECIFIED, D20A_CAST_SPELL, 261) game.particles('Mon-Vrock-Spores-Hit', obj) # damage_dice = dice_new( '1d8' ) # game.particles( 'Mon-Vrock-Spores', attachee) # for obj in game.obj_list_vicinity(attachee.location,OLC_CRITTERS): # if (obj.distance_to(attachee) <= 10 and obj.name != 14258): # obj.damage( OBJ_HANDLE_NULL, D20DT_POISON, damage_dice, D20DAP_NORMAL) # obj.spell_damage( attachee, D20DT_POISON, damage_dice, D20DAP_UNSPECIFIED, D20A_CAST_SPELL, 261 ) # obj.condition_add_with_args( "Poisoned", 273 , 10) # obj.condition_add_with_args( 'sp-Vrock Spores', 273, 10, 0) # game.particles( 'Mon-Vrock-Spores-Hit', obj ) # if ((attachee.name == 14259 or attachee.name == 14360) and game.random_range(1,3) <= 3): # create_item_in_inventory( 8909, attachee ) ################################# # Spiritual Weapon Shenanigens # ################################# Spiritual_Weapon_Begone(attachee) return RUN_DEFAULT
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