Hello,I'm new to the lands of compiling my own server. I've been a MUD player for many years now and want something to call my own. I found SMAUG to be an awesome program, but I wanted to change one thing. But that one thing probably isn't going to be so easy. I want to make it so a character doesn't attack on it's own. I want to be able to control it the whole way. Like if I didn't want to attack I could just let a monster beat on me for a while. I've fiddled around with the code(In C++). But I'm having troubles locating the fighting system, and I think once I did I wouldn't know what to do anyway. Any help would be AWESOME! Thanks.
Fighting System
Posted by Rok on Mon 25 Jun 2001 04:42 PM — 32 posts, 111,810 views.
I would look in fight.c, starting at the function "violence_update".
This is a major change, of course. When you fight in SMAUG it goes into "fight mode" where the fight is regulated by the server.
You would probably take out the bit where it sets the flag:
ch->fighting
Then if the character does (say) a kick, then you would do, once, whatever that normally does in the fight loop.
This is a major change, of course. When you fight in SMAUG it goes into "fight mode" where the fight is regulated by the server.
You would probably take out the bit where it sets the flag:
ch->fighting
Then if the character does (say) a kick, then you would do, once, whatever that normally does in the fight loop.
OK, I've worked out quite a bit of the quirks with the new fighting system, I still have a way to go but I figured while I was at it I would try to work this out, and see if you could offer any advice. I want to be able to see how much damage my character is doing. Instead of saying " ... you mauled the rat..." or whatnot, I want to have it say something along the lines of "You did 14 damage to the rat!" and so fourth... Any Ideas on how to put that into action?
In fight.c there is a function "new_dam_message" that converts damage from numbers into words. Just rewrite that to keep the numbers.
Rock on, Thanks for all the help Nick!
Hmm.... Ok, now I'm confused. For the New_Dam_message, I changed what I thought I needed to but it didn't work, now I have an error and I'm not real sure what I did.. Any clue?
Here is the Error message I get:
error C2371: 'new_dam_message' : redefinition; different basic types
This is what my code looks like now:
void new_dam_message( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, OBJ_DATA *obj )
{
char buf1[256], buf2[256], buf3[256];
char bugbuf[MAX_STRING_LENGTH];
const char *vs;
const char *vp;
const char *attack;
char punct;
sh_int dampc;
struct skill_type *skill = NULL;
bool gcflag = FALSE;
bool gvflag = FALSE;
int d_index, w_index;
ROOM_INDEX_DATA *was_in_room;
if ( ! dam )
dampc = 0;
else
dampc = ( (dam * 1000) / victim->max_hit) +
( 50 - ((victim->hit * 50) / victim->max_hit) );
if ( ch->in_room != victim->in_room )
{
was_in_room = ch->in_room;
char_from_room(ch);
char_to_room(ch, victim->in_room);
}
else
was_in_room = NULL;
/* Get the weapon index */
if ( dt > 0 && dt < top_sn )
{
w_index = 0;
}
else
if ( dt >= TYPE_HIT && dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]) )
{
w_index = dt - TYPE_HIT;
}
else
{
sprintf(bugbuf, "Dam_message: bad dt %d from %s in %d.",
dt, ch->name, ch->in_room->vnum );
bug( bugbuf, 0);
dt = TYPE_HIT;
w_index = 0;
}
/* get the damage index */
if(dam == 0)
d_index = 0;
else if(dampc < 0)
d_index = 1;
else if(dampc <= 100)
d_index = 1 + dampc/10;
else if(dampc <= 200)
d_index = 11 + (dampc - 100)/20;
else if(dampc <= 900)
d_index = 16 + (dampc - 200)/100;
else
d_index = 23;
/* Lookup the damage message */
vs = s_message_table[w_index][d_index];
vp = p_message_table[w_index][d_index];
punct = (dampc <= 30) ? '.' : '!';
if ( dam == 0 && (!IS_NPC(ch) &&
(IS_SET(ch->pcdata->flags, PCFLAG_GAG)))) gcflag = TRUE;
if ( dam == 0 && (!IS_NPC(victim) &&
(IS_SET(victim->pcdata->flags, PCFLAG_GAG)))) gvflag = TRUE;
if ( dt >=0 && dt < top_sn )
skill = skill_table[dt];
if ( dt == TYPE_HIT )
{
sprintf( buf1, "$n %s $N%c", vp, punct );
sprintf( buf2, "You %s $N%c", vs, punct );
sprintf( buf3, "$n %s you%c", vp, punct );
}
else
if ( dt > TYPE_HIT && is_wielding_poisoned( ch ) )
{
if ( dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]) )
attack = attack_table[dt - TYPE_HIT];
else
{
sprintf(bugbuf, "Dam_message: bad dt %d from %s in %d.",
dt, ch->name, ch->in_room->vnum );
bug( bugbuf, 0);
dt = TYPE_HIT;
attack = attack_table[0];
}
sprintf( buf1, "$n's poisoned %s %s $N%c", attack, vp, punct );
sprintf( buf2, "Your poisoned %s %s $N%c", attack, vp, punct );
sprintf( buf3, "$n's poisoned %s %s you%c", attack, vp, punct );
}
else
{
if ( skill )
{
attack = skill->noun_damage;
if ( dam == 0 )
{
bool found = FALSE;
if ( skill->miss_char && skill->miss_char[0] != '\0' )
{
act( AT_HIT, skill->miss_char, ch, NULL, victim, TO_CHAR );
found = TRUE;
}
if ( skill->miss_vict && skill->miss_vict[0] != '\0' )
{
act( AT_HITME, skill->miss_vict, ch, NULL, victim, TO_VICT );
found = TRUE;
}
if ( skill->miss_room && skill->miss_room[0] != '\0' )
{
if (strcmp( skill->miss_room,"supress" ) )
act( AT_ACTION, skill->miss_room, ch, NULL, victim, TO_NOTVICT );
found = TRUE;
}
Here is the Error message I get:
error C2371: 'new_dam_message' : redefinition; different basic types
This is what my code looks like now:
void new_dam_message( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, OBJ_DATA *obj )
{
char buf1[256], buf2[256], buf3[256];
char bugbuf[MAX_STRING_LENGTH];
const char *vs;
const char *vp;
const char *attack;
char punct;
sh_int dampc;
struct skill_type *skill = NULL;
bool gcflag = FALSE;
bool gvflag = FALSE;
int d_index, w_index;
ROOM_INDEX_DATA *was_in_room;
if ( ! dam )
dampc = 0;
else
dampc = ( (dam * 1000) / victim->max_hit) +
( 50 - ((victim->hit * 50) / victim->max_hit) );
if ( ch->in_room != victim->in_room )
{
was_in_room = ch->in_room;
char_from_room(ch);
char_to_room(ch, victim->in_room);
}
else
was_in_room = NULL;
/* Get the weapon index */
if ( dt > 0 && dt < top_sn )
{
w_index = 0;
}
else
if ( dt >= TYPE_HIT && dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]) )
{
w_index = dt - TYPE_HIT;
}
else
{
sprintf(bugbuf, "Dam_message: bad dt %d from %s in %d.",
dt, ch->name, ch->in_room->vnum );
bug( bugbuf, 0);
dt = TYPE_HIT;
w_index = 0;
}
/* get the damage index */
if(dam == 0)
d_index = 0;
else if(dampc < 0)
d_index = 1;
else if(dampc <= 100)
d_index = 1 + dampc/10;
else if(dampc <= 200)
d_index = 11 + (dampc - 100)/20;
else if(dampc <= 900)
d_index = 16 + (dampc - 200)/100;
else
d_index = 23;
/* Lookup the damage message */
vs = s_message_table[w_index][d_index];
vp = p_message_table[w_index][d_index];
punct = (dampc <= 30) ? '.' : '!';
if ( dam == 0 && (!IS_NPC(ch) &&
(IS_SET(ch->pcdata->flags, PCFLAG_GAG)))) gcflag = TRUE;
if ( dam == 0 && (!IS_NPC(victim) &&
(IS_SET(victim->pcdata->flags, PCFLAG_GAG)))) gvflag = TRUE;
if ( dt >=0 && dt < top_sn )
skill = skill_table[dt];
if ( dt == TYPE_HIT )
{
sprintf( buf1, "$n %s $N%c", vp, punct );
sprintf( buf2, "You %s $N%c", vs, punct );
sprintf( buf3, "$n %s you%c", vp, punct );
}
else
if ( dt > TYPE_HIT && is_wielding_poisoned( ch ) )
{
if ( dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]) )
attack = attack_table[dt - TYPE_HIT];
else
{
sprintf(bugbuf, "Dam_message: bad dt %d from %s in %d.",
dt, ch->name, ch->in_room->vnum );
bug( bugbuf, 0);
dt = TYPE_HIT;
attack = attack_table[0];
}
sprintf( buf1, "$n's poisoned %s %s $N%c", attack, vp, punct );
sprintf( buf2, "Your poisoned %s %s $N%c", attack, vp, punct );
sprintf( buf3, "$n's poisoned %s %s you%c", attack, vp, punct );
}
else
{
if ( skill )
{
attack = skill->noun_damage;
if ( dam == 0 )
{
bool found = FALSE;
if ( skill->miss_char && skill->miss_char[0] != '\0' )
{
act( AT_HIT, skill->miss_char, ch, NULL, victim, TO_CHAR );
found = TRUE;
}
if ( skill->miss_vict && skill->miss_vict[0] != '\0' )
{
act( AT_HITME, skill->miss_vict, ch, NULL, victim, TO_VICT );
found = TRUE;
}
if ( skill->miss_room && skill->miss_room[0] != '\0' )
{
if (strcmp( skill->miss_room,"supress" ) )
act( AT_ACTION, skill->miss_room, ch, NULL, victim, TO_NOTVICT );
found = TRUE;
}
The error message suggests you have defined "new_dam_message" twice. Did you get rid of the earlier one? You don't have two of them in the same source file do you?
Ok, I have not been doing good in either of the things I have been trying to acomplish. I just think I do not have enough knowledge of the C++ language to re-work the fighting system just yet. However I think I can do the damage roll thing. Under new_dam_message what should I do?(To get it so that only numbers come up) I tried a few things... and most everything I could think of short of just deleting the whole thing.... I'm stuck and I don't know what to do. Any help would be much appritiated!
Oh... by the way, you're really smart! how did you learn all of this coding for Smaug??? I find it difficult changing just key things without having to re-write the whole freakin' thing!
Oh... by the way, you're really smart! how did you learn all of this coding for Smaug??? I find it difficult changing just key things without having to re-write the whole freakin' thing!
There are a couple of places I would change in fight.c in function new_dam_message. The original code is commented out, my replacement code precedes it.
sprintf( buf1, "$n inflicts %i damage on $N%c", dam, punct );
sprintf( buf2, "You inflict %i damage on $N%c", dam, punct );
sprintf( buf3, "$n inflicts %i damage on you%c", dam, punct );
// sprintf( buf1, "$n %s $N%c", vp, punct );
// sprintf( buf2, "You %s $N%c", vs, punct );
// sprintf( buf3, "$n %s you%c", vp, punct );
// ..... and later on .......
sprintf( buf1, "$n inflicts %i damage on $N%c", dam, punct );
sprintf( buf2, "You inflict %i damage on $N%c", dam, punct );
sprintf( buf3, "$n inflicts %i damage on you%c", dam, punct );
// sprintf( buf1, "$n's %s %s $N%c", attack, vp, punct );
// sprintf( buf2, "Your %s %s $N%c", attack, vp, punct );
// sprintf( buf3, "$n's %s %s you%c", attack, vp, punct );
Thanks for all the help dude! I've been on vacation thus didn't get your messages any earlyer. Thanks for all the help on this mud. I should be getting back into the programming kick here in a few. I'll use that code deffinitly thanks! I was also looking at my other things quest and I was wondering.... well I'll ask in the catagory.
Awesome, thanks for all the help. I used the base of your code and just changed it a little. I also added in a little thing because I like it to say I miss when I miss, so any one else who wants to do it here is the code that I came up with , well mostly nick ;)
if ( dt == TYPE_HIT && dam == 0 ) //miss message ~Rok~
sprintf(buf1, "$n misses $N badly!", vp, punct );
sprintf(buf2, "You miss $N badly!", vs, punct );
sprintf(buf3, "$n misses $N badly!", vp, punct);
}
else if ( dt == TYPE_HIT ) //damage number & text
sprintf(buf1, "$n %s $N for %i damage%c", vp, dam, punct );
sprintf(buf2, "You %s $N for %i damage%c", vs, dam, punct );
sprintf(buf3, "$n %s $N for %i damage%c", vp, dam, punct );
}
Then Later on
sprintf( buf1, "$n %s $N for %i damage%c", vp, dam, punct );
sprintf( buf2, "You %s $N for %i damage%c", vp, dam,punct );
sprintf( buf3, "$n %s $N for %i damage%c", vp, dam, punct );
Oh, I had a question on top of that, it doesn't have to do with the fighting system but I don't know where to post it. I was thinking it would be really nice if there was a program that could search through all the player files and find the ones that havn't been modifide for like I don't know like a month and a half or something then automatticly puts a flag on them so you can delete them later, or know that it hasn't been used. Do you know of any programs like that?
if ( dt == TYPE_HIT && dam == 0 ) //miss message ~Rok~
sprintf(buf1, "$n misses $N badly!", vp, punct );
sprintf(buf2, "You miss $N badly!", vs, punct );
sprintf(buf3, "$n misses $N badly!", vp, punct);
}
else if ( dt == TYPE_HIT ) //damage number & text
sprintf(buf1, "$n %s $N for %i damage%c", vp, dam, punct );
sprintf(buf2, "You %s $N for %i damage%c", vs, dam, punct );
sprintf(buf3, "$n %s $N for %i damage%c", vp, dam, punct );
}
Then Later on
sprintf( buf1, "$n %s $N for %i damage%c", vp, dam, punct );
sprintf( buf2, "You %s $N for %i damage%c", vp, dam,punct );
sprintf( buf3, "$n %s $N for %i damage%c", vp, dam, punct );
Oh, I had a question on top of that, it doesn't have to do with the fighting system but I don't know where to post it. I was thinking it would be really nice if there was a program that could search through all the player files and find the ones that havn't been modifide for like I don't know like a month and a half or something then automatticly puts a flag on them so you can delete them later, or know that it hasn't been used. Do you know of any programs like that?
Well, you could just use the Windows "find" utility to search for files in the player directory whose date modified was less than a certain date.
Another approach is to use the "grub" command in SMAUG. Here is an example from the help file:
For grub to work you need to build a grub file, or whatever it is called. There is a program called "grux" that does that. This reads every player file and builds a database that the grub command then searches.
I must admit I can't find the grux program in the current source. If you want it I'll take a lengthier look.
Another approach is to use the "grub" command in SMAUG. Here is an example from the help file:
grub 20 level=2 last<=970120 Display 20 L2 players absent since 970120
For grub to work you need to build a grub file, or whatever it is called. There is a program called "grux" that does that. This reads every player file and builds a database that the grub command then searches.
I must admit I can't find the grux program in the current source. If you want it I'll take a lengthier look.
All right, thanks again nick!
Alright, here is what is happening now. I want to be able to see what attack I'm using when it happens... instead of it saying "You **smites** the gas dragon for 15 damage" or whatever it may be, I want it to say "Your <Weapon name> <damage text> <Creature> for <#> damage"
Here is what I put
sprintf(buf2, "Your %s %s $N for %i damage%c", vs, dam, punct );
*************************EDIT*************************
Nevermind I got it working just fine now ~ Thanks anyhow!
Here is what I put
sprintf(buf2, "Your %s %s $N for %i damage%c", vs, dam, punct );
*************************EDIT*************************
Nevermind I got it working just fine now ~ Thanks anyhow!
Ok, Well I thought I was done with this but apparently not. Now the miss damage doesn't work again and I'm not sure why, I have tried several things and I am probably missing some mundane detail because that is just what I do. Here is what I have now:
**********************************************************
if ( dt == TYPE_HIT && dam == 0) // Miss damage message ~Rok~
{ //
sprintf(buf1, "$n's %s misses $N badly!", attack ); // This is in hope of a miss
sprintf(buf2, "Your %s misses $N badly!", attack ); // message not showing the
sprintf(buf3, "$n's %s misses you badly!", attack ); // 0 pts of damage ~Rok~
} //
else if ( dt == TYPE_HIT && dam >=1) //
{
sprintf(buf1, "$n's %s %s $N for %i damage%c", attack, vp, dam, punct ); //We Want the Number Damage Message ~Rok~
sprintf(buf2, "Your %s %s $N for %i damage%c", attack, vs, dam, punct ); //We Want the Number Damage Message ~Rok~
sprintf(buf3, "$n's %s %s you for %i damage%c",attack, vp, dam, punct ); //We Want the Number Damage Message ~Rok~
}
***************************THEN LATER ON***************************
sprintf( buf1, "$n's %s %s $N for %i damage%c", attack, vp, dam, punct ); //We Want the Damage Message ~Rok~
sprintf( buf2, "Your %s %s $N for %i damage%c", attack, vp, dam, punct ); //We Want the Damage Message ~Rok~
sprintf( buf3, "$n's %s %s you for %i damage%c", attack, vp, dam, punct ); //We Want the Damage Message ~Rok~
**********************************************************
if ( dt == TYPE_HIT && dam == 0) // Miss damage message ~Rok~
{ //
sprintf(buf1, "$n's %s misses $N badly!", attack ); // This is in hope of a miss
sprintf(buf2, "Your %s misses $N badly!", attack ); // message not showing the
sprintf(buf3, "$n's %s misses you badly!", attack ); // 0 pts of damage ~Rok~
} //
else if ( dt == TYPE_HIT && dam >=1) //
{
sprintf(buf1, "$n's %s %s $N for %i damage%c", attack, vp, dam, punct ); //We Want the Number Damage Message ~Rok~
sprintf(buf2, "Your %s %s $N for %i damage%c", attack, vs, dam, punct ); //We Want the Number Damage Message ~Rok~
sprintf(buf3, "$n's %s %s you for %i damage%c",attack, vp, dam, punct ); //We Want the Number Damage Message ~Rok~
}
***************************THEN LATER ON***************************
sprintf( buf1, "$n's %s %s $N for %i damage%c", attack, vp, dam, punct ); //We Want the Damage Message ~Rok~
sprintf( buf2, "Your %s %s $N for %i damage%c", attack, vp, dam, punct ); //We Want the Damage Message ~Rok~
sprintf( buf3, "$n's %s %s you for %i damage%c", attack, vp, dam, punct ); //We Want the Damage Message ~Rok~
I'm not sure what you are doing with the // symbol in various places.
In C (C++ really) you use // for a single-line comment. That is, it comments from // to the end of the line.
Thus, something like this won't do much:
The // on the first line is just a blank comment.
Perhaps what you want is a multi-line comment, like this:
In C (C++ really) you use // for a single-line comment. That is, it comments from // to the end of the line.
Thus, something like this won't do much:
{ //
sprintf(buf1, "$n's %s misses $N badly!", attack ); // This is in hope of a miss
sprintf(buf2, "Your %s misses $N badly!", attack ); // message not showing the
sprintf(buf3, "$n's %s misses you badly!", attack ); // 0 pts of damage ~Rok~
} //
The // on the first line is just a blank comment.
Perhaps what you want is a multi-line comment, like this:
{
/* ----- The next few lines are commented out -----
sprintf(buf1, "$n's %s misses $N badly!", attack );
sprintf(buf2, "Your %s misses $N badly!", attack );
sprintf(buf3, "$n's %s misses you badly!", attack );
*/
}
Yeah I put the // there so that I can know where it is that I changed stuff because many times I do stuff that doesn't work That is why I put the // so if something messes up I know what how to fix it. But that won't change the miss message from working or not working.... I'm just not sure.
Ah yes, I see.
Now to solve the problem, can you specify in what way it isn't working? Can you paste in a log of what you see, and explain what you expected to see?
Now to solve the problem, can you specify in what way it isn't working? Can you paste in a log of what you see, and explain what you expected to see?
Here is what it currently says:
<3441hp 310bp 3088mv>
Your slash _cleaves_ Gas Dragon for 201 damage!
You parry Gas Dragon's attack.
You parry Gas Dragon's attack.
You parry Gas Dragon's attack.
You parry Gas Dragon's attack.
You parry Gas Dragon's attack.
You parry Gas Dragon's attack.
<3441hp 310bp 3087mv>
kick
Your kick misses Gas Dragon for 0 damage.
The last thing is what I want to change to say:
"Your kick misses Gas Dragon."
<3441hp 310bp 3088mv>
Your slash _cleaves_ Gas Dragon for 201 damage!
You parry Gas Dragon's attack.
You parry Gas Dragon's attack.
You parry Gas Dragon's attack.
You parry Gas Dragon's attack.
You parry Gas Dragon's attack.
You parry Gas Dragon's attack.
<3441hp 310bp 3087mv>
kick
Your kick misses Gas Dragon for 0 damage.
The last thing is what I want to change to say:
"Your kick misses Gas Dragon."
I would have to guess that the condition in your 'if' isn't being met, eg. it is a skill and not a hit.
I would try adding a temporary message to to display the value of relevant variables, eg. dt.
I would try adding a temporary message to to display the value of relevant variables, eg. dt.
Hmm... I can't seem to get it to work at all. No matter what I do... It is like it just isn't seeing it. I know that isn't ture but I don't know what I'm doing wrong. How would you go about writing the if??? The only requirements I could think of is a TYPE_HIT and dam = 0 but that just isn't doing it.... Unless I've got a syntax error. The code is still the same as above. Any Suggestions?
Oh, I guess the cod isn't still up there here it is:
if (dt == TYPE_HIT && dam == 0)
{
sprintf(buf1, "$n's %s %s $N badly%c", attack, vp, punct );
sprintf(buf2, "Your %s %s $N badly%c", attack, vp, punct );
sprintf(buf3, "$n's %s %s you badly%c", attack, vp, punct );
}
else if ( dt == TYPE_HIT && dam >=1)
{
sprintf(buf1, "$n's %s %s $N for %i damage%c", attack, vp, dam, punct );
sprintf(buf2, "Your %s %s $N for %i damage%c", attack, vs, dam, punct );
sprintf(buf3, "$n's %s %s you for %i damage%c",attack, vp, dam, punct );
}
Oh, I guess the cod isn't still up there here it is:
if (dt == TYPE_HIT && dam == 0)
{
sprintf(buf1, "$n's %s %s $N badly%c", attack, vp, punct );
sprintf(buf2, "Your %s %s $N badly%c", attack, vp, punct );
sprintf(buf3, "$n's %s %s you badly%c", attack, vp, punct );
}
else if ( dt == TYPE_HIT && dam >=1)
{
sprintf(buf1, "$n's %s %s $N for %i damage%c", attack, vp, dam, punct );
sprintf(buf2, "Your %s %s $N for %i damage%c", attack, vs, dam, punct );
sprintf(buf3, "$n's %s %s you for %i damage%c",attack, vp, dam, punct );
}
What I mean is to do something like this. Before the code you just had, put this ...
This will let you see whether dt and dam are what you expect.
sprintf (buf1, "dt = %i, dam = %i\n\r", dt, dam);
send_to_char (buf1, ch);
This will let you see whether dt and dam are what you expect.
Oh you are right, The dt isn't what I was expecting at all. So I got around that and I still can't understand what is wrong. The dt is in fact a number that changes... I don't know what causes it to change but something does. Any clues as to what it is?
YES! FINALLY! I got it thanks for the help guys!
YES! FINALLY! I got it thanks for the help guys!
If there is followup for this or anyone knows how I really appreciate a snippet to make it like Rok was trying to. ie:
"Your <Weapon name> <damage text> <Creature> for <#> damage"
"Your <Weapon name> <damage text> <Creature> for <#> damage"
i'm putting this into Smaug Fuss, when i put it in and recompile it in MSC++ it recompiles fine, but when i take out the .o file and make in cygwin it shows a couple warnings with too many arguments.
4 warnings in fight.c
too many arguments in format
too many arguments in format
too many arguments in format
too few arguments in format
any thoughts?
4 warnings in fight.c
too many arguments in format
too many arguments in format
too many arguments in format
too few arguments in format
any thoughts?
Yes, your printf is wrong. The gcc compiler is a bit smarter about picking that up. If you use it in MSCV++ it will either crash or give the wrong results.
You need to have the correct number of arguments. Perhaps post the line in error?
You need to have the correct number of arguments. Perhaps post the line in error?
here:
and here:
sprintf( buf1, "$n's poisoned %s %s $N%c", attack, vp, punct );
sprintf( buf1, "$n misses $N badly!", vp, punct );
sprintf( buf2, "You miss $N badly!", vs, punct );
sprintf( buf3, "$n misses $N badly!", vp, punct);
and here:
sprintf( buf1, "$n's poisoned %s %s $N%c", attack, vp, punct );
i'm still getting these warnings.
do you need me to post anymore code? this snippet works fine on a regular smaug window vesrion, but not on smaugfuss cygwin.
if ( dt == TYPE_HIT && dam == 0 ) //miss message ~Rok~
{
sprintf( buf1, "$n misses $N badly!", vp, punct );
sprintf( buf2, "You miss $N badly!", vs, punct );
sprintf( buf3, "$n misses $N badly!", vp, punct);
}
do you need me to post anymore code? this snippet works fine on a regular smaug window vesrion, but not on smaugfuss cygwin.
Yeah, I do see a problem. The
There are varaibles there to be printed into the string, vp, vs, and punct, but nothing to indicate what or where to use this information. The original one looks like it should be: This one has %s and such in them. The $N is only for the act_string function, and is not real C variables. Looks like you may have missed a part of the snippet, double check. That should deal with the too many errors.
Hope that helps.
if ( dt == TYPE_HIT && dam == 0 ) //miss message ~Rok~
{
sprintf( buf1, "$n misses $N badly!", vp, punct );
sprintf( buf2, "You miss $N badly!", vs, punct );
sprintf( buf3, "$n misses $N badly!", vp, punct);
}
There are varaibles there to be printed into the string, vp, vs, and punct, but nothing to indicate what or where to use this information. The original one looks like it should be:
if (dt == TYPE_HIT && dam == 0)
{
sprintf(buf1, "$n's %s %s $N badly%c", attack, vp, punct );
sprintf(buf2, "Your %s %s $N badly%c", attack, vp, punct );
sprintf(buf3, "$n's %s %s you badly%c", attack, vp, punct );
} Hope that helps.
i added this:
it doesn't have any errors. it works fine. but when i kick, it just says, you jar the guard for 6 damage!
i want it to say this:
Your kick MUTILATES the guard for 110 damage!
on my windows version, it does. but i had to change the code around on this one to get it to compile. i'll go ahead and post both codes on a second post.
dt = TYPE_HIT;
attack = attack_table[0];
if (dt == TYPE_HIT && dam == 0)
{
sprintf(buf1, "$n's %s %s $N badly%c", attack, vp, punct );
sprintf(buf2, "Your %s %s $N badly%c", attack, vp, punct );
sprintf(buf3, "$n's %s %s you badly%c", attack, vp, punct );
}
else
if ( dt == TYPE_HIT ) //damage number & text
{
sprintf( buf1, "$n %s $N%c", vp, punct );
sprintf( buf2, "You %s $N for %i damage%c", vs, dam, punct );
sprintf( buf3, "$n %s you%c", vp, punct );
}
it doesn't have any errors. it works fine. but when i kick, it just says, you jar the guard for 6 damage!
i want it to say this:
Your kick MUTILATES the guard for 110 damage!
on my windows version, it does. but i had to change the code around on this one to get it to compile. i'll go ahead and post both codes on a second post.
here's my smuagfuss fight.c
if ( dt >=0 && dt < top_sn )
skill = skill_table[dt];
dt = TYPE_HIT;
attack = attack_table[0];
if (dt == TYPE_HIT && dam == 0)
{
sprintf(buf1, "$n's %s %s $N badly%c", attack, vp, punct );
sprintf(buf2, "Your %s %s $N badly%c", attack, vp, punct );
sprintf(buf3, "$n's %s %s you badly%c", attack, vp, punct );
}
else
if ( dt == TYPE_HIT ) //damage number & text
{
sprintf( buf1, "$n %s $N%c", vp, punct );
sprintf( buf2, "You %s $N for %i damage%c", vs, dam, punct );
sprintf( buf3, "$n %s you%c", vp, punct );
}
/*
if ( dt == TYPE_HIT )
{
sprintf( buf1, "$n %s $N%c", vp, punct );
sprintf( buf2, "You %s $N%c", vs, punct );
sprintf( buf3, "$n %s you%c", vp, punct );
}
*/
else
if ( dt > TYPE_HIT && is_wielding_poisoned( ch ) )
{
if ( dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]) )
attack = attack_table[dt - TYPE_HIT];
else
{
sprintf(bugbuf, "Dam_message: bad dt %d from %s in %d.",
dt, ch->name, ch->in_room->vnum );
bug( bugbuf, 0);
dt = TYPE_HIT;
attack = attack_table[0];
}
sprintf( buf1, "$n %s $N%c", vp, punct );
sprintf( buf2, "You %s $N for %i damage%c", vs, dam, punct );
sprintf( buf3, "$n %s you%c", vp, punct );
//sprintf( buf1, "$n's poisoned %s %s $N%c", attack, vp, punct );
//sprintf( buf2, "Your poisoned %s %s $N%c", attack, vp, punct );
//sprintf( buf3, "$n's poisoned %s %s you%c", attack, vp, punct );
}
else
{
if ( skill )
{
attack = skill->noun_damage;
if ( dam == 0 )
{
bool found = FALSE;
if ( skill->miss_char && skill->miss_char[0] != '\0' )
{
act( AT_HIT, skill->miss_char, ch, NULL, victim, TO_CHAR );
found = TRUE;
}
if ( skill->miss_vict && skill->miss_vict[0] != '\0' )
{
act( AT_HITME, skill->miss_vict, ch, NULL, victim, TO_VICT );
found = TRUE;
}
if ( skill->miss_room && skill->miss_room[0] != '\0' )
{
if (strcmp( skill->miss_room,"supress" ) )
act( AT_ACTION, skill->miss_room, ch, NULL, victim, TO_NOTVICT );
found = TRUE;
}
if ( found ) /* miss message already sent */
{
if ( was_in_room )
{
char_from_room(ch);
char_to_room(ch, was_in_room);
}
return;
}
}
else
{
if ( skill->hit_char && skill->hit_char[0] != '\0' )
act( AT_HIT, skill->hit_char, ch, NULL, victim, TO_CHAR );
if ( skill->hit_vict && skill->hit_vict[0] != '\0' )
act( AT_HITME, skill->hit_vict, ch, NULL, victim, TO_VICT );
if ( skill->hit_room && skill->hit_room[0] != '\0' )
act( AT_ACTION, skill->hit_room, ch, NULL, victim, TO_NOTVICT );
}
}
else if ( dt >= TYPE_HIT
&& dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]) )
{
if ( obj )
attack = obj->short_descr;
else
attack = attack_table[dt - TYPE_HIT];
}
else
{
sprintf(bugbuf, "Dam_message: bad dt %d from %s in %d.",
dt, ch->name, ch->in_room->vnum );
bug( bugbuf, 0);
dt = TYPE_HIT;
attack = attack_table[0];
}
sprintf( buf1, "$n's %s %s $N%c", attack, vp, punct );
sprintf( buf2, "Your %s %s $N for %i damage%c", attack, vp, dam, punct );
sprintf( buf3, "$n's %s %s you%c", attack, vp, punct );
/* sprintf( buf1, "$n's %s %s $N%c", attack, vp, punct );
sprintf( buf2, "Your %s %s $N%c", attack, vp, punct );
sprintf( buf3, "$n's %s %s you%c", attack, vp, punct );*/
}
and here is the window code
thoughts?
if ( dt >=0 && dt < top_sn )
skill = skill_table[dt];
if ( dt == TYPE_HIT && dam == 0 ) //miss message ~Rok~
{
sprintf( buf1, "$n misses $N badly!", vp, punct );
sprintf( buf2, "You miss $N badly!", vs, punct );
sprintf( buf3, "$n misses $N badly!", vp, punct);
}
else
if ( dt == TYPE_HIT ) //damage number & text
{
sprintf( buf1, "$n %s $N%c", vp, punct );
sprintf( buf2, "You %s $N for %i damage%c", vs, dam, punct );
sprintf( buf3, "$n %s you%c", vp, punct );
}
/*
if ( dt == TYPE_HIT )
{
sprintf( buf1, "$n %s $N%c", vp, punct );
sprintf( buf2, "You %s $N%c", vs, punct );
sprintf( buf3, "$n %s you%c", vp, punct );
}
*/
else
if ( dt > TYPE_HIT && is_wielding_poisoned( ch ) )
{
if ( dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]) )
attack = attack_table[dt - TYPE_HIT];
else
{
sprintf(bugbuf, "Dam_message: bad dt %d from %s in %d.",
dt, ch->name, ch->in_room->vnum );
bug( bugbuf, 0);
dt = TYPE_HIT;
attack = attack_table[0];
}
sprintf( buf1, "$n's poisoned %s %s $N%c", attack, vp, punct );
sprintf( buf2, "Your poisoned %s %s $N for %i damage%c", attack, vp, punct );
sprintf( buf3, "$n's poisoned %s %s you%c", attack, vp, punct );
}
else
{
if ( skill )
{
attack = skill->noun_damage;
if ( dam == 0 )
{
bool found = FALSE;
if ( skill->miss_char && skill->miss_char[0] != '\0' )
{
act( AT_HIT, skill->miss_char, ch, NULL, victim, TO_CHAR );
found = TRUE;
}
if ( skill->miss_vict && skill->miss_vict[0] != '\0' )
{
act( AT_HITME, skill->miss_vict, ch, NULL, victim, TO_VICT );
found = TRUE;
}
if ( skill->miss_room && skill->miss_room[0] != '\0' )
{
if (strcmp( skill->miss_room,"supress" ) )
act( AT_ACTION, skill->miss_room, ch, NULL, victim, TO_NOTVICT );
found = TRUE;
}
if ( found ) /* miss message already sent */
{
if ( was_in_room )
{
char_from_room(ch);
char_to_room(ch, was_in_room);
}
return;
}
}
else
{
if ( skill->hit_char && skill->hit_char[0] != '\0' )
act( AT_HIT, skill->hit_char, ch, NULL, victim, TO_CHAR );
if ( skill->hit_vict && skill->hit_vict[0] != '\0' )
act( AT_HITME, skill->hit_vict, ch, NULL, victim, TO_VICT );
if ( skill->hit_room && skill->hit_room[0] != '\0' )
act( AT_ACTION, skill->hit_room, ch, NULL, victim, TO_NOTVICT );
}
}
else if ( dt >= TYPE_HIT
&& dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]) )
{
if ( obj )
attack = obj->short_descr;
else
attack = attack_table[dt - TYPE_HIT];
}
else
{
sprintf(bugbuf, "Dam_message: bad dt %d from %s in %d.",
dt, ch->name, ch->in_room->vnum );
bug( bugbuf, 0);
dt = TYPE_HIT;
attack = attack_table[0];
}
//sprintf( buf1, "$n %s $N for %i damage%c", vp, dam, punct );
//sprintf( buf2, "You %s $N for %i damage%c", vp, dam,punct );
//sprintf( buf3, "$n %s $N for %i damage%c", vp, dam, punct );
sprintf( buf1, "$n's %s %s $N%c", attack, vp, punct );
sprintf( buf2, "Your %s %s $N for %i damage%c", attack, vp, dam, punct );
sprintf( buf3, "$n's %s %s you%c", attack, vp, punct );
}
thoughts?