replace scene_prop on break

Users who are viewing this thread

Hello friends,
I have created a glass bottle to break it in single as in multiplayer, with saber or with shots.
The code I copied it from the element "gourd", but I want that after breaking this bottle an already broken one appears. I have the bottle, the broken bottle, the particles and the sound, I just need to know what to add to make that broken bottle appear, without the game crashing, since without the spawn line, everything is perfect.
The code is the following
Code:
("botella",sokf_moveable|sokf_destructible|spr_hit_points(1),"botella","bo_botella",
  [
    (ti_on_init_scene_prop,
    [
        (store_trigger_param_1, ":instance_no"),
        (scene_prop_set_hit_points, ":instance_no", 1),
    ]),
    (ti_on_scene_prop_destroy,
    [
        (store_trigger_param_1, ":instance_no"),
        (val_add, "$g_last_destroyed_gourds", 1),
        (prop_instance_get_position, pos1, ":instance_no"),
        (copy_position, pos2, pos1),
        (position_set_z, pos2, -100000),
        (particle_system_burst, "psys_dummy_straw", pos1, 2),
        (particle_system_burst, "psys_prt_botella1_q1", pos1, 1),
        (particle_system_burst, "psys_prt_botella1_q2", pos1, 15),
        (particle_system_burst, "psys_prt_botella1_q3", pos1, 1),
        (prop_instance_animate_to_position, ":instance_no", pos2, 1),
#        (spawn_scene_prop, "spr_botella_destruida"),
        (play_sound, "snd_vidrio_roto"),
    ]),
    (ti_on_scene_prop_hit,
    [
        (play_sound, "snd_vidrio_roto"),
        (particle_system_burst, "psys_dummy_straw", pos1, 10),
    ]),
]),
Thanks in advance
 

Thank you, the _Sebastian_ code in the second link, it worked ...
then... the code would look like this:
Code:
("botella_multi",sokf_moveable|sokf_destructible|spr_use_time(1),"botella","bo_botella",[
 (ti_on_init_scene_prop,
[
(store_trigger_param_1, ":instance_no"),
(scene_prop_set_hit_points, ":instance_no", 1),
]),
(ti_on_scene_prop_destroy,
    [
      (this_or_next|multiplayer_is_server),
      (neg|game_in_multiplayer_mode),
      (store_trigger_param_1, ":instance_id"),
      (prop_instance_get_position, pos1, ":instance_id"),
      (set_spawn_position, pos1),
      (spawn_scene_prop, "spr_botella_destruida"),
      (position_set_z, pos1, -10000),
      (particle_system_burst, "psys_dummy_straw", pos1, 10),
      (particle_system_burst, "psys_prt_botella1_q1", pos1, 1),
      (particle_system_burst, "psys_prt_botella1_q2", pos1, 5),
      (particle_system_burst, "psys_prt_botella1_q3", pos1, 5),
      (prop_instance_set_position, ":instance_id", pos1, 0),
      (play_sound, "snd_vidrio_roto"),
    ]),
(ti_on_scene_prop_hit,
[
(play_sound, "snd_vidrio_roto"),
(particle_system_burst, "psys_dummy_straw", pos1, 10),
]),
]),
 
Upvote 0
Back
Top Bottom