ItsMods

Full Version: Spawn Polygons and Pyramids
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

Another release for today Big Grin @surtek gave me an idea, but I did it on a different way. The first code spawns carepackages in a regular polygon from a beginning point (that is one of its corners). The pyramid function makes a 4 sided pyramid (if you touch a bit the code you can easily make them 5 sided or whatever).

Code:
SpawnPolygon( point, sides, sidelenght )
{
    angle = ( 360 / sides );
    thing = spawn( "script_model", point );
    thing.angles = ( 0, 0, 0 );
    for( i = 0; i <= ( sides - 1 ); i ++ )
    {
        for( j = 0; j <= sidelenght; j ++ )
        {
            block = spawn( "script_model", thing.origin );
            block setModel("com_plasticcase_friendly");
            block.angles = thing.angles;
            block Solid();
            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
            thing MoveTo( thing.origin + anglesToForward( thing.angles ) * 55, 0.07 );
            wait ( 0.08 );
        }
        block = spawn( "script_model", thing.origin );
        block setModel("com_plasticcase_friendly");
        block.angles = thing.angles;
        block Solid();
        block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
        thing.angles = ( 0, thing.angles[1] + angle, 0 );
        wait ( 0.1 );
    }
    thing delete();
}

MakePyramid( point, sidelenght )
{
    for( i = 0; i <= sidelenght; i ++ )
    {
        SpawnPolygon( point + i * ( 30,  30, 27 ), 4, sidelenght - i );
        wait 1;
    }
}

Point is the beginning corner, sides is the ammount of sides of the polygon and sidelenght the ammount of carepackages of side (it will be the number you put + 2 )

Examples of use (my partner tested it on Afghan, is in front of TF141 spawn point):

Code:
    //SpawnPolygon( ( 259, -566, 190 ), 6, 5 );
    MakePyramid( ( 259, -566, 150 ), 6 );

[Image: 69orat.jpg]
[Image: sljv34.jpg]

Credits:
- @surtek for idea
- OMA Rhino for testing

Thanks Big Grin
Why the wait .08?
(06-18-2013, 22:00)Pozzuh Wrote: [ -> ]Why the wait .08?

The guy that tested it changed it to that because he said that with less it lagged Confused
@Yamato , you're a good guy, giving everyone credits.
Stop spoiling us.

(No I'm kidding keep doing it.)
**SpawnPolygon

Wink

Nice job as usual Yamato, also, a screenshot would be nice, too lazy to fire up MW2.
(06-20-2013, 06:33)master131 Wrote: [ -> ]**SpawnPolygon

Wink

Nice job as usual Yamato, also, a screenshot would be nice, too lazy to fire up MW2.

Yes, I corrected it, polgono is in spanish, I did a translation fail jaja. Ill add 2 screenshots.