Crack Life Campaign Mode with Multiplayer mode avaliable. I make the Fgd to make maps for CL Multiplayer Mode and CL Campaign Mode. The Fgd includes all new monster and weapon added in Crack Life Campaign Mode
Well I'll get to the point, since I'm a programming noob, I come to ask you masters of programming for a little help
I made a filthy copy paste of the mp5 code and modified it to look like the Sniper from Crack life
The problem is the animations which do not come out when they should
The deploy animation appears when it is recharging and the firing animation when the weapon is taken out and I don't know what the hell I'm doing wrong
Here is the Sniper Code if you are interested in helping me
Or right, I almost forgot
Merry Christmas to all :)
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "weapons.h"
#include "nodes.h"
#include "player.h"
#include "soundent.h"
#include "gamerules.h"
#include "snipars.h"
LINK_ENTITY_TO_CLASS( weapon_snipars, CSniper );
LINK_ENTITY_TO_CLASS( ammo_snipars, CSniperAmmoClip );
enum sniper_e
{
SNIPER_IDLE_SIL = 0,
SNIPER_FIRE1,
SNIPER_DEPLOY,
SNIPER_RELOAD,
};
void CSniper::Spawn( )
{
pev->classname = MAKE_STRING("weapon_snipars"); // hack to allow for old names
Precache( );
SET_MODEL(ENT(pev), SNIPER_MODEL_WORLD);
m_iId = WEAPON_SNIPER;
m_iDefaultAmmo = SNIPER_DEFAULT_AMMO;
FallInit();// get ready to fall down.
}
void CSniper::Precache( void )
{
PRECACHE_MODEL(SNIPER_MODEL_1STPERSON);
PRECACHE_MODEL(SNIPER_MODEL_3RDPERSON);
PRECACHE_MODEL(SNIPER_MODEL_WORLD);
m_iShell = PRECACHE_MODEL ("models/shell.mdl");// brass shell
PRECACHE_SOUND (SNIPER_SOUND_FIRE1);
PRECACHE_SOUND (SNIPER_SOUND_FIRE2);
PRECACHE_SOUND (SNIPER_SOUND_FIRE3);
PRECACHE_SOUND (SNIPER_SOUND_FIRE4);
PRECACHE_SOUND (SNIPER_SOUND_FIRE5);
m_event = PRECACHE_EVENT( 1, "events/sniper.sc" );
m_event_z = PRECACHE_EVENT( 1, "events/sniperz.sc" );
}
int CSniper::GetItemInfo(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "ammo_snipars"; // The type of ammo it uses
p->iMaxAmmo1 = SNIPER_MAX_AMMO; // Max ammo the player can carry
p->pszAmmo2 = NULL; // No secondary ammo
p->iMaxAmmo2 = -1;
p->iMaxClip = SNIPER_MAX_CLIP; // The clip size
p->iSlot = SNIPER_SLOT - 1; // The number in the HUD
p->iPosition = SNIPER_POSITION; // The position in a HUD slot
p->iFlags = ITEM_FLAG_NOAUTOSWITCHEMPTY | ITEM_FLAG_SELECTONEMPTY;
p->iId = m_iId = WEAPON_SNIPER; // The weapon id
p->iWeight = SNIPER_WEIGHT; // for autoswitching
return 1;
}
int CSniper::AddToPlayer( CBasePlayer *pPlayer )
{
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
{
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
WRITE_BYTE( m_iId );
MESSAGE_END();
return TRUE;
}
return FALSE;
}
BOOL CSniper::Deploy( )
{
return DefaultDeploy( SNIPER_MODEL_1STPERSON, SNIPER_MODEL_3RDPERSON, SNIPER_DEPLOY, "mp5" );
}
void CSniper::PrimaryAttack()
{
// This weapon is single shot when zoomed in, auto otherwise
if (!(m_pPlayer->m_afButtonPressed & IN_ATTACK) && InZoom())
return;
// don't fire underwater
if (m_pPlayer->pev->waterlevel == 3)
{
PlayEmptySound( );
m_flNextPrimaryAttack = 1.0;
return;
}
// don't fire if empty
if (m_iClip <= 0)
{
PlayEmptySound();
m_flNextPrimaryAttack = 1.0;
return;
}
// Weapon sound
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
// one less round in the clip
m_iClip--;
// add a muzzle flash
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
// fire off a round
Vector vecSrc(m_pPlayer->GetGunPosition());
Vector vecAim(m_pPlayer->GetAutoaimVector(AUTOAIM_2DEGREES));
// Accuracy of the weapon in degrees, zoomed in is way more accurate
Vector vecAcc(InZoom() ? VECTOR_CONE_1DEGREES : VECTOR_CONE_3DEGREES);
Vector vecDir(m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAim, vecAcc, 8192, BULLET_PLAYER_SNIPER, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ));
// Fire off the client side event
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), (m_InZoom ? m_event_z :m_event), 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, (m_iClip ? 0 : 1), 0 );
// Add a delay before the player can fire the next shot
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + SNIPER_FIRE_DELAY;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, SNIPER_FIRE_DELAY + 1, SNIPER_FIRE_DELAY + 2);
}
// Zoom in/out
void CSniper::SecondaryAttack( void )
{
if ( m_pPlayer->pev->fov != 0 )
{
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0; // 0 means reset to default fov
}
else if ( m_pPlayer->pev->fov != 20 )
{
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 20;
}
pev->nextthink = UTIL_WeaponTimeBase() + 0.1;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
}
void CSniper::Reload( void )
{
DefaultReload( SNIPER_DEFAULT_AMMO, SNIPER_RELOAD, SNIPER_RELOAD_TIME );
}
void CSniper::WeaponIdle( void )
{
ResetEmptySound( );
m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
SendWeaponAnim( SNIPER_IDLE_SIL );
m_flTimeWeaponIdle = UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15);
}
void CSniperAmmoClip::Spawn( void )
{
Precache( );
SET_MODEL(ENT(pev), "models/w_9mmARclip.mdl");
CBasePlayerAmmo::Spawn( );
}
void CSniperAmmoClip::Precache( void )
{
PRECACHE_MODEL ("models/w_9mmARclip.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
BOOL CSniperAmmoClip::AddAmmo( CBaseEntity *pOther )
{
int bResult = (pOther->GiveAmmo(SNIPER_DEFAULT_AMMO, "ammo_snipars",
SNIPER_MAX_AMMO) != -1);
if (bResult)
{
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
}
return bResult;
}
#ifndef TOD_SNIPER_H
#define TOD_SNIPER_H
class CSniper : public CBasePlayerWeapon
{
public:
virtual void Spawn( void );
virtual void Precache( void );
virtual int iItemSlot( void ) { return SNIPER_SLOT; }
virtual int GetItemInfo(ItemInfo *p);
virtual int AddToPlayer( CBasePlayer *pPlayer );
virtual void PrimaryAttack( void );
virtual void SecondaryAttack( void ); // switch between scope and iron sights
virtual BOOL Deploy( void );
virtual void Reload( void );
virtual void WeaponIdle( void );
virtual BOOL UseDecrement( void ) { return TRUE; }
private:
int m_iShell;
BOOL InZoom() { return m_pPlayer->pev->fov != 0; }
BOOL m_InZoom() { return m_pPlayer->pev->fov != 0; }
unsigned short m_event;
unsigned short m_event_z;
};
class CSniperAmmoClip : public CBasePlayerAmmo
{
virtual void Spawn( void );
virtual void Precache( void );
virtual BOOL AddAmmo( CBaseEntity *pOther ) ;
};
#endif
The Fgd with all the new entities added in Crack Life Campaign Mode For J.A.C.K. and WorldCraft/Hammer
This comment is currently awaiting admin approval, join now to view.
HOW TO USE THIS
Revolution
Can't wait for this thing to officially released.
the trilogy will be finally complete
dude the fgd doesn't work
Please finish this
I have to try to recreate the Crack Life code to make a Multiplayer of it, which is complicated at least for me who am a newbie in programming
But I hope to have it as soon as possible
I'll be the happiest man in the world if this ever comes out
Although I don't think any friend of mine wants to play this with me XD
We are already two xD