Results 1 to 4 of 4

Thread: Random scripting

  1. #1
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts

    Random scripting

    This thread has no specific topic, you can add here stuff that you found out, maybe some workarounds or smth like that

    i tested out some funkctions i found in the cod2_mp.exe with a HEX editor

    clientannouncer( player , "TEXT" ); is the same as player iprintLnBold( "TEXT" );

    announcer( "TEXT" ); >>> iPrintLnBold( "TEXT" );

    grenadeExplosionEffect( position ); >>> plays the grenade fx + sound on the position, no need to precache everygrenade fx anylonger

    turret useBy( player ); >>> player enters the turret

    soundFade( fadetime ) >>> working, but didnt tried to fade a sound yet

    PHP Code:
    modelHasTagmodel tag )
    {
        
    parts getNumPartsmodel ); //return bones count

        
    for( parts i++ )
        {
            if( 
    getPartNamemodel ) == tag //return bones_name by ID
                
    return true;
        }

        
    assertExfalse "Model [" model "] has no bone [" tag "] included!" ); //script error with the given message

    PHP Code:
    tracefrom dir hitPlayers ignoreEnt )
    {
        
    100000;
        
    bulletTracefrom from vectorScaledir ) , isDefinedhitPlayers ) && hitPlayers ignoreEnt );
        
    t["distance"] = t["fraction"];

        if( !
    isDefinedt["normal"] ) || t["normal"] == ( ) )
            
    t["normal"] = ( );

        return 
    t;


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

    EvoloZz (9th May 2013),Tally (9th May 2013)

  3. #2
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    The getNumParts() is an interesting find. I'm wondering if it can be used as a COD2 approximation of COD4's getTagOrigin() by converting the method:

    PHP Code:
    getTagOriginmodeltag )
    {
        
    parts getNumPartsmodel ); //return bones count

        
    for( parts i++ )
        {
            if( 
    getPartNamemodel ) == tag //return bones_name by ID
                
    return( model.origin );
        }

    If I had time I'd test it, but alas, I am snowed under with a project and behind schedule.

  4. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Please use distance(from, trace["position"]) to find the distance travelled, else you might wanna look into floating point precision. (hopefully cod uses doubles. Else max 8 significant numbers (single precision))

    Does grenadeexplosion take any other arguments? I'd like to set angles on the explosion, maybe even surfacetype...

    Contributing:
    PHP Code:
    ent hide();
    ent showtoplayer(player1);
    ent showtoplayer(player2); 

  5. #4
    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
    PHP Code:
    getTagOriginmodeltag )
    {
        
    parts getNumPartsmodel ); //return bones count

        
    for( parts i++ )
        {
            if( 
    getPartNamemodel ) == tag //return bones_name by ID
                
    return( model.origin );
        }

    uhh, sorry

    getNumParts( modelName ) & getPartName( modelName ) is the correct useage


    grenadeExplosionEffect( pos ) accepted more arguments, but i dont know what to insert

    PHP Code:
    bla()
    {
        
    level.fx loadFx"fx/explosions/grenadeExp_water.efx" );

        while( 
    )    
        {
            
    getEntArray"mp_dm_spawn" "classname" );

            for( 
    s.size i++ )
            {
                
    wait1.0 );

                
    s[i].origin;
                
    bulletTrace- ( 10000 ) , false undefined );
                
    t["position"];
                
    t["normal"];
                
                
    grenadeExplosionEffectlevel.fx );
            
    //    grenadeExplosionEffect( p ,level.fx , n );
            
    }
        }

    this will play different types of the explosion for me on burgundy (wood/mud/asphalt) , i doubt you can change the fx/normal
    Last edited by serthy; 9th May 2013 at 16:55.

Posting Permissions

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