- Posts: 937
- Thank you received: 17
Corpses
- JTP
- Topic Author
- Offline
- Platinum Member
-
Less
More
5 years 9 months ago #7229
by JTP
Corpses was created by JTP
Hmm ok im playing with even more corpse messages... i made a switch:
switch (killedbytype) {
case SPELL_FIRESHIELD:
case SPELL_FIREBALL:sprintf(spec_desc,"smoldering remains of %s are",
(IS_NPC(ch) ? ch->player.short_descr : GET_NAME(ch)));
break;
default:sprintf(spec_desc,"corpse of %s is",
(IS_NPC(ch) ? ch->player.short_descr : GET_NAME(ch)));
break;
}
changed:
} else {
corpse->name = strdup("corpse");
snprintf(buf2, sizeof(buf2), "The %s lying here.", spec_desc); <<<---New
/* snprintf(buf2, sizeof(buf2), "The corpse of %s is lying here.", GET_NAME(ch)); */ <<<--- Old
corpse->description = strdup(buf2);
snprintf(buf2, sizeof(buf2), "the corpse of %s", GET_NAME(ch));
corpse->short_description = strdup(buf2);
}
Got it to compile, i had to add:
void make_corpse(struct char_data *ch, int killedbytype);
void raw_kill(struct char_data *ch,int killedbytype);
void die(struct char_data *ch,int killedbytype);
Also i had to add:
make_corpse(ch, killedbytype);
And added 0 to a bunch of die places and raw_kill like: raw_kill(vict, ch, 0);
What is best to add 0 or NULL ??
But killing a mob with fireball just got the corpse the default message....Any ideas ??
Please Log in or Create an account to join the conversation.
- WhiskyTest
-
- Offline
- Platinum Member
-
Less
More
- Posts: 345
- Thank you received: 73
5 years 9 months ago #7231
by WhiskyTest
Replied by WhiskyTest on topic Corpses
Probably 'killedbytype' doesnt equal 'SPELL_FIRESHIELD' or 'SPELL_FIREBALL'
You could test that the corpse code works correctly by sending SPELL_FIREBALL no matter what, like:
make_corpse(ch, SPELL_FIREBALL);
If that's OK, then there is something wrong with how killedbytype is being calculated.
You could test that the corpse code works correctly by sending SPELL_FIREBALL no matter what, like:
make_corpse(ch, SPELL_FIREBALL);
If that's OK, then there is something wrong with how killedbytype is being calculated.
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 937
- Thank you received: 17
5 years 9 months ago - 5 years 9 months ago #7232
by JTP
Replied by JTP on topic Corpses
What about using 0 instead of NULL any difference, i see both things used in the code ?
Maybe i need to add: int killedbytype
Somewhere in spells.h and/Or spells.c
Iwe reached a dead end, But where ? Sense the default message works.
And what If its a skill that killed the mob hmm.
Maybe i need to add: int killedbytype
Somewhere in spells.h and/Or spells.c
Iwe reached a dead end, But where ? Sense the default message works.
And what If its a skill that killed the mob hmm.
Last edit: 5 years 9 months ago by JTP.
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 937
- Thank you received: 17
5 years 9 months ago - 5 years 9 months ago #7245
by JTP
Replied by JTP on topic Corpses
Noone knows ?
Last edit: 5 years 9 months ago by JTP.
Please Log in or Create an account to join the conversation.
- zusuk
-
- Offline
- Elite Member
-
- LuminariMUD Developer
5 years 9 months ago #7246
by zusuk
Website
www.luminariMUD.com
Main Game Port
luminariMUD.com:4100
Replied by zusuk on topic Corpses
Are you carrying the spellnum from damage() to death functions?
Website
www.luminariMUD.com
Main Game Port
luminariMUD.com:4100
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 937
- Thank you received: 17
5 years 9 months ago #7247
by JTP
Replied by JTP on topic Corpses
Al code is posted here. How would i do that ?
What about difference between using 0 or NULL ?
What about difference between using 0 or NULL ?
Please Log in or Create an account to join the conversation.
- zusuk
-
- Offline
- Elite Member
-
- LuminariMUD Developer
5 years 9 months ago #7248
by zusuk
Website
www.luminariMUD.com
Main Game Port
luminariMUD.com:4100
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
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.
- JTP
- Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 937
- Thank you received: 17
5 years 9 months ago #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
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.
- zusuk
-
- Offline
- Elite Member
-
- LuminariMUD Developer
5 years 9 months ago #7250
by zusuk
Website
www.luminariMUD.com
Main Game Port
luminariMUD.com:4100
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 :)
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.
- JTP
- Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 937
- Thank you received: 17
5 years 9 months ago #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.
This was my first switch, maybe i Will learn that one Day.
Please Log in or Create an account to join the conversation.
- WhiskyTest
-
- Offline
- Platinum Member
-
Less
More
- Posts: 345
- Thank you received: 73
5 years 9 months ago #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!
I've included the patch file fully here as you mentioned having trouble opening ZIP files? Get 7zip!
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);
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.168 seconds