Welcome to the Builder Academy

Question Corpses

More
14 Dec 2017 19:40 #7248 by zusuk
Replied by zusuk on topic Corpses
How does make_corpse() know what spell is coming in for your switch (which spell/skill killed the victim)? Unless your system is very different than stock, you will have to pass the spell or skill-numbers from that function (damage) down the chain until you get to make_corpse()...

There is no difference between zero (0) and NULL

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

Please Log in or Create an account to join the conversation.

More
14 Dec 2017 20:00 #7249 by JTP
Replied by JTP on topic Corpses
That is where i hoped this would work:

static void make_corpse(struct char_data *ch, int killedbytype)



Guess this was just a good idea, that i cant fix..i have tried many things over the past says :( haha

Please Log in or Create an account to join the conversation.

More
14 Dec 2017 20:48 #7250 by zusuk
Replied by zusuk on topic Corpses
Well, just think about this, you know you are adding just a bunch of zero's as "killedbytype", so when it arrives at the switch(), what is it going to do? it will always resolve to case = zero, which is just your default: case in your switch()....

You have to pass meaningful data through the functions (spellnum or skillnum) otherwise it is impossible for it to work :)

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

Please Log in or Create an account to join the conversation.

More
14 Dec 2017 22:28 #7251 by JTP
Replied by JTP on topic Corpse
I can't seem to find anywhere in the Stock code that Can help me on he Way with this. I have to give up on it for now Then.

This was my first switch, maybe i Will learn that one Day.

Please Log in or Create an account to join the conversation.

More
15 Dec 2017 02:42 #7254 by WhiskyTest
Replied by WhiskyTest on topic Corpse
Just building on what you were developing here JTP, this is one way you can achieve it.

I've included the patch file fully here as you mentioned having trouble opening ZIP files? Get 7zip!

Attachment more_corpses.zip not found

Code:
diff -BbuprN -x '*.o' tbamud-original/src/act.offensive.c tbamud-3.68/src/act.offensive.c --- tbamud-original/src/act.offensive.c 2017-02-21 18:20:32.000000000 +1300 +++ tbamud-3.68/src/act.offensive.c 2017-12-15 15:27:18.471367800 +1300 @@ -117,7 +117,7 @@ ACMD(do_kill) act("You chop $M to pieces! Ah! The blood!", FALSE, ch, 0, vict, TO_CHAR); act("$N chops you to pieces!", FALSE, vict, 0, ch, TO_CHAR); act("$n brutally slays $N!", FALSE, ch, 0, vict, TO_NOTVICT); - raw_kill(vict, ch); + raw_kill(vict, ch, TYPE_SUFFERING); } } } diff -BbuprN -x '*.o' tbamud-original/src/act.other.c tbamud-3.68/src/act.other.c --- tbamud-original/src/act.other.c 2017-02-21 18:20:32.000000000 +1300 +++ tbamud-3.68/src/act.other.c 2017-12-15 15:24:12.499367800 +1300 @@ -49,7 +49,7 @@ ACMD(do_quit) send_to_char(ch, "No way! You're fighting for your life!\r\n"); else if (GET_POS(ch) < POS_STUNNED) { send_to_char(ch, "You die before your time...\r\n"); - die(ch, NULL); + die(ch, NULL, TYPE_SUFFERING); } else { act("$n has left the game.", TRUE, ch, 0, 0, TO_ROOM); mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s has quit the game.", GET_NAME(ch)); diff -BbuprN -x '*.o' tbamud-original/src/dg_misc.c tbamud-3.68/src/dg_misc.c --- tbamud-original/src/dg_misc.c 2017-02-21 18:20:32.000000000 +1300 +++ tbamud-3.68/src/dg_misc.c 2017-12-15 15:24:32.578367800 +1300 @@ -306,7 +306,7 @@ void script_damage(struct char_data *vic if (!IS_NPC(vict)) mudlog( BRF, 0, TRUE, "%s killed by script at %s", GET_NAME(vict), vict->in_room == NOWHERE ? "NOWHERE" : world[vict->in_room].name); - die(vict, NULL); + die(vict, NULL, TYPE_SUFFERING); } } diff -BbuprN -x '*.o' tbamud-original/src/fight.c tbamud-3.68/src/fight.c --- tbamud-original/src/fight.c 2017-02-21 18:20:34.000000000 +1300 +++ tbamud-3.68/src/fight.c 2017-12-15 15:36:29.955367800 +1300 @@ -58,7 +58,7 @@ static struct char_data *next_combat_lis /* local file scope utility functions */ static void perform_group_gain(struct char_data *ch, int base, struct char_data *victim); static void dam_message(int dam, struct char_data *ch, struct char_data *victim, int w_type); -static void make_corpse(struct char_data *ch); +static void make_corpse(struct char_data *ch, int attacktype); static void change_alignment(struct char_data *ch, struct char_data *victim); static void group_gain(struct char_data *ch, struct char_data *victim); static void solo_gain(struct char_data *ch, struct char_data *victim); @@ -162,20 +162,34 @@ void stop_fighting(struct char_data *ch) update_pos(ch); } -static void make_corpse(struct char_data *ch) +static void make_corpse(struct char_data *ch, int attacktype) { char buf2[MAX_NAME_LENGTH + 64]; + char description[MAX_STRING_LENGTH]; struct obj_data *corpse, *o; struct obj_data *money; int i, x, y; + switch (attacktype) { + + case SPELL_BURNING_HANDS: + snprintf(description, sizeof(description), "charred body" ); + break; + case TYPE_SUFFERING: + snprintf(description, sizeof(description), "desiccated corpse" ); + break; + default: + snprintf(description, sizeof(description), "corpse" ); + break; + } + corpse = create_obj(); corpse->item_number = NOTHING; IN_ROOM(corpse) = NOWHERE; corpse->name = strdup("corpse"); - snprintf(buf2, sizeof(buf2), "The corpse of %s is lying here.", GET_NAME(ch)); + snprintf(buf2, sizeof(buf2), "The %s of %s is lying here.", description, GET_NAME(ch)); corpse->description = strdup(buf2); snprintf(buf2, sizeof(buf2), "the corpse of %s", GET_NAME(ch)); @@ -251,7 +265,7 @@ void death_cry(struct char_data *ch) send_to_room(world[IN_ROOM(ch)].dir_option[door]->to_room, "Your blood freezes as you hear someone's death cry.\r\n"); } -void raw_kill(struct char_data * ch, struct char_data * killer) +void raw_kill(struct char_data * ch, struct char_data * killer, int attacktype) { if (FIGHTING(ch)) stop_fighting(ch); @@ -277,7 +291,7 @@ void raw_kill(struct char_data * ch, str update_pos(ch); - make_corpse(ch); + make_corpse(ch, attacktype); extract_char(ch); if (killer) { @@ -286,14 +300,14 @@ void raw_kill(struct char_data * ch, str } } -void die(struct char_data * ch, struct char_data * killer) +void die(struct char_data * ch, struct char_data * killer, int attacktype) { gain_exp(ch, -(GET_EXP(ch) / 2)); if (!IS_NPC(ch)) { REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_KILLER); REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_THIEF); } - raw_kill(ch, killer); + raw_kill(ch, killer, attacktype); } static void perform_group_gain(struct char_data *ch, int base, @@ -592,7 +606,7 @@ int damage(struct char_data *ch, struct log("SYSERR: Attempt to damage corpse '%s' in room #%d by '%s'.", GET_NAME(victim), GET_ROOM_VNUM(IN_ROOM(victim)), GET_NAME(ch)); - die(victim, ch); + die(victim, ch, attacktype); return (-1); /* -je, 7/7/92 */ } @@ -753,7 +767,7 @@ int damage(struct char_data *ch, struct sprintf(local_buf,"%ld", (long)local_gold); } - die(victim, ch); + die(victim, ch, attacktype); if (GROUP(ch) && (local_gold > 0) && PRF_FLAGGED(ch, PRF_AUTOSPLIT) ) { generic_find("corpse", FIND_OBJ_ROOM, ch, &tmp_char, &corpse_obj); if (corpse_obj) { diff -BbuprN -x '*.o' tbamud-original/src/fight.h tbamud-3.68/src/fight.h --- tbamud-original/src/fight.h 2017-02-21 18:20:34.000000000 +1300 +++ tbamud-3.68/src/fight.h 2017-12-15 15:27:18.483367800 +1300 @@ -26,10 +26,10 @@ void check_killer(struct char_data *ch, int compute_armor_class(struct char_data *ch); int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype); void death_cry(struct char_data *ch); -void die(struct char_data * ch, struct char_data * killer); +void die(struct char_data * ch, struct char_data * killer, int attacktype); void hit(struct char_data *ch, struct char_data *victim, int type); void perform_violence(void); -void raw_kill(struct char_data * ch, struct char_data * killer); +void raw_kill(struct char_data * ch, struct char_data * killer, int attacktype); void set_fighting(struct char_data *ch, struct char_data *victim); int skill_message(int dam, struct char_data *ch, struct char_data *vict, int attacktype);
Attachments:
The following user(s) said Thank You: thomas, JTP

Please Log in or Create an account to join the conversation.

Time to create page: 0.265 seconds