Code3Arena

PlanetQuake | Code3Arena | Tutorials | << Prev | Tutorial 23 | Next >>

menu

  • Home/News
  • ModSource
  • Compiling
  • Help!!!
  • Submission
  • Contributors
  • Staff
  • Downloads

    Tutorials
    < Index >
    1. Mod making 101
    2. Up 'n running
    3. Hello, QWorld!
    4. Infinite Haste
    5. Armor Piercing Rails
    6. Bouncing Rockets
    7. Cloaking
    8. Ladders
    9. Favourite Server
    10. Flame Thrower
    11. Vortex Grenades
    12. Grapple
    13. Lightning Discharge
    14. Locational Damage
    15. Leg Shots
    16. Weapon Switching
    17. Scoreboard frag-rate
    18. Vortex Grenades II
    19. Vulnerable Missiles
    20. Creating Classes
    21. Scrolling Credits
    22. Weapon Dropping
    23. Anti-Gravity Boots
    24. HUD scoreboard
    25. Flashlight and laser
    26. Weapon Positioning
    27. Weapon Reloading
    28. Progressive Zooming
    29. Rotating Doors
    30. Beheading (headshot!)
    31. Alt Weapon Fire
    32. Popup Menus I
    33. Popup Menus II
    34. Cluster Grenades
    35. Homing Rockets
    36. Spreadfire Powerup
    37. Instagib gameplay
    38. Accelerating rockets
    39. Server only Instagib
    40. Advanced Grapple Hook
    41. Unlagging your mod


    Articles
    < Index >
    1. Entities
    2. Vectors
    3. Good Coding
    4. Compilers I
    5. Compilers II
    6. UI Menu Primer I
    7. UI Menu Primer II
    8. UI Menu Primer III
    9. QVM Communication, Cvars, commands
    10. Metrowerks CodeWarrior
    11. 1.27g code, bugs, batch


    Links

  • Quake3 Files
  • Quake3 Forums
  • Q3A Editing Message Board
  • Quake3 Editing


    Feedback

  • SumFuka
  • Calrathan
  • HypoThermia
  • WarZone





    Site Design by:
    ICEmosis Design


  •  
    TUTORIAL 23 - Anti-Gravity Boots
    by Burning

    Okay then... This will help you create (not help, but do it) Anti Gravity Boots. I helped with a few Half-Life tuts, but i'm going to go make Quake3 tuts from now on i guess. You don't need much knowledge of C to do this as this took me about 5 mins. Anyway... grab a coke, a smoke and if you'd like ... nevermind... !

    1. NEW ENTITY FLAG... (IS THE WIND BLOWING?)

    Ummm.... let's create a flag... Where ?? Jump to (without Anti-gravity boots for now) g_local.h and in line 33 add this :
    #define FL_NO_HUMANS 0x00004000	// spawn point just for bots
    #define FL_BOOTS 0x00006000  // Anti Gravity Boots
    
    // movers are things like doors, plats, buttons, etc
    .
    .
    .
    

    2. CREATING THE ON/OFF THINGY

    Here the code for bending over and turning that switch on and off on those boots you just bought. Now open up g_cmds.c and add this in line 1101:
    else if (Q_stricmp (cmd, "setviewpos") == 0)
       Cmd_SetViewpos_f( ent );
    else if (Q_stricmp (cmd, "boots") == 0)
       Cmd_Boots_f( ent );
    else
       trap_SendServerCommand( clientNum, va("print \"unknown cmd %s\n\"", cmd ) );
    
    
    Yeah... you added the command for typing in the console... But you still need to create the function Cmd_Boots_f. So now go to line 1030 (yeah Buddy... same file) and add :
    /*
    =================
    Cmd_Boots_f          function for turning boots on/off
    =================
    */
    void Cmd_Boots_f( gentity_t *ent ) {
    
       char *msg; // message to player
    
       ent->flags ^= FL_BOOTS;
    
       if (!(ent->flags & FL_BOOTS))
           msg = "Anti Gravity boots OFF\n";
       else msg = "Anti Gravity boots ON\n";
    
       trap_SendServerCommand( ent-g_entities, va("print \"%s\"", msg));
    }
    
    
    Goooooood... now you created the function for actually turning it on and off... and more... you printed a shweet little message with it.

    3. DOING THE IMPOSSIBLE (IN REAL LIFE I MEAN)

    Now we want to change the gravity, right ? .... Right... Follow me now into the file g_active.c and walk to line 596... you see it ?... now change it to :

    } else {
       client->ps.pm_type = PM_NORMAL;
    }
    
    client->ps.gravity = g_gravity.value;                 //  Add this,
    if (ent->flags & FL_BOOTS)                            //  umm and this,
       client->ps.gravity = g_gravity.value * 0.20;        //  yeah... this too
    
    // set speed
    client->ps.speed = g_speed.value;
    

    3. USING IT IN YOUR MOD (IN REAL LIFE I MEAN)

    To use this feature all you have to do is type /boots in your console or adding bind b "boots" to your autoexec.cfg (in your mod dir) Easy huh ? N-joy this tutorial... until next time... mail me for problems and so on.

    PlanetQuake | Code3Arena | Tutorials | << Prev | Tutorial 23 | Next >>