Tremulous Forum
Mods => Modding Center => Topic started 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 >.>
-
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.
-
Thanks!
(http://static.open.salon.com/files/cookie-monster3-7769871237963363.jpg)
-
You can do it even server-side. =)
-
Well, i got work but:
WARNING: Held items conflict with weapon 11
And code i edited:
g_cmds_c
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
// 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;
-
g_client.c
// 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:
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:
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 :)
-
Ok thanks again :-)
(http://2.bp.blogspot.com/_53oMB4-fxXM/SVZZdJntnPI/AAAAAAAAAAM/vXEtrdBFtqI/s1600-R/cookie.gif)
-
Thanks! :D (nomnomnomnom)
-
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...