Author Topic: Can someone help me with creating destroyable and usable scene prop?  (Read 2338 times)

0 Members and 1 Guest are viewing this topic.

Offline Ivkolya

  • Sergeant Major
  • *
  • Posts: 333
    • View Profile
  • Nick: Ivkolya
  • Side: Neutral
Hi again, sorry for another topic.
I've made shield, made of ropes, to cover an embrasure. I need it to be destructible and also it must have option of closing and opening like this:

Spoiler
Closed shield



Opened shield



[close]

I figured out how to make it destructible (but also I wonder, how can I make it destroy without that wooden sound and particles). Problem is with opening/closing. Basically, on using shield (like door) closed shield mesh must be replaced with opened shield mesh, but I don't know how to write it in the module system. So maybe someone can help me with this? :)

Offline Aternox

  • Second Lieutenant
  • *
  • Posts: 45
  • A prayer's as good as a bayonet on a day like this
    • View Profile
  • Side: Neutral
For destroying without the sound/particles, in m_scripts goto script_get_destruction_properties_of_object and go down to

Code
        (this_or_next|is_between, ":prop_kind_id", "spr_door_destructible", "spr_doors_end"),
        (this_or_next|is_between, ":prop_kind_id", "spr_mm_stakes", "spr_mm_dummy"),
        (eq,":prop_kind_id","spr_mm_dummy"),
        (assign,":smoke_type","psys_dummy_smoke"),
        (assign,":smoke_strength",100),
        (assign,":sound_id", "snd_dummy_destroyed"),
and change your rope door to be out of that range

As for opening/closing problem do you mean when the door opens the mesh should be completely gone? Or do you mean the prop is reversed ingame - it says to open door when it's opened?

Offline Ivkolya

  • Sergeant Major
  • *
  • Posts: 333
    • View Profile
  • Nick: Ivkolya
  • Side: Neutral
Thank you again, Aternox!

As for opening/closing problem do you mean when the door opens the mesh should be completely gone? Or do you mean the prop is reversed ingame - it says to open door when it's opened?
This mesh consists of wooden plank and rope shield, in opened position there is only wooden plank visible (or I can make a mesh of this plank coiled by rope shield) - so there is possibility of closing it again. I hope you can understand what I mean:)

Offline Aternox

  • Second Lieutenant
  • *
  • Posts: 45
  • A prayer's as good as a bayonet on a day like this
    • View Profile
  • Side: Neutral
Ok, so the question is how to change the opening/closing animation?

Offline Ivkolya

  • Sergeant Major
  • *
  • Posts: 333
    • View Profile
  • Nick: Ivkolya
  • Side: Neutral
yes, or how to replace one mesh with another (or one frame of vertex animation with another) after "activating" it (i.e. after holding "use" button) and placing back first mesh (or frame) after another "activation".

Offline Aternox

  • Second Lieutenant
  • *
  • Posts: 45
  • A prayer's as good as a bayonet on a day like this
    • View Profile
  • Side: Neutral
The door animation is in m_scripts at the bottom of script_use_item

Code
  (this_or_next|eq, ":scene_prop_id", "spr_castle_f_door_a"),
           (eq, ":effected_object", "spr_mm_restroom_door"),
       
           (assign, ":effected_object_instance_id", ":instance_id"),
           (scene_prop_get_slot, ":opened_or_closed", ":effected_object_instance_id", scene_prop_open_or_close_slot),

           (try_begin),
             (eq, ":opened_or_closed", 0),

             (prop_instance_get_starting_position, pos10, ":effected_object_instance_id"),

             (scene_prop_enable_after_time, ":effected_object_instance_id", 100),
             
             (assign,":rotation_change",85),
             (try_begin),
               (neq, ":scene_prop_id", "spr_viking_keep_destroy_sally_door_left"),
               (neq, ":scene_prop_id", "spr_earth_sally_gate_left"),
               
               (assign,":rotation_change",-85),
             (try_end),
             
             (prop_instance_get_variation_id,":combined_val",":effected_object_instance_id"),
             (store_div, ":reversed_rotation", ":combined_val", 10),
             # (store_mod, ":owner_team", ":combined_val", 10),
             
             #(prop_instance_get_variation_id_2,":reversed_rotation",":effected_object_instance_id"),
             (try_begin),
               (eq,":reversed_rotation",1),
               
               (val_mul,":rotation_change",-1),
             (try_end),
             
             (position_rotate_z, pos10, ":rotation_change"),
             
             (prop_instance_animate_to_position, ":effected_object_instance_id", pos10, 100),
Also take a look at part of m_scripts script_game_recieve_network_message at           
Code
(eq, ":event_type", multiplayer_event_set_scene_prop_open_or_close),
under that I think would need to be edited too

If you just want the prop to disappear when activated and spawn the rope coil plank, and opposite for closing without a moving animation you could try and make a script that's summarised as:

Spoiler
-save door prop health
-script_clean_up_prop_instance 'rope_door' #remove door
-script_find_or_create_scene_prop_instance 'rope_coil_plank' #add ropecoilplank
-set 'rope_coil_plank' as old prop health

and reversed for closing
[close]

but depends what exactly you want to do about animation
« Last Edit: May 11, 2018, 08:11:28 pm by Aternox »

Offline Ivkolya

  • Sergeant Major
  • *
  • Posts: 333
    • View Profile
  • Nick: Ivkolya
  • Side: Neutral
Re: Can someone help me with creating destroyable and usable scene prop?
« Reply #6 on: June 08, 2018, 09:51:04 am »
Thank you, I'll try to figure it out :)



And another question (I'm asking here - since my questions are rarely answered to in Q&A topic, and to not to create new topic):

Are there some restrictions for size of an object on the scene? As example, I want to make a mesh, which will cover an entire scene. I made the mesh, imported it in the scene as scene prop of small size, but it disappears after scaling it 1000% in the scene. When I scaled it in OpenBRF to be 100 times bigger, it is imported in the scene as a blank object. So I wonder, how can I make scene prop, which will cover an entire scene?

Offline Aternox

  • Second Lieutenant
  • *
  • Posts: 45
  • A prayer's as good as a bayonet on a day like this
    • View Profile
  • Side: Neutral
Re: Can someone help me with creating destroyable and usable scene prop?
« Reply #7 on: June 10, 2018, 03:40:02 pm »
Are there some restrictions for size of an object on the scene? As example, I want to make a mesh, which will cover an entire scene. I made the mesh, imported it in the scene as scene prop of small size, but it disappears after scaling it 1000% in the scene. When I scaled it in OpenBRF to be 100 times bigger, it is imported in the scene as a blank object. So I wonder, how can I make scene prop, which will cover an entire scene?
I'm afraid I've never tried to make such a massive scene prop in game lol, however I don't see why it would do that. I guess you've tried making the prop the size of a small building and then in the scene editor scaling it by 50-100? so it's kind of a mix of techniques. (x1000 scale size does seem pretty extreme)

I'm curious though, what are you making? like a new skybox thing or a map smoke particle effect?

Offline Ivkolya

  • Sergeant Major
  • *
  • Posts: 333
    • View Profile
  • Nick: Ivkolya
  • Side: Neutral
Re: Can someone help me with creating destroyable and usable scene prop?
« Reply #8 on: June 12, 2018, 11:24:48 pm »
Thank you for the answer, I forgot to delete it here :)

Yes, I exported a small object and made it 100 times bigger in in-game editor and also in OpenBRF and it caused that object to disappear, but when I made it bigger in 3Ds Max, all worked fine :)

I'm making for my Crimean war mod a scene of Sevastopol and it's landscape, and I want 3D-mesh of Sevastopol's terrain (I made one already) to be the ground in the scene. It will be something like players fighting on scaled model of Sevastopol's terrain. I want to add some schematic little models of fortifications and buildings inside and outside of Sevastopol (like on the global map of Warband), so players will learn more about terrain, where fightings of Crimean war were.
And another reason - I want try to make 1:1 scaled mesh of terrain to be ground in a scene, so terrain will be accurate and outer terrain will be accurate too and so scene will seam endless and it will increase realism of a scene (or maybe it will not work out, but I will try :))