Jump to content
Sign in to follow this  
temnix

How to add two flags to an item?

Recommended Posts

The ADD_CRE_ITEM function only allows one flag in the end. A couple are combination, but what I need is an item that is both unstealable and stolen. I'm going to rewrite the string for "I don't accept fenced goods" to refer more generally to black market, illegal stuff. In the case of this item the party will have to kill the NPC to get it, and then the item is to be marked as impossible to sell to anyone but a dealer. So I need both of those flags. Possible?

Share this post


Link to post

And what would be the offset here, hmm? I could patch creatures with this, but that's different from adding items - that function puts items wherever. For patching the offset would be different for every creature, depending on file size, number of items, effects, spells etc. But it's all right, I don't need this any more. This item is a shield and equipped, so it's unstealable as it is.

Share this post


Link to post

To clarify for anyone reading this later, those WRITE commands are for including in a separate instance of COPY ~item~ ~override~. Those offsets ate in the .itm file itself; they are independent of which creature possesses or sells them. 

Share this post


Link to post

This is not a place for irrelevant explanations to the general public. It's my question, and if you don't know the answer, don't say anything. Especially if it's nonsense. The STOLEN and UNSTEALABLE flags are not in ITM files, they are in CRE files.

Edited by temnix

Share this post


Link to post

I mean, I just derived the “unsellable” and “stolen” from the .ITM file format in the IESDP. Pray tell what is the source of your assertion that those flags “are not in ITM files?”

Edited by subtledoctor

Share this post


Link to post

He's referring to Item Instance structures that can be in creatures (inventory items) and area containers, which in turn refer to master Item resources via their resref fields. They have their own flags: Cre Item

Flags copy pasta:

Flags

    bit 0: Identified
    bit 1: Unstealable
    bit 2: Stolen
    bit 3: Undroppable

So only one write per item instance, with bits 1 and 2 being set.

Share this post


Link to post

No, it's possible to set two flags in a CRE's item - by hand. The problem is that Weidu doesn't accept more than one when adding or replacing an item. It may be possible for an advanced coder to GLOB scan creatures, pick up their equipment by name or slot, fetch the offsets dynamically, because they are going to be different for every file, and then set both flags, but I am not such a coder. 

Share this post


Link to post

Huh.  If it's a custom item and only appears in that one place, I don't see why not to simply patch the item itself. 

But glancing at the Weidu source, I see there is in fact a "ADD_CRE_ITEM_FLAGS" function.  Might work something like this:

COPY_EXISTING ~creature.cre~ ~override~								
  LPF ADD_CRE_ITEM_FLAGS
    STR_VAR item_to_change = ~your_item~ flags = ~STOLENUNSTEALABLE~
  END

EDIT - huh, it's in the documentation and everything.  Amazing what you can figure out, when you actually try to figure out what you need to figure out.  ;)

Edited by subtledoctor

Share this post


Link to post

The ADD_CRE_ITEM patch doesn't support any flag combination that contains both "stolen" and "unstealable", making it necessary to run ADD_CRE_ITEM, then ADD_CRE_ITEM_FLAGS, an extra step which isn't necessary for other flag combinations. I'd say an oversight on weidu's part.

Share this post


Link to post

https://weidu.org/~thebigg/README-WeiDU.html#hevea_default461

(OH FUCK WYSIWYG SHITWARE)

Quote

 

ADD_CRE_ITEM itmName charge1 charge2 charge3 flags slot [ EQUIP ] [ TWOHANDED ] [ NOMOVE ]

Add the item itmName to the current CRE file, with the number of charges determined by charge1, charge2 and charge3, respectively. Each charge should be an integer, either in the form of #integer or ( value ). The argument flags must be a string consisting of one of none, identified, unstealable, stolen, undroppable, identified&stolen, identified&unstealable, identified&undroppable, unstealable&undroppable, stolen&undroppable, identified&stolen&undroppable, identified&unstealable&undroppable.

 

 

Edited by Ardanis

Share this post


Link to post
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...