ROM 2.4b6 Weapon check, skill

Posted by GamerStudent101 on Thu 12 Jul 2007 03:55 AM — 4 posts, 16,798 views.

#0
Was working on a skill on ROM 2.4b6 called charge (follows same rules as backstab pretty much) but I want it to require a polearm type weapon now I see its got a check to see if the player is wearing a weapon.

if ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL)

I was just wondering how would I make a check for the type of weapon.
USA #1
I believe that the backstab code does exactly this already -- check the part where it looks at the object value and writes out that you need a piercing or stabbing weapon.
#2
I dont see anything else checking for a weapon or a dam_type in the code. I also searched all the other skills in the game that I thought would require a certain weapon.

I believe though that its essentially just stock in skill/spell aspects.

Just incase I missed somthing.

if ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL)
{
send_to_char( "You need to wield a weapon to backstab.\n\r", ch );
return;
}

if ( victim->hit < victim->max_hit / 3)
{
act( "$N is hurt and suspicious ... you can't sneak up.",
ch, NULL, victim, TO_CHAR );
return;
}

check_killer( ch, victim );
WAIT_STATE( ch, skill_table[gsn_backstab].beats );
if ( number_percent( ) < get_skill(ch,gsn_backstab)
|| ( get_skill(ch,gsn_backstab) >= 2 && !IS_AWAKE(victim) ) )
{
check_improve(ch,gsn_backstab,TRUE,1);
multi_hit( ch, victim, gsn_backstab );
}
else
{
check_improve(ch,gsn_backstab,FALSE,1);
damage( ch, victim, 0, gsn_backstab,DAM_NONE,TRUE);
}

return;
}

- Thx for the prompt reply
USA #3
Oh... maybe it was changed after ROM.

In any case the damage type is not an actual data field of the object structure; it is one of the object values. To find out which one exactly, you should look at build.c and in there, at do_oset or something similar. There you should look for the code that handles setting the weapon's damage type.

It is possible that it won't be there because damage type is set using the numeric values. In that case, you should be able to find out which object value corresponds to which parameter in the help files; I think it's either help itemvalues or help objectvalues.

Also in the help values will you find the numeric value for the damage types, and if not, it'll be in the code for sure (in mud.h, perhaps).