("destructible_wall_damage_receive",
[
(store_script_param_1, ":projectile_instance"),
(store_script_param_2, ":wall_instance"),
(store_script_param , ":damage", 3),
(try_begin),
(multiplayer_is_server),
(game_in_multiplayer_mode),
(assign, ":wall_hitpoints", wall_health), # wall health is 2500
(this_or_next|scene_prop_get_instance, ":projectile_instance", "spr_mp_cannonball_3lb"), #get instances
(this_or_next|scene_prop_get_instance, ":projectile_instance", "spr_mp_cannonball_6lb"),
(scene_prop_get_instance, ":projectile_instance", "spr_mp_cannonball_12lb"),
(prop_instance_get_position, pos1, ":projectile_instance"), #get the positions of instances
(prop_instance_get_position, pos2, ":wall_instance"),
(prop_instance_is_valid, ":wall_instance"), # ask that props are valid
(prop_instance_is_valid, ":projectile_instance"),
(get_distance_between_positions, ":destination", pos1, pos2), # if it is valid, ask the distance between them
(le, ":destination", 5), # check if distance between them is lower than 5
(try_begin), # start the party :)
(eq, ":projectile_instance", "spr_mp_cannonball_3lb"),
(assign, ":damage", 200),
(val_sub, ":damage", ":wall_hitpoints"), #subtract the damage number i assigned to cannonball from wall_hitpoints.
(display_message, "@debug: delivered 200 damage with 3lb ball!"),
(else_try),
(eq, ":projectile_instance", "spr_mp_cannonball_6lb"),
(assign, ":damage", 400),
(val_sub, ":damage", ":wall_hitpoints"),
(display_message, "@debug: delivered 200 damage with 6lb ball!"), # show a note for debug.
(else_try),
(eq, ":projectile_instance", "spr_mp_cannonball_12lb"),
(assign, ":damage", 750),
(val_sub, ":damage", ":wall_hitpoints"),
(display_message, "@debug: delivered 200 damage with 12lb ball!"),
(try_end),
(try_end),
]),
("destructible_wall_init",
[
(store_script_param_1, ":wall_instance"),
(store_script_param_2, ":wall_hitpoints"),
(try_begin),
(assign, ":wall_hitpoints", wall_health), # wall_health is 2500
(try_for_range, ":wall_instance", walls_begin, walls_end), # try for the walls i signed
(try_begin), # start the destroying
(le, ":wall_hitpoints", 0), # if wall hitpoints is equal to 0 or lower than 0
(play_sound, "snd_dummy_destroyed"), # play the sound
(prop_instance_get_position, pos1, ":wall_instance"), #get the instance
(particle_system_burst, "psys_dummy_smoke", pos1, 15), # handle the particles
(particle_system_burst, "psys_dummy_straw", pos1, 25),
(try_begin),# start the replacing with an empty prop.
(multiplayer_is_server),
(set_spawn_position, pos1),
(spawn_scene_prop, "spr_empty"),# spawn the empty prop
(position_set_z, pos1, -1200),
(prop_instance_animate_to_position, ":wall_instance", pos1, 4), # move the destroyed wall to underground. But i want that make in 4 secons, i dont know i did correctly.
(prop_instance_clear_attached_missiles, ":wall_instance"), # clear the arrows attached to wall, if i dont do that, missiles will be stay in air.
(try_end),
(try_end),#end...
]),