Burst mode
Teraz si povieme ako spravi prepínaè módu stre¾by burst/full na tretie tlaèidlo. Otvoríme si hl.dsp a budeme editova ak47. V ak47 máme na primary stre¾bu na secondary máme laser. Teraz si dorobíme tretie tlaèidlo.
Nájdeme:
void SecondaryAttack( void );
a pod neho vložíme:
void ModStrelby ( void ); //definuje novu funkciu typu void u nás mód stre¾by
ïalej nájdeme:
int m_iShell;
a pod meno vložíme:
int m_fMS;
teraz pred zaèiatok:
void CAK47::Reload( void )
{
vložíme:
void CAK47::ModStrelby ( void )
{
if (m_fMS == 0)
{
m_fMS = 1;//burst
}
else if (m_fMS == 1)
{
m_fMS = 0;//semi
}
}
teraz nájdeme:
void CAK47::WeaponIdle( void )
{
UpdateSpot( );/*prip k laseru a jeho cinnosti*/
ResetEmptySound( );
Pod ktoré vložíme: -èo nám zisuje èo bolo stlaèené tlaèidlo pre mód stre¾by
extern str;
if(str==0){
ModStrelby();
str=1;
}
Teraz budeme editova primary attack
Namiesto:
m_iClip--;
Dáme:
if(m_fMS==0){
m_iClip--;
}
else if(m_fMS==1){
m_iClip--;
m_iClip--;
m_iClip--;
}
taktiež za:
if ( g_pGameRules->IsDeathmatch() )
{
// optimized multiplayer. Widened to make it easier to hit a moving player
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_2DEGREES, 8192, BULLET_PLAYER_MP5, 0.5, 4 );
}
else
{
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_2DEGREES, 8192, BULLET_PLAYER_MP5, 0.5, 4 );
}
dáme:
if(m_fMS==0){
if ( g_pGameRules->IsDeathmatch() )
{
// optimized multiplayer. Widened to make it easier to hit a moving player
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192, BULLET_PLAYER_9MM, 2 );
}
else
{
// single player spread
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192, BULLET_PLAYER_9MM, 2 );
}
}
else if(m_fMS==1){
if ( g_pGameRules->IsDeathmatch() )
{
// optimized multiplayer. Widened to make it easier to hit a moving player
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192, BULLET_PLAYER_9MM, 2 );
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192, BULLET_PLAYER_9MM, 2 );
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192, BULLET_PLAYER_9MM, 2 );
}
else
{
// single player spread
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192, BULLET_PLAYER_9MM, 2 );
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192, BULLET_PLAYER_9MM, 2 );
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192, BULLET_PLAYER_9MM, 2 );
}
}
Na koniec primary attack ešte dáme:- èo sa postará o to aby nám nabilo zbraò
if(m_fMS==0){
if(m_iClip<1){
Reload();
}
}
else if(m_fMS==1){
if(m_iClip<3){
Reload();
}
}
Nájdeme:
m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.06;
if (m_flNextPrimaryAttack < gpGlobals->time)
m_flNextPrimaryAttack = gpGlobals->time + 0.06;
a nahradíme ho:
if(m_fMS==0){
m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.07;
if (m_flNextPrimaryAttack < gpGlobals->time)
m_flNextPrimaryAttack = gpGlobals->time + 0.07;
}
else if(m_fMS==1){
m_flNextPrimaryAttack = gpGlobals->time + 0.4;
}
Takýmito spôsobmi si môžete editova teda meni zvuk stre¾by, kopanie zbrane atd.
Teraz si vytvoríme tlaèidlo pre zmenu módu.
Teraz budeme editova player.cpp a nájdeme:
extern DLL_GLOBAL ULONG g_ulModelIndexPlayer;
extern DLL_GLOBAL BOOL g_fGameOver;
extern DLL_GLOBAL BOOL g_fDrawLines;
pred ktoré vložíme:
int str=1;
teraz nájdeme:
case 100:
// temporary flashlight for level designers
if ( FlashlightIsOn() )
{
FlashlightTurnOff();
}
else
{
FlashlightTurnOn();
}
break;
pod ktoré dáme:
case 112:
// mení mód stre¾by
if ( str==1 )
{
str=0;
}
break;
Teraz treba ešte editova:
//Half-Life/Mojmod/config.cfg
a nájdeme:
bind "f" "impulse 100"
pod ktorý dáme:
bind "z" "impulse 112"
ak chceme používa túto funkciu tak si ešte budeme editova:
//Half-Life/MojMod/gfx/Shell/ kb_act.lst
//Half-Life/MojMod/gfx/Shell/ kb_def.lst
kde si niekde do kb_act.lst vložíme: -budeme vidie v nastaveniach klávesnice
"impulse 112" "Mód stre¾by"
a do druhého: -nastaví mód stre¾by po default klávesnice na „z“
"z" "impulse 112"