Welcome to the Builder Academy

Question Object type check

More
01 Jun 2018 08:39 #8091 by Sapphire
Object type check was created by Sapphire
Hi again, I thought I would look to TBA forums for help with an issue I am having because I am at a loss on this one. I know it's nothing complex even, I simply cannot seem to get the syntax correct. From my perspective, it seems legit... but yes, it does not work.

In the code, I have it where there is a monk class that has barehanded damage coded in, complete with the damage dice and all of that for his fists. Pretty awesome... except, I also have resistances to different types of physical damage coded in and this makes a monk useless against a large chunk of mobiles that are resistant to barehanded/bludgeon attacks. So, one of the most exciting classes to play becomes a class to avoid when 1/3 of the mud world is resistant. In my mud, monks that use non-barehanded weapons lose 1/2 of their attacks as a penalty, but I got it in my head to solve this issue by allowing monks to wield unarmed weapons such as, "Claws of the Dragon," "Spiked Knuckles," etc...

So here's my issue. The 1/2 attack code is in utils.c and is coded with a catchall that searches for monks that are wielding any weapon at all. I'm wanting to change that to a weapon check for unarmed weapons. Further complicating matters, I understand that stock TBA uses weapon obj_values for value #3 as the type of damage. That is intact, but in my code, object value #0 is a proficiency check. I'm assuming(?) that this will be inconsequential when it comes to this code, but for the sake of clarity, I am stating that this code is not based off of obj_value 3, but 0 which is a proficiency check since I have weapon types (obj_val 0) and hit types (obj_val 3) coded in. I'm assuming since its a value check it is identical throughout, but perhaps that is my error?

So, here is the code that I have, which the game does not detect.
Code:
if ((IS_MONK(ch) && GET_EQ(ch, WEAR_WIELD)) && (GET_OBJ_VAL(WIELDED_WEAPON(ch), 0) != WEAPON_TYPE_UNARMED)) { SET_BIT(MSC_FLAGS(ch), MSC_HALVE_ATTACKS); }

Either if this were coded with obj val 0 in play and being examined by code (my desired outcome), or perhaps I do a longer check with the different types of hit I want to allow (obj val 3), what am I missing here? I'm not above confessing that object code gives me issues :)

Thanks for looking at this!

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

More
01 Jun 2018 21:49 #8092 by thomas
Replied by thomas on topic Object type check
Whenever I hit a snag like that, I log the crap out of it:
Code:
log("is_monk=%s,geteq=%p,wielded=%p,val0=%d,unarmed=%d", IS_MONK(ch),GET_EQ(ch, WEAR_WIELD)),WIELDED_WEAPON(ch),GET_OBJ_VAL(WIELDED_WEAPON(ch), 0), WEAPON_TYPE_UNARMED);
The output from this code should tell you the problem.

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

Time to create page: 0.180 seconds