OSP Code Combat Molotov Grenade Very Simple! (Requires WSE)

Users who are viewing this thread


Knight at Arms
Put this in module_items.py where ever you want:
["molotof", "Throwing Daggers", [("throwing_dagger",0)], itp_type_thrown |itp_primary ,itcf_throw_knife, 0 , weight(3.5)|difficulty(0)|spd_rtng(102) | shoot_speed(25) | thrust_damage(16 ,  cut)|max_ammo(14)|weapon_length(0),imodbits_missile,
         (ti_on_missile_hit, [
		     (position_get_x, ":x", pos1),
	         (position_get_y, ":y", pos1),
	         (position_get_z, ":z", pos1),
			 (val_add, ":z", 150),
		 (call_script, "script_create_molotov", 6, 100, 4, "spr_fire_big", ":x", ":y", ":z"),
Put this in module_scripts.py:
        (store_script_param, ":layer_count", 1),#count of layer of circles
(store_script_param, ":distance", 2),#distance betweeen layers
(store_script_param, ":eek:bj_count", 3),#multiplier of count of objects in circles
(store_script_param, ":scene_prop", 4),#type of scene prop will be spawned (0 if it wil be random -- not yet -- )
(store_script_param, ":pos_x", 5),
(store_script_param, ":pos_y", 6),
(store_script_param, ":pos_z", 7),

(position_set_x, pos1, ":pos_x"),
(position_set_y, pos1, ":pos_y"),
(position_set_z, pos1, ":pos_z"),

(try_for_range, ":layer", 0, ":layer_count"),
(copy_position, pos2, pos1),
(store_mul, ":eek:bject_count", ":layer", ":eek:bj_count"),
(store_div, ":min_angle", 360, ":eek:bject_count"),

(try_for_range, ":cur_obj", 0, ":eek:bject_count"),

(store_mul, ":cur_angle", ":min_angle", ":cur_obj"),
(store_mul, ":dist", ":layer", ":distance"),
(copy_position, pos3, pos2),
(position_rotate_z, pos3, ":cur_angle"),
(position_move_y, pos3, ":dist"),
(position_set_z_to_ground_level, pos3),

(copy_position, pos7, pos1),
(position_move_z, pos7, 150),

(position_get_vector_to_position, ":vector_lenght", pos4, pos7, pos3),
(cast_ray, ":hit_inst", pos5, pos4, 9999999),
(set_spawn_position, pos7),
(spawn_scene_prop, ":scene_prop"),
(prop_instance_animate_to_position, reg0, pos5, 50),


And put this in module_mission_templates.py file. You can use it any mt you want. Just add this in trigger blocks.
common_burn_by_fire = (
1, 0, 0, [],
          (scene_prop_get_num_instances, ":num_instances", "spr_fire_big"),
      (try_for_range, ":instance_no", 0, ":num_instances"),
        (scene_prop_get_instance, ":instance_id", "spr_fire_big", ":instance_no"),
                (prop_instance_get_position, pos1, ":instance_id"),
                (try_for_agents, ":agent_no"),
        (agent_get_position, pos2, ":agent_no"),
        (get_distance_between_positions, ":dist1", pos1, pos2),
        (le, ":dist1", 85),
                (agent_deliver_damage_to_agent, ":agent_no", ":agent_no", 2),

That's it.


Feel free to use, edit and improve this code. Not need to any credits.
Sorry to necro, but I can't understand where to add it in module_mission_templates, because regardless of where I put it, the compiler tells me that there's an invalid syntax, pointing at
common_burn_by_fire = (
Either I'm missing something, or something's changed between MS versions.
Top Bottom