Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: setmodel

  1. #1
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts

    setmodel

    hello guys, i want to ask, how you can precache a model, give it a origin and give it a position and an angle and then set the model.

    I already know precacheModel("xmodel/example");

    but i must give the model now a position and angle and origin where it will be set the model.

    somebody know the script?

  2. #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
    PHP Code:
    spawnModel(nameoriginangles)
    {
        
    model spawn("script_model"origin);
        
    model.angles angles;
        
    model setModel(name);
        return 
    model;

    You can change the origin later with:

    PHP Code:
    model moveTo(someNewOrigin1); // moves to someNewOrigin in 1 seconds
    model.origin = (1,2,3); // moves model instantly to new origin 
    timescale 0.01

  3. The Following User Says Thank You to kung foo man For This Useful Post:

    Loveboy (4th May 2013)

  4. #3
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    The script is wrong ;(

  5. #4
    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
    Click image for larger version. 

Name:	program-crashes-sends-error-report.jpg 
Views:	51 
Size:	244.4 KB 
ID:	270............
    timescale 0.01

  6. #5
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    error:
    Code:
    ******* script compile error *******
    bad syntax: (file 'maps/mp/gametypes/_nuke.gsc', line 170)
    {
    *
    ************************************
    script:
    Code:
    loveboy()
    {
    spawnModel(name, origin, angles)
    { // line 171
        model = spawn("script_model", origin);
        model.angles = angles;
        model setModel(vehicle_stuka_flying);
        return model;
    }  
    }
    sorry i mean line 170*
    Last edited by kung foo man; 4th May 2013 at 22:07. Reason: Merge

  7. #6
    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
    You need to write that function next to other functions and call it like: spawnModel("xmodel/...", (1,2,3), (3,2,1));
    timescale 0.01

  8. #7
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    next error:
    Code:
    ******* script compile error *******
    uninitialised variable 'origin': (file 'maps/mp/gametypes/_nuke.gsc', line 171)
        model = spawn("script_model", origin);
                                      *
    ************************************
    script:
    Code:
    loveboy()
    {
    spawnModel("xmodel/vehicle_stuka_flying", (1,2,3), (0,90,0));
    {
        model = spawn("script_model", origin);
        model.angles = angles;
        model setModel(vehicle_stuka_flying);
        return model;
    }  
    }

  9. #8
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by Loveboy View Post
    Code:
    loveboy()
    {
    spawnModel("xmodel/vehicle_stuka_flying", (1,2,3), (0,90,0));
    {
        model = spawn("script_model", origin);
        model.angles = angles;
        model setModel(vehicle_stuka_flying);
        return model;
    }  
    }
    WTF dude, you should really start with the basics of coding...

    Code:
    spawnModel( name , pos , angles );
    {
        model = spawn( "script_model" , pos );
        model.angles = angles;
        model setModel( name );
        return model;
    }
    
    loveboy()
    {
        precacheModel( "xmodel/vehicle_stuka_flying" );
    
        model = spawnModel( "xmodel/vehicle_stuka_flying" , ( 1 , 2 , 3 ) ,  ( 0 , 90 , 0 ) );
    }

  10. The Following 2 Users Say Thank You to serthy For This Useful Post:

    kung foo man (4th May 2013),Loveboy (4th May 2013)

  11. #9
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    ******* script compile error *******
    bad syntax: (file 'maps/mp/gametypes/_nuke.gsc', line 166)
    spawnModel( name , pos , angles );
    *
    ************************************

  12. #10
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by serthy View Post
    WTF dude, you should really start with the basics of coding...

    Code:
    spawnModel( name , pos , angles );
    {
        model = spawn( "script_model" , pos );
        model.angles = angles;
        model setModel( name );
        return model;
    }
    
    loveboy()
    {
        precacheModel( "xmodel/vehicle_stuka_flying" );
    
        model = spawnModel( "xmodel/vehicle_stuka_flying" , ( 1 , 2 , 3 ) ,  ( 0 , 90 , 0 ) );
    }
    LMAO @serthy. You've made the kind of mistake I usually make - you've told LoveBoy to start with the basics and you then went and put a semi-colon ( on your function bracket.

Posting Permissions

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