Difference between revisions of "Forum:Price-ID at unwilling shops: manipulating object ID"

From NetHackWiki
Jump to navigation Jump to search
m (forgot signature)
Line 10: Line 10:
  
 
--[[User:Tjr|Tjr]] 18:29, 21 January 2011 (UTC)
 
--[[User:Tjr|Tjr]] 18:29, 21 January 2011 (UTC)
 +
:I am certainly not an expert at object IDs, but it looks like the only assignment to o_id occurs in mkobj.c, three times at lines 237 (splitobj), 339 (bill_dummy_object), and 375 (mksobj). The manner is the same in all three cases;
 +
obj->o_id = flags.ident++;
 +
if (!obj->o_id) obj->o_id = flags.ident++; /* ident overflowed */
 +
:So the IDs should always be allocated sequentially and will never be 0.
 +
:Your post isn't entirely clear; do you have multiple copies of these potions? If not I don't know how you expect to be able to change the ID, and either way I don't see why you need the holy water. Simply dropping a single potion from a stack should create a new objid for that new item. I think that doing this twice will always create two adjascent object IDs (barring sudden monster generation...), which should give you an accurate price when buying them back. -- [[User:Qazmlpok|Qazmlpok]] 19:56, 21 January 2011 (UTC)

Revision as of 19:56, 21 January 2011


How do I manipulate the object ID to get several independent sell price quotes?

I have two non-stacking potions that could be levitation ($200), monster detection, or gain energy (both $150). This game does not have a shop that will buy potions. I need levitation to mass alchemize gain level and for the endgame, so I can't afford to use up the potions. Conducts make it impossible to produce more such potions (except a slim chance from random alchemy).

In this situation, I'd like get a few more independent price quotes. That means manipulating object ID some way, because sell quotes are tied to that Source:Shk.c#line1898. Best would be two sequential object IDs, since at least one will be without the random surcharge.

I have a decent supply of holy and unholy water to make them stack. How does the game allocate object identity numbers when unstacking?

--Tjr 18:29, 21 January 2011 (UTC)

I am certainly not an expert at object IDs, but it looks like the only assignment to o_id occurs in mkobj.c, three times at lines 237 (splitobj), 339 (bill_dummy_object), and 375 (mksobj). The manner is the same in all three cases;
obj->o_id = flags.ident++;
if (!obj->o_id) obj->o_id = flags.ident++;	/* ident overflowed */
So the IDs should always be allocated sequentially and will never be 0.
Your post isn't entirely clear; do you have multiple copies of these potions? If not I don't know how you expect to be able to change the ID, and either way I don't see why you need the holy water. Simply dropping a single potion from a stack should create a new objid for that new item. I think that doing this twice will always create two adjascent object IDs (barring sudden monster generation...), which should give you an accurate price when buying them back. -- Qazmlpok 19:56, 21 January 2011 (UTC)