Tremulous Forum

Mods => Modding Center => Topic started by: DraZiLoX on January 29, 2010, 07:56:04 pm

Title: Change human starting items?
Post by: DraZiLoX on January 29, 2010, 07:56:04 pm
You all prob know, humans have Rifle, Blaster and Medikit when they spawn. How to edit those items to like: Painsaw, Larmour, Helmet and Medikit?

Oh, i mean QVM of course >.>
Title: Re: Change human starting items?
Post by: Snake on January 29, 2010, 08:30:49 pm
You can try changing it on the function Cmd_Class_f in g_cmds.c or in the function ClientSpawn in g_client.c, It depends on your needs/the use you are gonna give to it.
Title: Re: Change human starting items?
Post by: DraZiLoX on January 29, 2010, 08:35:52 pm
Thanks!

(http://static.open.salon.com/files/cookie-monster3-7769871237963363.jpg)
Title: Re: Change human starting items?
Post by: CATAHA on January 30, 2010, 01:38:24 am
You can do it even server-side. =)
Title: Re: Change human starting items?
Post by: DraZiLoX on January 30, 2010, 01:02:40 pm
Well, i got work but:

WARNING: Held items conflict with weapon 11


And code i edited:

g_cmds_c
Code: [Select]
    else if( ent->client->pers.teamSelection == PTE_HUMANS )
    {
      //set the item to spawn with
      if( !Q_stricmp( s, BG_FindNameForWeapon( WP_MACHINEGUN ) ) &&
          BG_WeaponIsAllowed( WP_MACHINEGUN ) )
      {
        ent->client->pers.humanItemSelection = WP_PAIN_SAW;
      }
      else if( !Q_stricmp( s, BG_FindNameForWeapon( WP_HBUILD ) ) &&
               BG_WeaponIsAllowed( WP_HBUILD ) )
      {
        ent->client->pers.humanItemSelection = WP_PAIN_SAW;
      }
      else if( !Q_stricmp( s, BG_FindNameForWeapon( WP_HBUILD2 ) ) &&
               BG_WeaponIsAllowed( WP_HBUILD2 ) &&
               BG_FindStagesForWeapon( WP_HBUILD2, g_humanStage.integer ) )
      {
        ent->client->pers.humanItemSelection = WP_PAIN_SAW;
      }
      else
      {
        trap_SendServerCommand( ent-g_entities,
          "print \"Unknown starting item\n\"" );
        return;
      }

g_client.c
Code: [Select]
  // clear entity values
  if( ent->client->pers.classSelection == PCL_HUMAN )
  {
    BG_AddWeaponToInventory( WP_PAIN_SAW, client->ps.stats );
    BG_AddUpgradeToInventory( UP_LIGHTARMOUR, client->ps.stats );
    BG_AddUpgradeToInventory( UP_HELMET, client->ps.stats );
    BG_AddUpgradeToInventory( UP_MEDKIT, client->ps.stats );
    weapon = client->pers.humanItemSelection;
  }
  else if( client->sess.sessionTeam != TEAM_SPECTATOR )
    weapon = BG_FindStartWeaponForClass( ent->client->pers.classSelection );
  else
    weapon = WP_NONE;
Title: Re: Change human starting items?
Post by: Snake on January 30, 2010, 05:17:18 pm
g_client.c
Code: [Select]
  // clear entity values
  if( ent->client->pers.classSelection == PCL_HUMAN )
  {
    BG_AddWeaponToInventory( WP_PAIN_SAW, client->ps.stats );
    BG_AddUpgradeToInventory( UP_LIGHTARMOUR, client->ps.stats );
    BG_AddUpgradeToInventory( UP_HELMET, client->ps.stats );
    BG_AddUpgradeToInventory( UP_MEDKIT, client->ps.stats );
    weapon = client->pers.humanItemSelection;
  }
  else if( client->sess.sessionTeam != TEAM_SPECTATOR )
    weapon = BG_FindStartWeaponForClass( ent->client->pers.classSelection );
  else
    weapon = WP_NONE;


It's probably because you are giving 2 painsaws to the player, look:

Code: [Select]
  if( ent->client->pers.classSelection == PCL_HUMAN )
  {
    BG_AddWeaponToInventory( WP_PAIN_SAW, client->ps.stats );   //  <-----Here you are giving him the 1st psaw
    BG_AddUpgradeToInventory( UP_LIGHTARMOUR, client->ps.stats );
    BG_AddUpgradeToInventory( UP_HELMET, client->ps.stats );
    BG_AddUpgradeToInventory( UP_MEDKIT, client->ps.stats );
    weapon = client->pers.humanItemSelection;  // <-----and here you are setting it to give the player the second painsaw.
  }

The second painsaw is given a few lines later:

Code: [Select]
  BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips );
  BG_AddWeaponToInventory( weapon, client->ps.stats );   //<---- HERE you are giving him the second painsaw.
  BG_PackAmmoArray( weapon, client->ps.ammo, client->ps.powerups, maxAmmo, maxClips );



I hope it helps :)
Title: Re: Change human starting items?
Post by: DraZiLoX on January 30, 2010, 05:26:15 pm
Ok thanks again :-)

(http://2.bp.blogspot.com/_53oMB4-fxXM/SVZZdJntnPI/AAAAAAAAAAM/vXEtrdBFtqI/s1600-R/cookie.gif)
Title: Re: Change human starting items?
Post by: Snake on January 30, 2010, 05:56:26 pm
Thanks! :D (nomnomnomnom)
Title: Re: Change human starting items?
Post by: MitSugna on February 13, 2010, 11:01:24 am
add them credits - start at stage 2
Otherwise you start with helmet but if you sell it you can't buy it back if you are at stage 1
lol...