Hello. I trying to make simple landmine that shoots arrows in every direction when enemy agent is close enough. Everything works well apart position of "explosion".
It doesn't explode in position of mine, but instead start's on agent who is defined as "shooter" in "add_missile" command. In whole script position of "shooter" isnt even stored in any variable so Im really confused. Someone can help me?
Here is init trigger in module_scene_props that set's owner.
It doesn't explode in position of mine, but instead start's on agent who is defined as "shooter" in "add_missile" command. In whole script position of "shooter" isnt even stored in any variable so Im really confused. Someone can help me?
Code:
(0, 0, 3, [], #emiel
[
(try_for_prop_instances, ":prop", "spr_wood_a"),
(prop_instance_get_position, pos1, ":prop"),
(try_for_agents, ":agent"),
(agent_get_player_id, ":player", ":agent"),
(neq, "$owner", ":player"),
(agent_get_position, pos2, ":agent"),
(get_distance_between_positions, ":distance", pos1, pos2),
(lt, ":distance", 400),
(position_get_distance_to_ground_level, ":distance", pos1),
(try_begin),
(lt, ":distance", 0),
(position_set_z_to_ground_level, pos1),
(position_move_z, pos1, 200),
(try_end),
(agent_play_sound, ":agent", "snd_cow_moo"),
(player_get_agent_id, ":owner", "$owner"),
(try_for_range, ":unused", 1, 50),
(copy_position, pos2, pos1),
(store_random_in_range, ":x_offset", 1, 361),#Random Rotation of X
(position_rotate_x, pos2, ":x_offset"),
(store_random_in_range, ":y_offset", 1, 361),#Random Rotation of Y
(position_rotate_y, pos2, ":y_offset"),
(store_random_in_range, ":z_offset", 1, 361),#Random Rotation of Z
(position_rotate_z, pos2, ":z_offset"),
(add_missile, ":owner", pos2, 1500, "itm_sniper_crossbow", 0, "itm_heavy_throwing_axes", 0),
(try_end),
(particle_system_burst,"psys_dummy_smoke_big",pos1,40),
#(init_position, pos1),
#(prop_instance_set_position, pos1, ":prop"),
(try_end),
(try_end),
Here is init trigger in module_scene_props that set's owner.
Code:
(ti_on_init_scene_prop,
[
(store_trigger_param_1, ":prop"),
(prop_instance_get_position, pos1, ":prop"),
(try_for_agents, ":agent"),
(agent_get_position, pos2, ":agent"),
(get_distance_between_positions, ":distance", pos1, pos2),
(lt, ":distance", 50),
(agent_get_player_id, "$owner", ":agent"),
(try_end),
]),