Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: setmodel

  1. #11
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Loveboy View Post
    ******* script compile error *******
    bad syntax: (file 'maps/mp/gametypes/_nuke.gsc', line 166)
    spawnModel( name , pos , angles );
    *
    ************************************
    Let me correct serthy:

    PHP Code:
    spawnModelname pos angles )
    {
        
    model spawn"script_model" pos );
        
    model.angles angles;
        
    model setModelname );
        return 
    model;
    }

    loveboy()
    {
        
    precacheModel"xmodel/vehicle_stuka_flying" );

        
    model spawnModel"xmodel/vehicle_stuka_flying" , ( ) ,  ( 90 ) );

    Basically, DON'T try to call the spawnModel() function without filling in the details: 1. the model, 2, the origin, and 3. the angles. To stop that happening, I would add some checks for such details:

    PHP Code:
    spawnModelmodeloriginangles )
    {
        if( !
    isdefined(model) || !isdefined(origin) )
            return 
    undefined;

        if( !
    isdefined(angles) )
            
    angles = (0,0,0);

        
    spawn spawn ("script_model",(0,0,0));
        
    spawn.origin origin;
        
    spawn setmodel (model);
        
    spawn.angles angles;

        return 
    spawn;

    That will stop the runtime error if you miss out the details, but the model wont spawn.

    HISTORICAL NOTE -

    The spawnModel() was first used in a Call of Duty mod by PoolMaster in his "PoolMaster Mod ver 1.3" for COD1 circa December 2003. But it was made famous by Bell in his AWE mod for COD1 and COD: UO circa 2004 and subsequent years. But Bell got the function from PoolMaster with permission, so correctly speaking, it was PoolMaster who came up with the function in the form it took in AWE. All that was done before the COD1 mod tools came out. We had no help from the developers and pretty much all modding was done by discovering what was possible and passing on the info on the IWNation modding forums. Golden Days of Modding! I miss them.
    Last edited by Tally; 5th May 2013 at 08:07.

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

    kung foo man (10th May 2013),Loveboy (5th May 2013)

  3. #12
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by Tally View Post
    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.
    ;D you are right, i sent the code not from my pc, but no excuses

    Attachment 271

  4. #13
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    let me try too:
    Code:
    loveboy()
    {
    	bombmodel = "xmodel/prop_stuka_bomb";
    	angles = (0, 45, 0);
    	origin = (-3000, 1500, 1536); // hinten - vorne , links - rechts , höhe wurf: (1500, 1500, 1536)
    	bomb = spawn( "script_model" , origin );
    	bomb setModel(bombmodel);
    }

  5. #14
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    Hey guys

    I'm firing a projectile from the gunship, from self.origin to trace["position"].
    How can I set the projectile.angles? It should be pointing to the target (trace["position"]).
    I know I could determine the three angles as the inclinations between the origin and the target, but I'm not sure if trigonometric functions are supported...


    Thanks again


    Editted: This is good enough

    projectile.angles = self getplayerangles();
    Last edited by guiismiti; 5th June 2015 at 21:26.
    set logfile 2

  6. #15
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by guiismiti View Post
    Hey guys

    I'm firing a projectile from the gunship, from self.origin to trace["position"].
    How can I set the projectile.angles? It should be pointing to the target (trace["position"]).
    There is a default function available for that.

    https://znation.nl/cod4script/vectortoangles.htm
    PHP Code:
    angles VectorToAnglesend start ); 

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

    guiismiti (5th June 2015),Ni3ls (6th June 2015)

  8. #16
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Well, you should normalize the angles as well:

    Code:
    angles = VectorToAngles( vectorNormalize( end - start ) );

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

    guiismiti (6th June 2015),Ni3ls (6th June 2015)

Posting Permissions

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