Someone_forgotten
Mortar Scripts(You may use it for a catapult, cannon or something).
Get it from here;
http://oguzcan.diinoweb.com/files/mortar.py
I've rewrited this codes from nothing and never tried. But it should work.
And don't forget to assign scene props. And you have to add them to scene. I could give you some example models. But I don't have them.
Get it from here;
http://oguzcan.diinoweb.com/files/mortar.py
Code:
#things must be set before fight.
(0, 0, ti_once, [], [
(assign,"$action_in_mortar",0),
(assign,"$mortar_ammo",4), #This is you ammo number, type it one less.
]),
#Mortar.
#entering and leaving mortar begin;
(1, 0, 0, [(key_is_down, key_e),(eq,"$action_in_mortar",0)], [ #You can change this button to another. See header_triggers for referances.
(scene_prop_get_instance,":m_instance", "spr_mortar", 0),
(prop_instance_get_position,pos1,":m_instance"),
(get_player_agent_no,":player_agent"),
(agent_get_position,pos2,":player_agent"),
(get_distance_between_positions,":m_p_distance",pos1,pos2),
(try_begin),
(lt,":m_p_distance",300),
(assign,"$action_in_mortar",1),
(try_end),
]),
(0.1, 0, 0, [(eq,"$action_in_mortar",1)], [
(scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
(prop_instance_get_position,pos1,":m_c_instance"),
(position_set_z_to_ground_level, pos1),
(prop_instance_set_position,":m_c_instance",pos1),
(assign,"$action_in_mortar",2),
(display_message,"str_mortar_is_ready"),
(mission_cam_set_mode,1),
(entry_point_get_position, pos2, 30), #You have to add an entry point from edit mode. You'll look from this entry points position when you entered mortar. And make its entry_num 30
(mission_cam_set_position, pos2),
]),
(1, 0, 0, [(key_is_down, key_e),], [
(mission_cam_set_mode,0),
(assign,"$action_in_mortar",0),
(scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
(prop_instance_get_position,pos1,":m_c_instance"),
(position_move_z,pos1,20000),
(prop_instance_set_position,":m_c_instance",pos1),
]),
#entering and leaving mortar end*******************
#navigating mortar begin;
(0.1, 0, 0, [(key_is_down, key_left),(eq,"$action_in_mortar",2),], [
(scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
(prop_instance_get_position,pos1,":m_c_instance"),
(position_move_x,pos1,200), #After your try. If somethings wrong about coordinates. example: you pushing right and its going somewhere else than right. Just change this coordinates. And try again.
(position_set_z_to_ground_level, pos1),
(prop_instance_set_position,":m_c_instance",pos1),
]),
(0.1, 0, 0, [(key_is_down, key_right),(eq,"$action_in_mortar",2),], [
(scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
(prop_instance_get_position,pos1,":m_c_instance"),
(position_move_x,pos1,-200),
(position_set_z_to_ground_level, pos1),
(prop_instance_set_position,":m_c_instance",pos1),
]),
(0.1, 0, 0, [(key_is_down, key_down),(eq,"$action_in_mortar",2),], [
(scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
(prop_instance_get_position,pos1,":m_c_instance"),
(position_move_y,pos1,200),
(position_set_z_to_ground_level, pos1),
(prop_instance_set_position,":m_c_instance",pos1),
]),
(0.1, 0, 0, [(key_is_down, key_up),(eq,"$action_in_mortar",2),], [
(scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
(prop_instance_get_position,pos1,":m_c_instance"),
(position_move_y,pos1,-200),
(position_set_z_to_ground_level, pos1),
(prop_instance_set_position,":m_c_instance",pos1),
]),
#navigating mortar end*******************
#*******!:D
(0.1, 0.5, 0, [(key_is_down, key_numpad_0),], [
(try_begin),
(eq,"$action_in_mortar",2),
(assign,"$action_in_mortar",3),
(play_sound, "snd_mortar_missile"), #You have to assign this and other sounds from module_sounds.
(else_try),
(eq,"$action_in_mortar",3),
(display_message,"str_mortar_isnt_ready"), #You need to assign this and other messages from module_strings.py
(else_try),
(eq,"$action_in_mortar",4),
(display_message,"str_mortar_no_ammo"),
(try_end),
]),
(0.1, 0.9, 0, [(eq,"$action_in_mortar",3),], [ # you may change 0.9 for difference of the sound. boom noise starting in 0.9 s.I'm talking about this: snd_mortar_missile
(scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
(prop_instance_get_position,pos1,":m_c_instance"),
(particle_system_burst,"psys_village_fire_big",pos1,150), #You may change this to smoke or someting better when using this code for catapult
(particle_system_burst, "psys_village_fire_smoke_big",pos1,300),
(assign, ":killed_bastards", 0),
(get_player_agent_no,":player_agent"),
(try_for_agents,":agents"),
(agent_is_alive, ":agents"),
(agent_get_position,pos2,":agents"),
(get_distance_between_positions,":boom_distance",pos1,pos2),
(try_begin),
(lt,":boom_distance",600),
(agent_set_hit_points,":agents",0,0),
(agent_deliver_damage_to_agent,":player_agent",":agents"),
(val_add, ":killed_bastards", 1),
(try_end),
(try_end),
(assign, reg5, ":killed_bastards"),
(display_message,"str_mortar_shot"),
(position_move_z,pos1,10000),
(prop_instance_set_position,":m_c_instance",pos1),
]),
(0.1, 5, 0, [(eq,"$action_in_mortar",3),], [
(try_begin),
(eq,"$mortar_ammo",0),
(assign,"$action_in_mortar",4),
(else_try),
(assign,"$action_in_mortar",2),
(val_sub,"$mortar_ammo",1),
(display_message,"str_mortar_is_ready"),
(try_end),
]),
(0.1, 2, 0, [(eq,"$action_in_mortar",3),], [
(scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
(prop_instance_get_position,pos1,":m_c_instance"),
(position_set_z_to_ground_level, pos1),
(prop_instance_animate_to_position,":m_c_instance",pos1,300),
]),
I've rewrited this codes from nothing and never tried. But it should work.
And don't forget to assign scene props. And you have to add them to scene. I could give you some example models. But I don't have them.