Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Respawn Kill
#1
Code:
void CDisc::DiscTouch ( CBaseEntity *pOther )
{
    // Push players backwards
    if ( pOther->IsPlayer() )
    {
 if ( ((CBaseEntity*)m_hOwner) == pOther )
 {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (m_fDontTouchOwner < gpGlobals->time)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp; &nbsp;// Play catch sound
&nbsp; &nbsp;EMIT_SOUND_DYN( pOther->edict(), CHAN_WEAPON, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));

&nbsp; &nbsp;ReturnToThrower();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;
&nbsp;}
&nbsp;else if ( m_fDontTouchEnemies < gpGlobals->time)
&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( pev->team != pOther->pev->team )
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp; &nbsp;((CBasePlayer*)pOther)->m_LastHitGroup = HITGROUP_GENERIC;

&nbsp; &nbsp;// Do freeze seperately so you can freeze and shatter a person with a single shot
&nbsp; &nbsp;if ( m_iPowerupFlags &amp; POW_FREEZE &amp;&amp; ((CBasePlayer*)pOther)->m_iFrozen == FALSE )
&nbsp; &nbsp;{
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Freeze the player and make them glow blue
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EMIT_SOUND_DYN( pOther->edict(), CHAN_WEAPON, "weapons/electro5.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->Freeze();

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// If it's not a decap, return now. If it's a decap, continue to shatter
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( !m_bDecapitate )
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp; &nbsp; &nbsp;m_fDontTouchEnemies = gpGlobals->time + 2.0;
&nbsp; &nbsp; &nbsp;return;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp; &nbsp;}

&nbsp; &nbsp;// Decap or push
&nbsp; &nbsp;if (m_bDecapitate)
&nbsp; &nbsp;{
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Decapitate!
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( m_bTeleported )
&nbsp; &nbsp; &nbsp;((CBasePlayer*)pOther)->m_flLastDiscHitTeleport = gpGlobals->time;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->Decapitate( ((CBaseEntity*)m_hOwner)->pev );

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_fDontTouchEnemies = gpGlobals->time + 0.5;
&nbsp; &nbsp;}
&nbsp; &nbsp;else
&nbsp; &nbsp;{
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Play thwack sound
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch( RANDOM_LONG(0,2) )
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 0:
&nbsp; &nbsp; &nbsp;EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
&nbsp; &nbsp; &nbsp;break;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 1:
&nbsp; &nbsp; &nbsp;EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
&nbsp; &nbsp; &nbsp;break;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 2:
&nbsp; &nbsp; &nbsp;EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
&nbsp; &nbsp; &nbsp;break;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Push the player
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vector vecDir = pev->velocity.Normalize();
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pOther->pev->flags &amp;= ~FL_ONGROUND;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->m_vecHitVelocity = vecDir * DISC_PUSH_MULTIPLIER;

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Shield flash only if the player isnt frozen
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( ((CBasePlayer*)pOther)->m_iFrozen == false )
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp; &nbsp; &nbsp;pOther->pev->renderfx = kRenderFxGlowShell;
&nbsp; &nbsp; &nbsp;pOther->pev->rendercolor.x = 255;
&nbsp; &nbsp; &nbsp;pOther->pev->renderamt = 150;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->m_hLastPlayerToHitMe = m_hOwner;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->m_flLastDiscHit = gpGlobals->time;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->m_flLastDiscBounces = m_iBounces;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( m_bTeleported )
&nbsp; &nbsp; &nbsp;((CBasePlayer*)pOther)->m_flLastDiscHitTeleport = gpGlobals->time;

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_fDontTouchEnemies = gpGlobals->time + 2.0;
&nbsp; &nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}

Hmm. Seems to me that the else if ( m_fDontTouchEnemies &lt; gpGlobals-&gt;time) also needs to check if a player is dead, since they shouldn't be touched either. Don't know if that has been cured already?:)
Reply
#2
out of curiosity, could someone actually send me the updated code so I know what you are all working with:P
Reply
#3
netniV,

I will zip up the Windows version of the Ricochet code and make it available
here. Since everyone who has posted probably has the SDK, I will only zip the ricochet directory and below on &quot;Multiplayer Source&quot; since there have been no changes to date on the common files.

Look for that later tonight or tomorrow.


desNotes
Reply
#4
And what about the above bit of code? :-D
Reply
#5
netniv, what's a respawn kill? also, how do you hit dead bodies in dm for extra points? i don't play much dm, so i don't really know...i suspect these are easy fixes.

i think what you want to do is in the statement (about 1/4 of the way down your code snippet):

if ( pev-&gt;team != pOther-&gt;pev-&gt;team )
{...


you would want:

if ((pev-&gt;team != pOther-&gt;pev-&gt;team) &amp;&amp; (pOther-&gt;IsAlive()))
{...


is that right? please pm me. thnx.
Reply
#6
In DM when you get a decap kill and then hit them again with a push disk thats how you get the extra points.

Is there a way of getting rid of the body right away or making it move down into the pad right away after decap so that the persons disc just go over them.



As to respawn killing what about just making the person so that discs pass through them for say 3 or 4 seconds. This way it gives them time to fully respawn and start moving.

Only problem I can see with this is the person can be passed through what happens if a person or a disc is in them when they turn solid?
Reply
#7
thanks for the info gwars.

yeah, i personally would rather see a player get like &quot;vaporized&quot; when decapped. that's probably what i would do for ricochet2. sort of like have them turn into a field of energy which quickly diminishes and have a heavily processed &quot;aaarghhh!!!&quot; voice sample triggered which would trail/morph into a robotic sounding hiss. anyways, i believe that code snippet i posted would fix the &quot;extra pt&quot; problem so i'm going to implement it and test it tonight.

my idea is why not have the player all of a sudden fade out like a ghost when decapped? i think that's possible...but geez, i don't know. i would have to see if the hl engine would allow me to do that. that's one good thing i like about the female model actually...she goes right on her back when decapped.

as far as your idea on the respawn kill...i don't like it much just because when a player spawned, everyone else would be at a disadvantage. unless you made it so the player couldn't fire to for a couple seconds too. i would like to get more feedback before i fix something like that.
Reply
#8
i was going to post this under a new topic, but i think it's more fitting here:

i fixed the whole &quot;getting extra points off the dead and decapitated in dm&quot; thing...using the code snipet i posted above in red. however, it is exactly the same logic and idea as netniv was suggesting (equivalent because their is no real need for the nested 'if' statement that i placed the new condition in...doesn't hurt anything though in terms of cycles of course).

to reiterate, if you want to get rid of people exploiting the dead in dm, do this ^_^:

just comment out the original function DiscTouch() belonging to the CDisc class in &quot;disc_weapon_disc.cpp&quot; (as shown in the first post in this thread), and place this modified function directly below it (you could just modify that small chunk of code but be careful in case you want to revert):

void CDisc::DiscTouch ( CBaseEntity *pOther )
{
// Push players backwards
if ( pOther-&gt;IsPlayer() )
{
if ( ((CBaseEntity*)m_hOwner) == pOther )
{
if (m_fDontTouchOwner &lt; gpGlobals-&gt;time)
{
// Play catch sound
EMIT_SOUND_DYN( pOther-&gt;edict(), CHAN_WEAPON, &quot;items/gunpickup2.wav&quot;, 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));

ReturnToThrower();
}

return;
}
else if ( m_fDontTouchEnemies &lt; gpGlobals-&gt;time)
{
// .ASM - netniV's solution to the &quot;extra point&quot; exploit
if ( (pev-&gt;team != pOther-&gt;pev-&gt;team) &amp;&amp; (pOther-&gt;IsAlive()) ) // end .ASM

{
((CBasePlayer*)pOther)-&gt;m_LastHitGroup = HITGROUP_GENERIC;

// Do freeze seperately so you can freeze and shatter a person with a single shot
if ( m_iPowerupFlags &amp; POW_FREEZE &amp;&amp; ((CBasePlayer*)pOther)-&gt;m_iFrozen == FALSE )
{
// Freeze the player and make them glow blue
EMIT_SOUND_DYN( pOther-&gt;edict(), CHAN_WEAPON, &quot;weapons/electro5.wav&quot;, 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
((CBasePlayer*)pOther)-&gt;Freeze();

// If it's not a decap, return now. If it's a decap, continue to shatter
if ( !m_bDecapitate )
{
m_fDontTouchEnemies = gpGlobals-&gt;time + 2.0;
return;
}
}

// Decap or push
if (m_bDecapitate)
{
// Decapitate!
if ( m_bTeleported )
((CBasePlayer*)pOther)-&gt;m_flLastDiscHitTeleport = gpGlobals-&gt;time;
((CBasePlayer*)pOther)-&gt;Decapitate( ((CBaseEntity*)m_hOwner)-&gt;pev );

m_fDontTouchEnemies = gpGlobals-&gt;time + 0.5;
}
else
{
// Play thwack sound
switch( RANDOM_LONG(0,2) )
{
case 0:
EMIT_SOUND_DYN( pOther-&gt;edict(), CHAN_ITEM, &quot;weapons/cbar_hitbod1.wav&quot;, 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
break;
case 1:
EMIT_SOUND_DYN( pOther-&gt;edict(), CHAN_ITEM, &quot;weapons/cbar_hitbod2.wav&quot;, 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
break;
case 2:
EMIT_SOUND_DYN( pOther-&gt;edict(), CHAN_ITEM, &quot;weapons/cbar_hitbod3.wav&quot;, 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
break;
}

// Push the player
Vector vecDir = pev-&gt;velocity.Normalize();
pOther-&gt;pev-&gt;flags &amp;= ~FL_ONGROUND;
((CBasePlayer*)pOther)-&gt;m_vecHitVelocity = vecDir * DISC_PUSH_MULTIPLIER;

// Shield flash only if the player isnt frozen
if ( ((CBasePlayer*)pOther)-&gt;m_iFrozen == false )
{
pOther-&gt;pev-&gt;renderfx = kRenderFxGlowShell;
pOther-&gt;pev-&gt;rendercolor.x = 255;
pOther-&gt;pev-&gt;renderamt = 150;
}

((CBasePlayer*)pOther)-&gt;m_hLastPlayerToHitMe = m_hOwner;
((CBasePlayer*)pOther)-&gt;m_flLastDiscHit = gpGlobals-&gt;time;
((CBasePlayer*)pOther)-&gt;m_flLastDiscBounces = m_iBounces;
if ( m_bTeleported )
((CBasePlayer*)pOther)-&gt;m_flLastDiscHitTeleport = gpGlobals-&gt;time;

m_fDontTouchEnemies = gpGlobals-&gt;time + 2.0;
}
}
}
}
Reply
#9
That's pretty much what I thought... though I'm a code efficiency freak so I tend to merge 'if' statements if it's all part of the same block:)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)