/* ------------------------- NPC_Mark1_Precache ------------------------- */ void NPC_Mark1_Precache(void) { G_SoundIndex( "sound/chars/mark1/misc/mark1_wakeup"); G_SoundIndex( "sound/chars/mark1/misc/shutdown"); G_SoundIndex( "sound/chars/mark1/misc/walk"); G_SoundIndex( "sound/chars/mark1/misc/run"); G_SoundIndex( "sound/chars/mark1/misc/death1"); G_SoundIndex( "sound/chars/mark1/misc/death2"); G_SoundIndex( "sound/chars/mark1/misc/anger"); G_SoundIndex( "sound/chars/mark1/misc/mark1_fire"); G_SoundIndex( "sound/chars/mark1/misc/mark1_pain"); G_SoundIndex( "sound/chars/mark1/misc/mark1_explo"); // G_EffectIndex( "small_chunks"); G_EffectIndex( "env/med_explode2"); G_EffectIndex( "explosions/probeexplosion1"); G_EffectIndex( "blaster/smoke_bolton"); G_EffectIndex( "bryar/muzzle_flash"); G_EffectIndex( "explosions/droidexplosion1" ); RegisterItem( BG_FindItemForAmmo( AMMO_METAL_BOLTS)); RegisterItem( BG_FindItemForAmmo( AMMO_BLASTER )); RegisterItem( BG_FindItemForWeapon( WP_BOWCASTER )); RegisterItem( BG_FindItemForWeapon( WP_BRYAR_PISTOL )); }
void NPC_Mark2_Precache( void ) { G_SoundIndex( "sound/chars/mark2/misc/mark2_explo" );// blows up on death G_SoundIndex( "sound/chars/mark2/misc/mark2_pain" ); G_SoundIndex( "sound/chars/mark2/misc/mark2_fire" ); G_SoundIndex( "sound/chars/mark2/misc/mark2_move_lp" ); G_EffectIndex( "explosions/droidexplosion1" ); G_EffectIndex( "env/med_explode2" ); G_EffectIndex( "blaster/smoke_bolton" ); G_EffectIndex( "bryar/muzzle_flash" ); RegisterItem( BG_FindItemForWeapon( WP_BRYAR_PISTOL ) ); RegisterItem( BG_FindItemForAmmo( AMMO_METAL_BOLTS ) ); RegisterItem( BG_FindItemForAmmo( AMMO_POWERCELL ) ); RegisterItem( BG_FindItemForAmmo( AMMO_BLASTER ) ); }
void NPC_Probe_Precache( void ) { int i; for ( i = 1; i < 4; i++ ) { G_SoundIndex( va( "sound/chars/probe/misc/probetalk%d", i ) ); } G_SoundIndex( "sound/chars/probe/misc/probedroidloop" ); G_SoundIndex( "sound/chars/probe/misc/anger1" ); G_SoundIndex( "sound/chars/probe/misc/fire" ); G_EffectIndex( "chunks/probehead" ); G_EffectIndex( "env/med_explode2" ); G_EffectIndex( "explosions/probeexplosion1" ); G_EffectIndex( "bryar/muzzle_flash" ); RegisterItem( BG_FindItemForAmmo( AMMO_BLASTER ) ); RegisterItem( BG_FindItemForWeapon( WP_BRYAR_PISTOL ) ); }
/* ------------------------- NPC_Sentry_Precache ------------------------- */ void NPC_Sentry_Precache( void ) { int i; G_SoundIndex( "sound/chars/sentry/misc/sentry_explo" ); G_SoundIndex( "sound/chars/sentry/misc/sentry_pain" ); G_SoundIndex( "sound/chars/sentry/misc/sentry_shield_open" ); G_SoundIndex( "sound/chars/sentry/misc/sentry_shield_close" ); G_SoundIndex( "sound/chars/sentry/misc/sentry_hover_1_lp" ); G_SoundIndex( "sound/chars/sentry/misc/sentry_hover_2_lp" ); for ( i = 1; i < 4; i++ ) { G_SoundIndex( va( "sound/chars/sentry/misc/talk%d", i ) ); } G_EffectIndex( "bryar/muzzle_flash" ); G_EffectIndex( "env/med_explode" ); RegisterItem( BG_FindItemForAmmo( AMMO_BLASTER ) ); }
/* ================== Svcmd_GiveItem_f Joe Kari: Give an item to a client, usefull for third party RCON script. Mostly a copy and paste of Cmd_BuyItem_f() from g_cmds.c * giveitem <num> <item classname> ================== */ void Svcmd_GiveItem_f () { char arg[MAX_TOKEN_CHARS]; gclient_t *cl; int clientNum; gitem_t *item; gentity_t *ent; gentity_t *item_ent; int weapon; int clip; int clipAmmo; int maxAmmo; //int quantity; int belt; int bitmask; if ( trap_Argc() < 2 ) { G_Printf ( "Usage: giveitem <client number> <item_code>\n"); return; } trap_Argv( 1, arg, sizeof( arg ) ); clientNum = atoi( arg ); if ( clientNum >= level.maxclients || clientNum < 0 ) { Com_Printf("client not found\n"); return; } cl = &level.clients[ clientNum ] ; if ( cl->pers.connected != CON_CONNECTED ) { Com_Printf("client not found\n"); return; } if(cl->ps.stats[STAT_HEALTH] <= 0) { Com_Printf("client is dead\n"); return; } if(cl->sess.sessionTeam >= TEAM_SPECTATOR) { Com_Printf("client is a spectator\n"); return; } ent = &g_entities[ clientNum ]; trap_Argv( 2, arg, sizeof( arg ) ); item = BG_FindItemForClassname( arg ); if(!item) { Com_Printf("Item not found\n"); return; } belt = 1; if(cl->ps.powerups[PW_BELT]) belt = 2; // item->giTag item->giType switch( item->giType ) { case IT_WEAPON : weapon = item->giTag ; bitmask = 1 << weapon ; clip = bg_weaponlist[weapon].clip ; maxAmmo = bg_weaponlist[weapon].maxAmmo ; clipAmmo = bg_weaponlist[weapon].clipAmmo ; if ( ! clip ) { // Weapons such as dynamite, bowie knifes, etc... // We give half of the max ammo value. if ( cl->ps.ammo[weapon] >= maxAmmo ) return ; cl->ps.ammo[weapon] += (int)( maxAmmo / 2 ) ; if ( cl->ps.ammo[weapon] > maxAmmo ) cl->ps.ammo[weapon] = maxAmmo ; } else if ( ent->client->ps.stats[STAT_WEAPONS] & bitmask ) { // He already have the weapon if ( item->weapon_sort != WS_PISTOL ) return ; if ( cl->ps.stats[STAT_FLAGS] & SF_SEC_PISTOL ) return ; cl->ps.stats[STAT_FLAGS] |= SF_SEC_PISTOL ; // load it cl->ps.ammo[WP_AKIMBO] = clipAmmo ; //give ammo if ( cl->ps.ammo[clip] < maxAmmo ) cl->ps.ammo[clip] = maxAmmo ; } else { // add weapon ent->client->ps.stats[STAT_WEAPONS] |= bitmask ; // load it cl->ps.ammo[weapon] = clipAmmo ; //give ammo if ( cl->ps.ammo[clip] < maxAmmo ) cl->ps.ammo[clip] = maxAmmo ; } break ; case IT_AMMO : if (item->giTag == WP_BULLETS_CLIP) { item = BG_FindItemForAmmo(WP_BULLETS_CLIP); weapon = WP_PEACEMAKER; } else { if ( cl->ps.stats[STAT_GATLING_MODE] ) weapon = WP_GATLING; else weapon = BG_FindPlayerWeapon(WP_WINCHESTER66, WP_DYNAMITE, &cl->ps); if ( weapon ) item = BG_FindItemForAmmo(bg_weaponlist[weapon].clip); else return; } if( cl->ps.ammo[item->giTag] >= belt * bg_weaponlist[weapon].maxAmmo) return; cl->ps.ammo[item->giTag] += bg_weaponlist[weapon].maxAmmo ; if( cl->ps.ammo[item->giTag] >= belt * bg_weaponlist[weapon].maxAmmo) cl->ps.ammo[item->giTag] = belt * bg_weaponlist[weapon].maxAmmo ; break ; case IT_POWERUP : if ( item->giTag == PW_BELT ) { cl->ps.ammo[WP_BULLETS_CLIP] = bg_weaponlist[WP_REM58].maxAmmo * 2 ; cl->ps.ammo[WP_SHELLS_CLIP] = bg_weaponlist[WP_REMINGTON_GAUGE].maxAmmo * 2 ; cl->ps.ammo[WP_CART_CLIP] = bg_weaponlist[WP_WINCHESTER66].maxAmmo * 2 ; cl->ps.ammo[WP_GATLING_CLIP] = bg_weaponlist[WP_GATLING].maxAmmo * 2 ; cl->ps.ammo[WP_SHARPS_CLIP] = bg_weaponlist[WP_SHARPS].maxAmmo * 2 ; } else if ( cl->ps.powerups[item->giTag] ) { return ; } cl->ps.powerups[item->giTag] = 1 ; break ; case IT_ARMOR : if ( /* cl->ps.powerups[item->giTag] && */ cl->ps.stats[STAT_ARMOR] >= BOILER_PLATE ) return ; //cl->ps.powerups[item->giTag] = 1 ; cl->ps.stats[STAT_ARMOR] = BOILER_PLATE ; break ; default : return ; } // Joe Kari: it's important to advertise here, to prevent abuser (yes, admins can be cheaters too) trap_SendServerCommand( -1, va( "print \"%s^7 ^2earned some %s !^7\n\"", cl->pers.netname , item->pickup_name ) ); }