Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, DotBot

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,396
629
DarrenPayn
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » Critical Hit Snippet
Forum Rules | Mark all | Recent Posts

Critical Hit Snippet
< Newer Topic :: Older Topic > Please Help

Pages:<< prev 1 next >>
Post is unread #1 Aug 10, 2003, 10:16 am
Go to the top of the page
Go to the bottom of the page

Yourdrunkendad

GroupMembers
Posts4
JoinedAug 9, 2003

I've tried to implement this critical hit snippet into my smaug1.4a codebase in fight.c
Right under this piece of code..
/*
* Inflict damage from a hit. This is one damn big function.
*/
ch_ret damage( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt )
{
char buf[MAX_STRING_LENGTH];
char buf1[MAX_STRING_LENGTH];
char filename[256];
sh_int dameq;
sh_int maxdam;
bool npcvict;
bool loot;
int xp_gain;
OBJ_DATA *damobj;
ch_ret retcode;
sh_int dampmod;
CHAR_DATA *gch /*, *lch */;
int init_gold, new_gold, gold_diff;
sh_int anopc = 0; /* # of (non-pkill) pc in a (ch) */
sh_int bnopc = 0; /* # of (non-pkill) pc in b (victim) */

I have inserted this piece of code:
/*
* Critical Hit -- Add onto by randomizing the critical hit and damage...
* By: Josh Jenks [Haelyn]...snippet for SMAUG 1.4a
* Added in and changed by Odis
*/
int diceroll;
while ( ( diceroll = number_bits( 5 ) ) >= 20 )
;
if ( diceroll >= 19 )

{
int place;
place = number_range( 1, 4 );
if ( place == 1 )
{
act( AT_FIRE, "You hit $N's hand!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n hits your hand!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n hits $N's! hand!", ch, NULL, victim, TO_NOTVICT );
dam *= 1.5;
}
else if ( place == 2 )
{
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 *= 2;
}
else if ( place == 3 )
{
act( AT_FIRE, "You bash $N's head!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n bashes your head!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n bashes $N's head!", ch, NULL, victim, TO_NOTVICT );
dam *= 2.5;
}
else if( place == 4 )
{
act( AT_FIRE, "You mutilate $N's groin!", ch, NULL, victim, TO_CHAR );
act( AT_FIRE, "$n mutilates you in the groin!", ch, NULL, victim, TO_VICT );
act( AT_FIRE, "$n mutilates $N's groin!", ch, NULL, victim, TO_NOTVICT );
dam *= 2;
}
}

The problem I'm having with it is that it doesn't always multiply the damage.
Example
You mutilate Steve in the groin!
Your slash _traumatizes_ Steve [376]

ie. it multiplied the power of the attack .. how it should work, and sometimes does.
Then sometimes it will do this:
You mutilate Steve in the groin!
Your slash injures Steve [179]

Damage not amplified... somethings wrong:
And there's more...sometimes it will just do this:
Steve mutilates you in the groin!

And does no damage whatsoever... can anyone help me out with this please, I'm baffled. When I first put it in it didn't work at all and I've changed things and moved it and changed some more, and this is the best I can get it to work. Thanks for taking the time to read this ridiculously long post.
       
Post is unread #2 Aug 10, 2003, 10:50 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,644
JoinedJan 1, 2002

Moved to general coding. This has no bearing on AFKMud.
       
Pages:<< prev 1 next >>