|
|
Diskusn boardy |
|
|
|
Najnovie lnky |
|
Automatická textová správa Vocko Tutoril 07.06.2009 : 11:02:12
|
V tomto tutoriále si spravíme automatickú textovú správu, ktorá sa prehraje vždy s nejakým zvukom. |
|
|
|
|
Env_mirror alebo zrkadlenie modelov Vocko Tutoril 24.04.2009 : 18:49:30
|
Tutoriál na zrkadlenie tu už je, ale èo ak chceme odráža i modely? Na tom nám poslúži entita env_mirror, ktorá sa nachádza iba v Spirite 1.4 alebo novšej verzii. |
|
|
HL2 : Obloukový prùchod R4z0r Tutoril 01.05.2008 : 05:48:46
|
Dnes si ukážeme zpùsob, jak vytvoøit elegantní obloukový prùchod, bez nutnosti používat øezání geometrie brushem... |
|
|
|
|
Pridanie mp3 do spiritu NICKSss Tutoril 02.03.2008 : 20:55:09
|
Návod na pridanie mp3 do Half-Life 1 alebo Spirt 1.2,otestované na verzii 1.2.
Asi už mate zbrane add-ons vo Spirite 1.2 a nechcete prejst na ver.1.4 lebo všetko stratite
pre Mp3... Na internete som našiel návody pre HL1 a po anglicky ktoré po skompilovani
fungovali asi takto : Aplikácia HL.EXE Neodpovedá... |
|
|
*locus Deli Tutoril 22.02.2008 : 20:13:47
|
Pre niektorých mapperov neznámy pojem, ale pre niektorých ve¾mi úèinná pomôcka.
Vïaka tomuto príspevku sa vám posnažím priblíži tajomstvá jednej z najväèších zbraní spiritu.
|
|
|
Spirit of Half-Life - Predstavenie Wizz Tutoril 27.10.2007 : 08:52:04
|
Predtým než sa pustíte do èítania, chcel by som Vás upozorni že èlánok už nemusí by 100% aktualny. Èlánok som totiž napísal ešte za svojich mladých èias - 13. júna 2004, èo je viac ako tri roky. Zverejni som sa ho rozhodol po nátlaku a výhražkach ostatných redaktorov |
|
|
|
Nožík qery [30.12.2004 : 03:11:55] 186 Tutoril tan : 3476 Priemern znmka : 1 |
Upozornenie:
Tento tutorial bol písany okolo 1 hodiny ráno na nefunkèných SDKaèkach. Keïže všetky testy robil Wizz tak defam že to ide, lebo mne to nešlo
Tutorial:
1. Vytvoríme súbor NOZIK.CPP
2. Do tohto súboru vložíme tento kód:
#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"
enum NOZIK_e
{
NOZIK_IDLE = 0,
NOZIK_SLASH1,
NOZIK_SLASH2,
NOZIK_DRAW,
NOZIK_STAB,
NOZIK_STABMISS,
NOZIK_MIDSLASH1,
NOZIK_MIDSLASH2
};
class CNOZIK : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 1; }
void EXPORT SwingAgain( void );
void EXPORT Smack( void );
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
void PrimaryAttack( void );
int Swing( int fFirst );
BOOL Deploy( void );
// void Holster( int skiplocal = 0 );
int m_iSwing;
TraceResult m_trHit;
/* void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 1; }
int GetItemInfo(ItemInfo *p);
void PrimaryAttack( void );
BOOL Deploy( void );
void Reload( void );
void WeaponIdle( void );
float m_flNextAnimTime;
int m_iShell;
int shotindex;*/
private:
};
LINK_ENTITY_TO_CLASS( weapon_NOZIK, CNOZIK );
void CNOZIK::Spawn( )
{
pev->classname = MAKE_STRING("weapon_NOZIK"); // hack to allow for old names
Precache( );
SET_MODEL(ENT(pev), "models/w_knife.mdl");
m_iId = WEAPON_NOZIK;
FallInit();// get ready to fall down.
}
void CNOZIK::Precache( void )
{
PRECACHE_MODEL("models/v_knife.mdl");
PRECACHE_MODEL("models/w_knife.mdl");
PRECACHE_MODEL("models/p_knife.mdl");
PRECACHE_SOUND("weapons/knife_deploy1.wav");
PRECACHE_SOUND("weapons/knife_hit1.wav");
PRECACHE_SOUND("weapons/knife_hit2.wav");
PRECACHE_SOUND("weapons/knife_hit3.wav");
PRECACHE_SOUND("weapons/knife_hit4.wav");
PRECACHE_SOUND("weapons/knife_slash1.wav");
PRECACHE_SOUND("weapons/knife_slash2.wav");
PRECACHE_SOUND("weapons/knife_stab.wav");
PRECACHE_SOUND("weapons/knife_hitwall1.wav");
}
int CNOZIK::GetItemInfo(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = NULL;
p->iMaxAmmo1 = -1;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = WEAPON_NOCLIP;
p->iSlot = 0;
p->iPosition = 1;
p->iFlags = 0;
p->iId = m_iId = WEAPON_NOZIK;
p->iWeight = NOZIK_WEIGHT;
return 1;
}
int CNOZIK::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 CNOZIK::Deploy( )
{
return DefaultDeploy( "models/v_knife.mdl", "models/p_knife.mdl", NOZIK_DRAW, "NOZIK" );
}
void xFindHullIntersection( const Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity )
{
int i, j, k;
float distance;
float *minmaxs[2] = {mins, maxs};
TraceResult tmpTrace;
Vector vecHullEnd = tr.vecEndPos;
Vector vecEnd;
distance = 1e6f;
vecHullEnd = vecSrc + ((vecHullEnd - vecSrc)*2);
UTIL_TraceLine( vecSrc, vecHullEnd, dont_ignore_monsters, pEntity, &tmpTrace );
if ( tmpTrace.flFraction < 1.0 )
{
tr = tmpTrace;
return;
}
for ( i = 0; i < 2; i++ )
{
for ( j = 0; j < 2; j++ )
{
for ( k = 0; k < 2; k++ )
{
vecEnd.x = vecHullEnd.x + minmaxs[i][0];
vecEnd.y = vecHullEnd.y + minmaxs[j][1];
vecEnd.z = vecHullEnd.z + minmaxs[k][2];
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, pEntity, &tmpTrace );
if ( tmpTrace.flFraction < 1.0 )
{
float thisDistance = (tmpTrace.vecEndPos - vecSrc).Length();
if ( thisDistance < distance )
{
tr = tmpTrace;
distance = thisDistance;
}
}
}
}
}
}
void CNOZIK::PrimaryAttack()
{
if (! Swing( 1 ))
{
SetThink( SwingAgain );
pev->nextthink = gpGlobals->time + 0.1;
}
}
void CNOZIK::Smack( )
{
DecalGunshot( &m_trHit, BULLET_PLAYER_CROWBAR );
}
void CNOZIK::SwingAgain( void )
{
Swing( 0 );
}
int CNOZIK::Swing( int fFirst )
{
int fDidHit = FALSE;
TraceResult tr;
UTIL_MakeVectors (m_pPlayer->pev->v_angle);
Vector vecSrc = m_pPlayer->GetGunPosition( );
Vector vecEnd = vecSrc + gpGlobals->v_forward * 32;
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );
if ( tr.flFraction >= 1.0 )
{
UTIL_TraceHull( vecSrc, vecEnd, dont_ignore_monsters, head_hull, ENT( m_pPlayer->pev ), &tr );
if ( tr.flFraction < 1.0 )
{
// Calculate the point of intersection of the line (or hull) and the object we hit
// This is and approximation of the "best" intersection
CBaseEntity *pHit = CBaseEntity::Instance( tr.pHit );
if ( !pHit || pHit->IsBSPModel() )
xFindHullIntersection( vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlayer->edict() );
vecEnd = tr.vecEndPos; // This is the point on the actual surface (the hull could have hit space)
}
}
if ( tr.flFraction >= 1.0 )
{
if (fFirst)
{
// miss
switch( RANDOM_LONG( 0, 3 ) )
{
default:
case 0:
SendWeaponAnim( NOZIK_SLASH1); break;
case 1:
SendWeaponAnim( NOZIK_SLASH2 ); break;
case 2:
SendWeaponAnim( NOZIK_MIDSLASH1 ); break;
case 3:
SendWeaponAnim( NOZIK_MIDSLASH2 ); break;
}
m_flNextPrimaryAttack = gpGlobals->time + 0.5;
// play wiff or swish sound
switch ( RANDOM_LONG( 0, 1 ) )
{
case 0:
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/knife_slash1.wav", 1, ATTN_NORM, 0, 94 + RANDOM_LONG(0,0xF));
break;
default:
case 1:
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/knife_slash2.wav", 1, ATTN_NORM, 0, 94 + RANDOM_LONG(0,0xF));
break;
}
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
}
}
else
{
// hit
fDidHit = TRUE;
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
switch( RANDOM_LONG( 0, 3 ) )
{
default:
case 0:
SendWeaponAnim( NOZIK_SLASH1); break;
case 1:
SendWeaponAnim( NOZIK_SLASH2 ); break;
case 2:
SendWeaponAnim( NOZIK_MIDSLASH1 ); break;
case 3:
SendWeaponAnim( NOZIK_MIDSLASH2 ); break;
}
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
ClearMultiDamage( );
if ( (m_flNextPrimaryAttack + 1 < gpGlobals->time) || g_pGameRules->IsMultiplayer() )
{
// first swing does full damage
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB );
}
else
{
// subsequent swings do half
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgCrowbar / 2, gpGlobals->v_forward, &tr, DMG_CLUB );
}
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
m_flNextPrimaryAttack = gpGlobals->time + 0.25;
// play thwack, smack, or dong sound
float flVol = 1.0;
int fHitWorld = TRUE;
if (pEntity)
{
if (pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE)
{
// play thwack or smack sound
switch( RANDOM_LONG(0,3) )
{
case 0:
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/knife_hit1.wav", 1, ATTN_NORM); break;
case 1:
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/knife_hit2.wav", 1, ATTN_NORM); break;
case 2:
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/knife_hit3.wav", 1, ATTN_NORM); break;
case 3:
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/knife_hit4.wav", 1, ATTN_NORM); break;
}
m_pPlayer->m_iWeaponVolume = 128;
if (!pEntity->IsAlive() )
return TRUE;
else
flVol = 0.1;
fHitWorld = FALSE;
}
}
// play texture hit sound
// UNDONE: Calculate the correct point of intersection when we hit with the hull instead of the line
if (fHitWorld)
{
float fvolbar = TEXTURETYPE_PlaySound(&tr, vecSrc, vecSrc + (vecEnd-vecSrc)*2, BULLET_PLAYER_CROWBAR);
if ( g_pGameRules->IsMultiplayer() )
{
// override the volume here, cause we don't play texture sounds in multiplayer,
// and fvolbar is going to be 0 from the above call.
fvolbar = 1;
}
// also play crowbar strike
//UTIL_EmitAmbientSound(ENT(0), ptr->vecEndPos, "weapons/cbar_hit1.wav", fvolbar, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/knife_hitwall1.wav", fvolbar, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
}
// delay the decal a bit
m_trHit = tr;
SetThink( Smack );
pev->nextthink = gpGlobals->time + 0.2;
m_pPlayer->m_iWeaponVolume = flVol * 256;
}
return fDidHit;
}
|
3. Ïalej otvoríme súbor WEAPONS.H a vložíme tieto riadky medzi podobné:
#define WEAPON_NOZIK 21
#define NOZIK_WEIGHT 0
|
4. Otvoríme súbor PLAYER.CPP, nájdeme riadky
case 101:
gEvilImpulse101 = TRUE;
|
a vložíme tento riadok:
GiveNamedItem("weapon_NOZIK" );
|
5. Už ostáva len nakopírova súbory
v_knife.mdl
w_knife.mdl
p_knife.mdl
do adresára models
knife_deploy.wav
knife_hit1.wav
knife_hit2.wav
knife_hit3.wav
knife_hit4.wav
knife_hitwall1.wav
knife_slash1.wav
knife_slash2.wav
do adresára sounds/weapons
|
6. A už zostáva iba dúfa že to pôjde |
BODOVANIE LNKU Boduje sa ako v kole (1- vborn, 5-zl)
Priemern znmka : 1 Hlasovalo : 6
|
KOMENTRE KU LNKU Poet komentrov ku lnku : 5
2. Buksy [30.12.2004-16:52] 642 | este ma napadlo,kde nastavim kolko ma ten nozik ubrat pri zo zivota?a keby som chcel nastavit na pacidle kolko ma ubrat zo zivota?
Netrapte sa,rusi to cracknu
|
3. Andy [02.01.2005-13:32] 680 | Qery, diky za ten tutorial, moc mi to pomohlo ku tvorbe toho naseho modu Bloody Pizza: Vendetta. To demo ti uz nemusim posielat, lebo moj ujo ho da na net okolo 10. januara. Potom sem napisem link |
4. Buksy [04.09.2005-14:20] 1494 | Presne opdla navodu som pridal nozik do spiritu,a po napiani do consoli impulse ma vyhodi do menu a pise
] impulse 101
Host_Error: PF_precache_model_I: 'models/v_knife.mdl' Precache can only be done in spawn functions
Netchan_Clear() : reliable length not 0, reliable_sequence: 22, incoming_reliable_acknowledged: 1Netrapte sa,rusi to cracknu
|
5. goblin [30.05.2006-09:15] 1957 | aj mne to vypise
All I want , all I need is to see my enemy bleed! | Pre pridvanie komentrov muste by prihlsen Pokia ete nieste zaregistrovan, mete tak urobi TU
|
|
|
|
|