Item restriction

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 6 months ago - 2 years 6 months ago #5834 by JTP
Item restriction was created by JTP
Hi

I tried to add a check in do_wield so barbarians only can use bludgeon weapons. Compiles just fine, but crashed game when trying to wield a weapon. Ideas why ?
Insired by backstab only possible with a certain weapon type.

ACMD(do_wield)
{
  char arg[MAX_INPUT_LENGTH];
  struct obj_data *obj;

  one_argument(argument, arg);

  if (!*arg)
    send_to_char(ch, "Wield what?\r\n");
  else if (!(obj = get_obj_in_list_vis(ch, arg, NULL, ch->carrying)))
    send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg), arg);
  else {
    if (!CAN_WEAR(obj, ITEM_WEAR_WIELD))
      send_to_char(ch, "You can't wield that.\r\n");
    else if (GET_OBJ_WEIGHT(obj) > str_app[STRENGTH_APPLY_INDEX(ch)].wield_w)
      send_to_char(ch, "It's too heavy for you to use.\r\n");
    else if (GET_LEVEL(ch) < GET_OBJ_LEVEL(obj))
      send_to_char(ch, "You are not experienced enough to use that.\r\n");
    else if ((GET_CLASS(ch) == CLASS_BARBARIAN) && (GET_OBJ_VAL(GET_EQ(ch, WEAR_WIELD), 3) != TYPE_BLUDGEON - TYPE_HIT))
      send_to_char(ch, "Barbarians can only wield bludgeon weapons.\r\n");
    else
      perform_wear(ch, obj, WEAR_WIELD);
  }
}
Last edit: 2 years 6 months ago by JTP.

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

More
2 years 6 months ago #5836 by thomas
Replied by thomas on topic Item restriction
(GET_OBJ_VAL(GET_EQ(ch, WEAR_WIELD), 3) != TYPE_BLUDGEON - TYPE_HIT) <<-- item is not yet wielded. Just check it on the object:

else if ((GET_CLASS(ch) == CLASS_BARBARIAN) && (GET_OBJ_VAL(obj, 3) != TYPE_BLUDGEON - TYPE_HIT))
The following user(s) said Thank You: JTP

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 6 months ago #5838 by JTP
Replied by JTP on topic Item restriction
That worked, thanks alot.

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

Time to create page: 1.031 seconds