Author Topic: Change human starting items?  (Read 5317 times)

DraZiLoX

  • Posts: 844
  • Turrets: +24/-24
Change human starting items?
« 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 >.>

Snake

  • Posts: 541
  • Turrets: +43/-110
    • IdeaShock
Re: Change human starting items?
« Reply #1 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.
.

DraZiLoX

  • Posts: 844
  • Turrets: +24/-24
Re: Change human starting items?
« Reply #2 on: January 29, 2010, 08:35:52 pm »
Thanks!


CATAHA

  • Posts: 539
  • Turrets: +8/-18
    • Tremulous Lair
Re: Change human starting items?
« Reply #3 on: January 30, 2010, 01:38:24 am »
You can do it even server-side. =)
Russian q3/trem mapping site: http://tremlair.krond.ru/
=[ Boxmaps suck if they have no concept ]=

Ice Trap (InstaGib)

Other maps: A.T.D*S Remake

DraZiLoX

  • Posts: 844
  • Turrets: +24/-24
Re: Change human starting items?
« Reply #4 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;

Snake

  • Posts: 541
  • Turrets: +43/-110
    • IdeaShock
Re: Change human starting items?
« Reply #5 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 :)
.

DraZiLoX

  • Posts: 844
  • Turrets: +24/-24
Re: Change human starting items?
« Reply #6 on: January 30, 2010, 05:26:15 pm »
Ok thanks again :-)


Snake

  • Posts: 541
  • Turrets: +43/-110
    • IdeaShock
Re: Change human starting items?
« Reply #7 on: January 30, 2010, 05:56:26 pm »
Thanks! :D (nomnomnomnom)
.

MitSugna

  • Guest
Re: Change human starting items?
« Reply #8 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...