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 ptai(prot, strat=-999): # AI tester, by proto, optionally alter strategy game.global_flags[403] = 1 # Test mode flag xx, yy = lta(game.leader.location) tro = game.obj_create(prot, lfa(xx + 3, yy + 3)) #tro.scripts[15] = 0 if strat != -999: tro.obj_set_int(324, 99 + strat) tro.stat_base_set(stat_hp_max, 300) return tro
def tsw(): # Test Spiritual Weapon Thingamajig game.global_flags[403] = 1 # Test mode flag xx, yy = lta(game.leader.location) #prot = 14262 tro = game.obj_create(14262, lfa(xx+3, yy+3) ) #tro.scripts[15] = 998 # py00998test_combat.py tro.obj_set_int(324, 99) # strategy tro.stat_base_set(stat_hp_max,300) # so he doesn't die from AoOs too quickly return tro
def ptai(prot, strat = -999): # AI tester, by proto, optionally alter strategy game.global_flags[403] = 1 # Test mode flag xx, yy = lta(game.leader.location) tro = game.obj_create(prot, lfa(xx+3, yy+3) ) #tro.scripts[15] = 0 if strat != -999: tro.obj_set_int(324,99+strat) tro.stat_base_set(stat_hp_max,300) return tro
def tai(strat, prot = 14262): # AI tester, optionally select different proto (default - troll) game.global_flags[403] = 1 # Test mode flag xx, yy = lta(game.leader.location) #prot = 14262 tro = game.obj_create(prot, lfa(xx+3, yy+3) ) tro.scripts[15] = 3 tro.obj_set_int(324,strat) tro.stat_base_set(stat_hp_max,300) # so he doesn't die from AoOs too quickly return tro
def NighInvulnerable(): massabset(0, 24) necklace = game.obj_create(6239, game.party[0].location) sword1 = game.obj_create(4599, game.party[0].location) sword2 = game.obj_create(4599, game.party[0].location) helm = game.obj_create(6036, game.party[0].location) necklace.item_condition_add_with_args('Ring of freedom of movement', 0, 0) necklace.item_condition_add_with_args('Amulet of Mighty Fists', 5, 5) necklace.item_condition_add_with_args('Weapon Enhancement Bonus', 5, 0) # necklace.item_condition_add_with_args( 'Weapon Holy', 0, 0 ) # necklace.item_condition_add_with_args( 'Weapon Lawful', 0, 0 ) necklace.item_condition_add_with_args('Weapon Silver', 0, 0) # necklace.condition_add_with_args( 'Thieves Tools Masterwork', 0, 0) # sword.item_condition_add_with_args( 'Weapon Lawful', 0, 0 ) # sword.item_condition_add_with_args( 'Weapon Silver', 0, 0 ) game.party[0].item_get(necklace) game.party[0].item_get(sword1) game.party[0].item_get(sword2) game.party[0].item_get(helm) game.party[0].condition_add_with_args('Monster Regeneration 5', 0, 0) game.party[0].condition_add_with_args('Monster Subdual Immunity', 0, 0) game.party[0].condition_add_with_args('Monster Energy Immunity', 'Fire', 0) game.party[0].condition_add_with_args('Monster Energy Immunity', 'Cold', 0) game.party[0].condition_add_with_args('Monster Energy Immunity', 'Electricity', 0) game.party[0].condition_add_with_args('Monster Energy Immunity', 'Acid', 0) game.party[0].condition_add_with_args('Monster Confusion Immunity', 0, 0) game.party[0].condition_add_with_args('Monster Stable', 0, 0) game.party[0].condition_add_with_args('Monster Untripable', 0, 0) game.party[0].condition_add_with_args('Monster Plant', 0, 0) game.party[0].condition_add_with_args('Monster Poison Immunity', 0, 0) game.party[0].condition_add_with_args('Saving Throw Resistance Bonus', 0, 10) game.party[0].condition_add_with_args('Saving Throw Resistance Bonus', 1, 10) game.party[0].condition_add_with_args('Saving Throw Resistance Bonus', 2, 10) game.party[0].condition_add_with_args('Weapon Holy', 0, 0) game.party[0].condition_add_with_args('Weapon Lawful', 0, 0) game.party[0].condition_add_with_args('Weapon Silver', 0, 0) game.party[0].obj_set_int(obj_f_speed_run, 2) game.party[0].money_adj(+90000000) game.particles('Orb-Summon-Air-Elemental', game.party[0]) return
def follower(proto_num): npc = game.obj_create(proto_num, game.leader.location) if not (game.leader.follower_atmax()): game.leader.follower_add(npc) else: game.leader.ai_follower_add(npc) # add familiar_obj to d20initiative, and set initiative to spell_caster's caster_init_value = game.leader.get_initiative() npc.add_to_initiative() npc.set_initiative(caster_init_value) game.update_combat_ui()
def create_store(attachee, triggerer): loc = attachee.location target = game.obj_create(14618, loc) # triggerer.barter(target) triggerer.begin_dialog(target, 700) return SKIP_DEFAULT
def bsp(prot): a = game.obj_create(prot, game.leader.location) a.npc_flag_unset(ONF_KOS) a.move(game.leader.location, 0, 0) return a
def spawn(prot, x, y): moshe = game.obj_create(prot, lfa(x, y)) if (moshe != OBJ_HANDLE_NULL): return moshe return OBJ_HANDLE_NULL
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
def bsp(prot): a = game.obj_create(prot, game.leader.location) a.npc_flag_unset(ONF_KOS) a.move(game.leader.location,0,0) return a
def spawn(prot,x,y): moshe = game.obj_create(prot,lfa(x,y)) if (moshe != OBJ_HANDLE_NULL): return moshe return OBJ_HANDLE_NULL
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