Feral
Sergeant
In my mod I have a spell (called a weave in Wheel of Time) that binds an enemy in one spot. It appears to work correctly until you have several people bound and then enter any menu screen while you're still in the mission(i.e. character screen, quest screen, or accessing the inventory box), then you get a crash to desktop with no errors and no log entries. I had a trigger that was putting a particle effect over the bound agent, I removed that because I thought it was overloading the system but it is still causing crashes. I have reports of this happening when reinforcements spawn as well.
I'm using agent slots and identifiers to keep track of things. Is it possible for agent IDs to change in the middle of a mission?
Here is the code:
Hopefully someone will be able to see something I'm missing.
I'm using agent slots and identifiers to keep track of things. Is it possible for agent IDs to change in the middle of a mission?
Here is the code:
______________________________
Here is the item
_____________________________
["bind", "Bind", [("connection_to_the_source",0),("bind_inv",ixmesh_inventory),("dot",ixmesh_flying_ammo)], itp_type_pistol|itp_primary|itp_secondary|itp_bonus_against_shield|itp_unique ,itcf_shoot_pistol, 0 , weight(1)|abundance(0)|spd_rtng(100)|shoot_speed(100)|thrust_damage(0 ,pierce)|accuracy(50)|max_ammo(30),imodbits_none,
[(ti_on_weapon_attack, [
(assign,":distance",99999),
(try_for_agents,":agent"),
(agent_is_alive,":agent"),
(agent_is_human,":agent"),
(agent_get_look_position, pos2, ":agent"),
(get_distance_between_positions,":dist",pos1,pos2),
(lt,":dist",":distance"),
(assign,":caster",":agent"),
(assign,":distance",":dist"),
(end_try),
(agent_get_troop_id,":caster_id", ":caster"),
(troop_get_slot,":count",":caster_id",slot_troop_channeling_count),
(val_add,":count",1),
(troop_set_slot,":caster_id",slot_troop_channeling_count,":count"),
(agent_get_horse,":caster_horse",":caster"),
(play_sound,"snd_balefire"),
(assign,":low",0),
(assign,":high",400),
(assign,":index",0),
(try_for_range,":index",":low",":high"),
(particle_system_burst, "psys_bind", pos1, 1),
(position_move_x,pos1,12),
(position_move_z,pos1,0),
(position_move_y,pos1,10),
(try_for_agents,":agent"),
(neq,":agent",":caster"),
(neq,":agent",":caster_horse"),
(agent_get_team,":caster_team", ":caster"),
(agent_get_team,":agent_team", ":agent"),
(teams_are_enemies,":caster_team", ":agent_team"),
(agent_get_position, pos2, ":agent"),
(get_distance_between_positions,":dist",pos1,pos2),
(lt,":dist",100),
(agent_set_slot,":agent",slot_agent_is_bound,":caster"),
(position_get_y,":y",pos2),
(position_get_x,"",pos2),
(agent_set_slot,":agent",slot_agent_bound_x,""),
(agent_set_slot,":agent",slot_agent_bound_y,":y"),
(assign,":high",":index"),
(end_try),
(end_try),],)]],
___________________________________
Here is the trigger in mission_templates
___________________________________
shadow_rising_bind = (
0.005, 0, 0, [],[
(try_for_agents,":agent"),
(agent_is_alive,":agent"),
(agent_get_slot,":caster",":agent",slot_agent_is_bound),#slot should be filled with id of caster if bound
(ge,":caster",1),
(agent_is_alive,":caster"),
(agent_get_slot,":bound_x",":agent",slot_agent_bound_x),
(agent_get_slot,":bound_y",":agent",slot_agent_bound_y),
(agent_get_position,pos45,":agent"),
(copy_position,pos46,pos45),
(position_set_x,pos46,":bound_x"),
(position_set_y,pos46,":bound_y"),
(position_set_z_to_ground_level, pos46),
(agent_set_scripted_destination,":agent",pos46,1),#need to find out how to freeze bound agent
(get_distance_between_positions,":dist",pos46,pos45),
(gt,":dist",100),
(agent_set_position,":agent",pos46),
(agent_get_horse,":horse",":agent"),
(gt,":horse",0),
(agent_set_position,":horse",pos46),
(try_end),
(try_for_agents,":agent"), #if caster dies remove bind
(agent_is_alive,":agent"),
(agent_get_slot,":caster",":agent",slot_agent_is_bound),
(ge,":caster",1),
(neg|agent_is_alive,":caster"),
(agent_set_slot,":agent",slot_agent_is_bound,0),
(agent_clear_scripted_mode,":agent"),
(try_end),
])
___________________________________
Slots I've defined for this
___________________________________
slot_agent_is_bound = 25
slot_agent_bound_x = 26
slot_agent_bound_y = 27
Here is the item
_____________________________
["bind", "Bind", [("connection_to_the_source",0),("bind_inv",ixmesh_inventory),("dot",ixmesh_flying_ammo)], itp_type_pistol|itp_primary|itp_secondary|itp_bonus_against_shield|itp_unique ,itcf_shoot_pistol, 0 , weight(1)|abundance(0)|spd_rtng(100)|shoot_speed(100)|thrust_damage(0 ,pierce)|accuracy(50)|max_ammo(30),imodbits_none,
[(ti_on_weapon_attack, [
(assign,":distance",99999),
(try_for_agents,":agent"),
(agent_is_alive,":agent"),
(agent_is_human,":agent"),
(agent_get_look_position, pos2, ":agent"),
(get_distance_between_positions,":dist",pos1,pos2),
(lt,":dist",":distance"),
(assign,":caster",":agent"),
(assign,":distance",":dist"),
(end_try),
(agent_get_troop_id,":caster_id", ":caster"),
(troop_get_slot,":count",":caster_id",slot_troop_channeling_count),
(val_add,":count",1),
(troop_set_slot,":caster_id",slot_troop_channeling_count,":count"),
(agent_get_horse,":caster_horse",":caster"),
(play_sound,"snd_balefire"),
(assign,":low",0),
(assign,":high",400),
(assign,":index",0),
(try_for_range,":index",":low",":high"),
(particle_system_burst, "psys_bind", pos1, 1),
(position_move_x,pos1,12),
(position_move_z,pos1,0),
(position_move_y,pos1,10),
(try_for_agents,":agent"),
(neq,":agent",":caster"),
(neq,":agent",":caster_horse"),
(agent_get_team,":caster_team", ":caster"),
(agent_get_team,":agent_team", ":agent"),
(teams_are_enemies,":caster_team", ":agent_team"),
(agent_get_position, pos2, ":agent"),
(get_distance_between_positions,":dist",pos1,pos2),
(lt,":dist",100),
(agent_set_slot,":agent",slot_agent_is_bound,":caster"),
(position_get_y,":y",pos2),
(position_get_x,"",pos2),
(agent_set_slot,":agent",slot_agent_bound_x,""),
(agent_set_slot,":agent",slot_agent_bound_y,":y"),
(assign,":high",":index"),
(end_try),
(end_try),],)]],
___________________________________
Here is the trigger in mission_templates
___________________________________
shadow_rising_bind = (
0.005, 0, 0, [],[
(try_for_agents,":agent"),
(agent_is_alive,":agent"),
(agent_get_slot,":caster",":agent",slot_agent_is_bound),#slot should be filled with id of caster if bound
(ge,":caster",1),
(agent_is_alive,":caster"),
(agent_get_slot,":bound_x",":agent",slot_agent_bound_x),
(agent_get_slot,":bound_y",":agent",slot_agent_bound_y),
(agent_get_position,pos45,":agent"),
(copy_position,pos46,pos45),
(position_set_x,pos46,":bound_x"),
(position_set_y,pos46,":bound_y"),
(position_set_z_to_ground_level, pos46),
(agent_set_scripted_destination,":agent",pos46,1),#need to find out how to freeze bound agent
(get_distance_between_positions,":dist",pos46,pos45),
(gt,":dist",100),
(agent_set_position,":agent",pos46),
(agent_get_horse,":horse",":agent"),
(gt,":horse",0),
(agent_set_position,":horse",pos46),
(try_end),
(try_for_agents,":agent"), #if caster dies remove bind
(agent_is_alive,":agent"),
(agent_get_slot,":caster",":agent",slot_agent_is_bound),
(ge,":caster",1),
(neg|agent_is_alive,":caster"),
(agent_set_slot,":agent",slot_agent_is_bound,0),
(agent_clear_scripted_mode,":agent"),
(try_end),
])
___________________________________
Slots I've defined for this
___________________________________
slot_agent_is_bound = 25
slot_agent_bound_x = 26
slot_agent_bound_y = 27
Hopefully someone will be able to see something I'm missing.