ItsMods

Full Version: Make Trees Fall
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

This will make that when you shot a tree, it will fall down.

Example of usage:

Code:
treee = spawn( "script_model", self.origin );
treee setModel( "foliage_cod5_tree_pine05_large_animated" );
treee thread CanFall();

Code:

Code:
CanFall()
{
    self setCanDamage( true );
    for( ; ; )
    {
        self waittill( "damage", damage, attacker, direction_vec, point );
        if( ! isPlayer( attacker ) )
            continue;
        if( randomInt( 5 ) != 3 ) //Put the number inside the randomInt higher to make it stronger
            continue;
        break;
    }
    treeorg = spawn( "script_origin", self.origin );
    pos1 = ( point[0], point[1], 0 );
    pos2 = ( self.origin[0], self.origin[1], 0 );
    treeorg.angles = vectorToAngles( pos1 - pos2 );
    pos1new = ( point[0], point[1], 0 );
    pos2new = ( self.origin[0], self.origin[1], 0 );
    treeorg.angles = VectorToAngles( pos1new - pos2new );
    self linkTo( treeorg );
    treeorg rotatePitch( -90, 1.1, 0.05, 0.2 );
    treeorg waittill( "rotatedone" );
    treeorg rotatePitch( 5, 0.21, 0.05, 0.15 );
    treeorg waittill( "rotatedone" );
    treeorg rotatePitch( -5, 0.26, 0.15, 0.1 );
    treeorg waittill( "rotatedone" );
    self Unlink();
    treeorg delete();
}
old , might as well put in the wind function aswell
al tyr it right nwo adding it to horse
(04-01-2012, 12:23)rotceh_dnih Wrote: [ -> ]old , might as well put in the wind function aswell

Old? The wind function is useless in MW2.
haha lol shizzle @Yamato
(04-01-2012, 12:36)Yamato Wrote: [ -> ]
(04-01-2012, 12:23)rotceh_dnih Wrote: [ -> ]old , might as well put in the wind function aswell

Old? The wind function is useless in MW2.

No, it's not. You can also make the three animated by adding a targetname or something like that.
(04-01-2012, 12:53)Rendflex Wrote: [ -> ]
(04-01-2012, 12:36)Yamato Wrote: [ -> ]
(04-01-2012, 12:23)rotceh_dnih Wrote: [ -> ]old , might as well put in the wind function aswell

Old? The wind function is useless in MW2.

No, it's not. You can also make the three animated by adding a targetname or something like that.

Or scriptmodelplayanim("foliage_cod5_tree_pine05_large_sway");
no photo no how to install it please make a iwd file
(06-14-2013, 20:11)Nero Z zero Wrote: [ -> ]no photo no how to install it please make a iwd file

again, buy it.
and you might have been missed that this is the " Scripts and Code Snippets" section, thats not a pre compiled mod.

also take your time and read through the modding tutorials, then take also more time and try to implement it by yourself.