Results 1 to 10 of 32

Thread: Modify SD Bombs

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Brigadier General
    Join Date
    Oct 2012
    Posts
    998
    Thanks
    20
    Thanked 590 Times in 390 Posts
    Quote Originally Posted by Loveboy View Post
    Can you give me an example for replace the model with new models via script?
    OK, here it is:

    Before:



    After:



    And here is a (bad quality) video of the whole gametype working, with solid models:

    http://www.youtube.com/watch?v=Vlr4A...ature=youtu.be

    It was acheived with a very basic function to delete the existing bombzone model, and replace it with another:

    PHP Code:
    replaceModels()
    {
        
    level.saved_origin = [];
        
        
    entitytypes getentarray();
        for( 
    0entitytypes.sizei++ )
        {
            if( 
    isdefinedentitytypes[i].script_gameobjectname ) )
            {
                
    gameobjectnames strtokentitytypes[i].script_gameobjectname" " );
                
                for( 
    0gameobjectnames.sizek++ )
                {
                    if( 
    gameobjectnames[k] == "bombzone" )
                    {    
                        if( 
    entitytypes[i].classname == "script_model" )
                        {
                            
    level.saved_origin[level.saved_origin.size] = entitytypes[i].origin;
                            
    entitytypes[idelete();
                        }
                    }
                }

            }
        }

        for( 
    i=0level.saved_origin.sizei++ )
        {
            
    replace spawn"script_model"level.saved_origin[i] );
            
    replace setModel"xmodel/vehicle_halftrack_rockets_snow_static" );
        }

    When the bomb explodes, you have to delete the static model, and replace it with a destroyed model (because the script exploders wont work on the new models):

    PHP Code:
    deleteModel()
    {
        
    entitytypes getentarray();
        for( 
    0entitytypes.sizei++ )
        {
            if( 
    entitytypes[i].classname == "script_model" )
            {
                if( 
    entitytypes[i].model == "xmodel/vehicle_halftrack_rockets_snow_static" )
                {
                    
    replaceDestroyed spawn"script_model"entitytypes[i].origin );
                    
    replaceDestroyed setModel"xmodel/vehicle_halftrack_rockets_woodland_d_stat" );
                    
                    
    entitytypes[iplaysound"flak88_explode" );
                    
    entitytypes[idelete();
                }
            }
        }

    Here is a download for the complete SD code with added functions:

    DOWNLOAD

  2. The Following 5 Users Say Thank You to Tally For This Useful Post:

    kung foo man (15th October 2013),Loveboy (15th October 2013),Ni3ls (16th October 2013),RobsoN (16th October 2013),YuriJurek (15th October 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •