Results 1 to 2 of 2

Thread: [Tutorial] Making a TimeBomb with Trigger

  1. #1
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    116
    Thanks
    93
    Thanked 69 Times in 35 Posts

    [Tutorial] Making a TimeBomb with Trigger

    Hey

    I'm going to show (for those who don't know) how to make a bomb, so when you press F it appears and after a few seconds it explodes. The tutorial is step-by-step, so don't worry, you will understand it easily.

    First, open Radiant and make a wall, like this:

    Click image for larger version. 

Name:	tut1yw.jpg 
Views:	58 
Size:	111.2 KB 
ID:	157

    After doing that, make a copy of that wall and select one of them, do right click on the 2d view and select script->brushmodel. Give the wall these values:

    Click image for larger version. 

Name:	tut2o.jpg 
Views:	56 
Size:	124.9 KB 
ID:	158

    Move the wall you asigned these values out of the other one, so you won't confuse, and after that, select the other wall and "destroy" it:

    Click image for larger version. 

Name:	tut3a.jpg 
Views:	57 
Size:	114.7 KB 
ID:	159

    (Note: to make decals, make a brush, give the texture nodraw_decal, inside Tools, select one face of the brush and give it a decal).


    Once done that, select all of the destroyed wall, including the decals and details you put, and give them these values:

    Click image for larger version. 

Name:	tut4u.jpg 
Views:	57 
Size:	133.1 KB 
ID:	160

    Ok you made it, now put the first wall (before) exactly over the one you've done now. We're gonna put the bomb. Do right click on the 2d view, script->model. Search for the bomb model (military_tntbomb). If you don't know how to put models, there's a topic inside this forum). Put the bomb wherever you want, press N and give it these values:

    Click image for larger version. 

Name:	tut5h.jpg 
Views:	55 
Size:	130.0 KB 
ID:	161


    Now make a trig_use_touch over the bomb and give it these values:

    Click image for larger version. 

Name:	tut6b.jpg 
Views:	56 
Size:	140.9 KB 
ID:	162

    Make a script_origin in the bomb, like this, and give the following values (this will set the origin of the explosion and the sound):

    Click image for larger version. 

Name:	tut7m.jpg 
Views:	60 
Size:	131.5 KB 
ID:	163

    And the mapping part is done!

    Now let's script. You will need to script a gsc.

    For the gsc:

    PHP Code:
    main()
    {
        
    //mapstuff.....
        
        //functions
        
    thread precachefx();
        
    thread bomb();
    }

    precachefx()

    {
    //loads the given effect so you
    //can use this effect anywhere in you script
    //without needing to be loaded again
    level._effect["explosion"] = loadfx("fx/props/barrelexp.efx");
    }

    bomb()
    {
    //first we define the variables

    before getent("wallbefore","targetname");
    after getent("wallafter","targetname");
    bomb getent("bomb","targetname");
    trig_bomb getent("trig_bomb","targetname");
    origin getent("origin_bomb","targetname");

        while(
    1)
        {
        
        
    //hide the bomb and the wall at first
        
        
    bomb hide();
        
    after hide();
        
    after notsolid();
        
        
    //someone puts the bomb
        
        
    trig_bomb waittill("trigger",user);
        
    playfx(level._effect["explosion"],origin.origin);
        
    bomb show();
        
    user iprintlnbold("Bomb Planted");
        
    user iprintlnbold("Will explode in a few seconds");
        
    origin playsound("MP_bomb_plant");
        
    origin playloopsound("bomb_tick");
        
        
    //the bomb is shown and starts
        //to play a tictac
        
        
    wait(5);
        
        
    //wait 5 seconds until the bomb
        //explodes
        
        
    origin stoploopsound();
        
    earthquake0.53origin.origin900 );
        
    radiusDamage(origin.origin25030020);
        
    playfx(level._effect["explosion"],origin.origin);
        
    origin playsound("mortar_explosion3");
        
        
    //do an earthquake, radius damage
        //and plays the sound and the effect
        //for more info about radiusdmg
        //and the earthquake
        //see the docs section
        
        
    before delete();
        
    trig_bomb delete();
        
    bomb delete();
        
    after show();
        
    after solid();
        
        
    //the old wall, the trig
        //and the bomb delete
        //and the destroyed wall
        //is shown
        
        
    break;
        
        
    //so the loop wont repeat again
        //if you want another bomb in the
        //same place, just put a wait
        //command
        
    }

    And the bomb is done! You could do it other ways, but this one is more easy. For more info about radiusdamage and earthquake, go to CoD2/Docs/Script Functions and look for it

    Maybe I've comit mistakes, because I made this tutorial very fast, 1 hour lol, and not in my computer (still in the cyber) so if there is, I hope you understand it

    Pollo
    Last edited by pollo; 19th February 2013 at 17:58.

  2. The Following 7 Users Say Thank You to pollo For This Useful Post:

    Earliboy (19th February 2013),EvoloZz (19th February 2013),Jared (19th February 2013),Jeplaa (20th February 2013),Killer.Pro (20th February 2013),kung foo man (19th February 2013),STAUFFi (19th February 2013)

  3. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Hey, nice tutorial

    I've replaced [code] with [php], so the script is colored now.

    Also replaced the external images, since they are important and shouldnt be deleted for whatever-reason. Please use next time the attachment-system directly
    timescale 0.01

Posting Permissions

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