New item idea

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
2 years 11 months ago #8083 by JTP
New item idea was created by JTP
Ok now that whiskey made the zedit easier to repeat commands. I thought damn i have alot of classes and alot of ANTI_CLASS defined. So when i make a new object and i only want it to be usable for 1 specific class, then i thought about an ITEM_ONLY_CLASS


So if i set an obj to ANTI_WARRIOR and ONLY_CLASS, then only warrior would be able to use it. Instead of having to put 13 different ANTI_CLASSES on.


But how the .... would i go about making that ?

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

More
2 years 11 months ago #8084 by WhiskyTest
Replied by WhiskyTest on topic New item idea
First create your new item flag definitions.

structs.h
+ #define ITEM_THIEF     18 /* item can only be used by Thieves*/

#define NUM_ITEM_FLAGS    19  /* increment this define as appropriate */

in constants.c add the text to extra_bits:
const char *extra_bits[] = {

 "QUEST_ITEM",
+  "THIEF",
  "\n"
};

class.c
int invalid_class(struct char_data *ch, struct obj_data *obj)
{

if (OBJ_FLAGGED(obj, ITEM_ANTI_THIEF) && IS_THIEF(ch))
    return TRUE;



+  if (OBJ_FLAGGED(obj, ITEM_THIEF) && !IS_THIEF(ch))
+      return (TRUE);

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
2 years 11 months ago - 2 years 11 months ago #8085 by JTP
Replied by JTP on topic New item idea
Your missing the point, then i would have to create 14 new item types, cus i have 14 classes.

I would like an item flag called ONLY-CLASS. So if i set ITEM_ANTI_WARRIOR and ITEM_ONLY_CLASS, then only warrior would be able to use it. And not have to set 13 ITEM_ANTI.....

So that is just 1 new ITEM type instead of 14 ITEM_class1-14 and oedit will look less clouded with ITEM types, cus i already have quite a few of those, so dont need 14 more haha :)

So the ONLY-CLASS will make ITEM_ANTI_WARRIOR into just warrior.

Hope this explains it better.
Last edit: 2 years 11 months ago by JTP.

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

More
2 years 11 months ago - 2 years 11 months ago #8086 by WhiskyTest
Replied by WhiskyTest on topic New item idea
Oh, yep I see.

So in invalid_class do this:
if (OBJ_FLAGGED(obj, ITEM_ANTI_WARRIOR) && (OBJ_FLAGGED(obj, ITEM_ONLY_CLASS)) && !IS_WARRIOR(ch))
		return TRUE;

make a check like that for each class, put it in front of the stock anti-class check
Last edit: 2 years 11 months ago by WhiskyTest.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
2 years 11 months ago - 2 years 11 months ago #8087 by JTP
Replied by JTP on topic New item idea
hmm something is off there, made an item for anti_psi and used only-class. but was not able to wield it
Last edit: 2 years 11 months ago by JTP.

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

More
2 years 11 months ago - 2 years 11 months ago #8088 by WhiskyTest
Replied by WhiskyTest on topic New item idea
My mistake - the above check is OK to stop other classes wearing it, but we still need the warrior to be allowed to wear it.
/* For items intended for one class - wrong classes are denied... */
if (OBJ_FLAGGED(obj, ITEM_ANTI_WARRIOR) && OBJ_FLAGGED(obj, ITEM_ONLY_CLASS) && !IS_WARRIOR(ch))
		return TRUE;

/*  ...but the correct class is accepted */
if (OBJ_FLAGGED(obj, ITEM_ANTI_WARRIOR) && OBJ_FLAGGED(obj, ITEM_ONLY_CLASS) && IS_WARRIOR(ch))
		return FALSE;

add two checks like the above for each class and you'll be golden.
Last edit: 2 years 11 months ago by WhiskyTest. Reason: add code tags
The following user(s) said Thank You: JTP

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

Time to create page: 0.096 seconds