New Critical Hits

Posted by Txzeenath on Thu 24 Jun 2004 02:40 PM — 3 posts, 14,580 views.

USA #0
Well.. I'm trying new critical strikes code.. but it goes in with nothing but simple warnings of:
fight.c:1015: warning: unused variable `obj'
fight.c:1014: warning: `dam' might be used uninitialized in this function

but when I fight.. none of the messages ever come up.. anyone have any ideas?






if ( prof_gsn != -1 )
learn_from_failure( ch, prof_gsn );
act( AT_PLAIN, "Your attack misses $N!", ch, NULL, victim, TO_CHAR );
damage( ch, victim, 0, dt );
tail_chain( );
return rNONE;
}
}
/* Critical strikes based off Equipment
*/


if ( diceroll >= 19 )
{
if ( get_eq_char(ch, WEAR_SHIELD ) && !get_eq_char(ch, WEAR_LEGS) )
{
act( AT_FIRE, "You critically hit $N in the legs!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n swings low and critically hits your legs!!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n critically hits $N in the legs!", ch, NULL, victim, TO_NOTVICT );
do_for( supermob, "$N cast 'energy drain' #" );
dam = 2 * dam;
}
else if ( get_eq_char(ch, WEAR_SHIELD) && ( get_eq_char(ch, WEAR_LEGS) )
{
act( AT_FIRE, "Your attack bounces off $n's shield!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n's attack bounces off your shield!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n's attack bounces off $n's shield!", ch, NULL, victim, TO_NOTVICT );
dam = dam - dam/3;
}
else if ( !get_eq_char(ch, WEAR_HEAD ) )
{
act( AT_FIRE, "You critically hit $N in the head!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n critically hits you in the head!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n critcally hits $N in the head!", ch, NULL, victim, TO_NOTVICT );
do_stun (ch, "");
do_for( supermob, "$N stun #" );
dam
= 3.6 * dam;
}
else if ( !get_eq_char(ch, WEAR_BODY ) )
{
act( AT_FIRE, "You critically hit $N in the chest!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n critically hits you in the chest!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n critically hits $N in the chest!", ch, NULL, victim, TO_NOTVICT );
dam = 3 * dam;
}
else if ( !get_eq_char(ch, WEAR_WAIST ) )
{
act( AT_FIRE, "You critically hit $n across the waist!!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n critically hits you in the waist!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n critically hits $N in the chest!", ch, NULL, victim, TO_NOTVICT );
dam = 2 * dam;
}
else if ( !get_eq_char(ch, WEAR_ARMS ) )
{
act( AT_FIRE, "You critically hit $N in the arm, fracturing it!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n critically hits you in the arm, fracturing it!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n critically hits $N in the arm!", ch, NULL, victim, TO_NOTVICT );
do_for( supermob, "$N cast weaken #" );
dam = 2 * dam;
}
else if ( !get_eq_char(ch, WEAR_NECK_1 ) && !get_eq_char(ch, WEAR_NECK_2 ) )
{
act( AT_FIRE, "You critically hit $N in the neck!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n critically hits you in the neck!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n critically hits $N in the neck!", ch, NULL, victim, TO_NOTVICT );
dam = 2.5 * dam;
}
else if ( !get_eq_char(ch, WEAR_NECK_1 ) && get_eq_char(ch, WEAR_NECK_2 ) )
{
act( AT_FIRE, "You critically hit $N in the neck!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n critically hits you in the neck!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n critically hits $N in the neck!", ch, NULL, victim, TO_NOTVICT );
dam = 1.5 * dam;
}
else if ( !get_eq_char(ch, WEAR_LEGS ) )
{
act( AT_FIRE, "You critically hit $N in the legs!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n critically hits you in the legs!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n critically hits $N in the legs!", ch, NULL, victim, TO_NOTVICT );
do_for( supermob, "$N cast 'energy drain' #" );
dam = 2 * dam;
}
else if ( !get_eq_char(ch, WEAR_FEET ) )
{
act( AT_FIRE, "You strike down at $N's feet!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n strikes your feet!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n hits $N's feet!", ch, NULL, victim, TO_NOTVICT );
do_for( supermob, "$N cast 'energy drain' #" );
dam = dam - 5;
}
else if ( !get_eq_char(victim, WEAR_WIELD ) && !get_eq_char(ch, WEAR_WIELD ) && !get_eq_char(victim, WEAR_HANDS ) )
{
act( AT_FIRE, "Your hands are injured by $N's weapon!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$N's hands are injured by your weapon!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n's strike is stopped by $N's weapon!", ch, NULL, victim, TO_NOTVICT );
dam = 2 * dam;
}
else if ( !get_eq_char(victim, WEAR_WIELD ) && !get_eq_char(ch, WEAR_WIELD ) && get_eq_char(victim, WEAR_HANDS ) )
{
act( AT_FIRE, "Your gloves protect your hands from $N's weapon!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$N's gloves protect $S from your weapon!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$N's hands are protected from $N's weapon!", ch, NULL, victim, TO_NOTVICT );
dam = dam + dam/3;
}
}

/*
* Bonuses.
*/
dam += GET_DAMROLL(ch);

if ( prof_bonus )
dam += prof_bonus / 4;
USA #1
Well.. I got the strikes to appear work etc. with a diff code.. one thing tho.. I want it so when someone gets hit in the arm they have the spell/affect weaken applied to them


What would be the simplest way of doing this?
USA #2
Look up what weaken's effect is, then look up how effects are applied (affect_modify and all), and then just call the function - it's actually pretty straightforward I believe.