Welcome to the Builder Academy

Question prevent bash - Issue could use help pls

More
22 Jan 2025 23:28 - 22 Jan 2025 23:40 #10528 by JTP
It works and gives me a 0 in the log if I bash a mob

If I try bash a mob that is a giant I also get the I’m not tall enough and again nothing in the log. But for this is it correct as I’m not tall and therefore shouldn’t work. So that is intended. So my check for mobs is all ok except not logging anything for if a mob is a Giant but atleast I can’t bash it.



Then I tested a half giant player can bash a giant mob, so that is also good.


But The problem is if I try bash a player and I’m not a half giant and player is not a half giant, it says in the screen I’m not tall enough. And nothing in the log
Last edit: 22 Jan 2025 23:40 by JTP.

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

More
25 Jan 2025 16:58 #10529 by thomas
Can you post the function as it looks now?

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

More
26 Jan 2025 21:22 #10530 by JTP
Hi Thomas

this is our bash, few minor adjustments from original:



ACMD(do_bash)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *vict;
int percent, prob;

one_argument(argument, arg);

if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_BASH)) {
send_to_char(ch, "You have no idea how.\r\n");
return;
}
/* if (AFF_FLAGGED(ch, AFF_FLYING)) {
send_to_char(ch, "You can't bash while flying.\r\n");
return;
} */
if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) {
send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n");
return;
}
if (!GET_EQ(ch, WEAR_WIELD)) {
send_to_char(ch, "You need to wield a weapon to make it a success.\r\n");
return;
}
if (GET_MOVE(ch) <= 0) {
send_to_char(ch, "You are to tired to fight anymore!\r\n");
return;
}
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AFK)) {
send_to_char(ch, "Try removing your AFK flag first.\r\n");
SET_BIT_AR(PLR_FLAGS(ch), PLR_KILLER);
return;
}

if (!(vict = get_char_vis(ch, arg, NULL, FIND_CHAR_ROOM))) {
if (FIGHTING(ch) && IN_ROOM(ch) == IN_ROOM(FIGHTING(ch))) {
vict = FIGHTING(ch);
} else {
send_to_char(ch, "Bash who?\r\n");
return;
}
}
if (vict == ch) {
send_to_char(ch, "Aren't we funny today...\r\n");
return;
}
if (MOB_FLAGGED(vict, MOB_NOKILL)) {
send_to_char(ch, "This mob is protected.\r\n");
return;
}
if ((GET_CLASS(vict) == CLASS_NPC_GIANT) && (GET_RACE(ch) != RACE_HALF_GIANT)) {
send_to_char(ch, "You aren't tall enough to bash a giant!\r\n");
return;
}
log("%d", GET_RACE(vict));
if ((GET_RACE(vict) == RACE_HALF_GIANT) && (GET_RACE(ch) != RACE_HALF_GIANT)) {
log("%d", GET_RACE(vict));
send_to_char(ch, "You aren't tall enough to bash a half giant!\r\n");
return;
}
percent = rand_number(1, 115); /* 101% is a complete failure */
prob = GET_SKILL(ch, SKILL_BASH);

if (MOB_FLAGGED(vict, MOB_NOBASH))
percent = 115;

if (percent > prob) {
damage(ch, vict, 0, SKILL_BASH);
GET_POS(ch) = POS_SITTING;
} else {
/*
* If we bash a player and they wimp out, they will move to the previous
* room before we set them sitting. If we try to set the victim sitting
* first to make sure they don't flee, then we can't bash them! So now
* we only set them sitting if they didn't flee. -gg 9/21/98
*/
if (damage(ch, vict, 1, SKILL_BASH) > 0) { /* -1 = dead, 0 = miss */
improve_skill(ch, SKILL_BASH);
WAIT_STATE(vict, PULSE_VIOLENCE);
if (IN_ROOM(ch) == IN_ROOM(vict))
GET_POS(vict) = POS_SITTING;
}
}
WAIT_STATE(ch, PULSE_VIOLENCE * 2);
}

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

More
27 Jan 2025 20:18 #10531 by thomas
Try switching up the logs a bit:
Code:
if (MOB_FLAGGED(vict, MOB_NOKILL)) { send_to_char(ch, "This mob is protected.\r\n"); return; } log("checking for GET_CLASS(vict)==CLASS_NPC_GIANT: %d==%d = %d", GET_CLASS(vict), CLASS_NPC_GIANT, GET_CLASS(vict) == CLASS_NPC_GIANT); log("checking for GET_RACE(ch) != RACE_HALF_GIANT: %d != %d = %d", GET_RACE(ch), RACE_HALF_GIANT, GET_RACE(ch) != RACE_HALF_GIANT); if ((GET_CLASS(vict) == CLASS_NPC_GIANT) && (GET_RACE(ch) != RACE_HALF_GIANT)) { send_to_char(ch, "You aren't tall enough to bash a giant!\r\n"); return; } log("checking for GET_RACE(vict) == RACE_HALF_GIANT: %d==%d = %d", GET_RACE(vict), RACE_HALF_GIANT, GET_RACE(vict) == RACE_HALF_GIANT); log("checking for GET_RACE(ch) != RACE_HALF_GIANT: %d != %d = %d", GET_RACE(ch), RACE_HALF_GIANT, GET_RACE(ch) != RACE_HALF_GIANT); if ((GET_RACE(vict) == RACE_HALF_GIANT) && (GET_RACE(ch) != RACE_HALF_GIANT)) { send_to_char(ch, "You aren't tall enough to bash a half giant!\r\n"); return; }
This should give you some output in your logs that should help you identify why you hit that return.

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

Time to create page: 0.180 seconds