Objects randomly changing level

Posted by Zeno on Mon 26 Jul 2004 04:22 AM — 7 posts, 17,697 views.

USA #0
Objects sold in shops are randomly changing levels. One time it will be level 13, another it will be level 10. Why is this? Here is an object that does that:

Name: small stick
Vnum: 1010  Type: weapon  Count:  27  Gcount: 1
Serial#: 5  TopIdxSerial#: 262  TopSerial#: 505
Short description: a small stick
Long description : A small stick lies here
Wear flags : take wield
Extra flags: inventory
Magic flags: none
Number: 1/1   Weight: 4/4   Layers: 0   Wear_loc: -1
Cost: 50  Rent: 5  Timer: 0  Level: 13
In room: 0  In object: (none)  Carried by: armor shopkeeper
Index Values : 0 2 3 7 0 0.
Object Values: 12 2 6 7 0 0.
Attached shards: 0
Australia Forum Administrator #1
I believe that in order to provide game balance SMAUG actually uses a random calculation for objects based on the area they are in (the level range for the area). However it is randomised slightly so that objects are not always identical.
USA #2
Ugh! More and more I am finding things I dislike. Such as the random stat roll is not so random. Its based on the players name.

You wouldn't happen to know where this random set level would be in? I'll try finding it myself, though I don't know what to look for, except obj->level.
Australia Forum Administrator #3
Not sure, try looking for combinations of level, rand, maybe number_fuzzy, and object.
USA #4
Already found it, in reset.c, heh. Thanks. Still trying to figure out this other reset problem, on the other thread.
Amended on Wed 28 Jul 2004 06:11 AM by Zeno
USA #5
Actually, the function generate_itemlevel is how its done, so I changed the line that called it to:

      if ( mob->pIndexData->pShop )
      {
        int olevel = pObjIndex->level;
        obj = create_object(pObjIndex, olevel);
        xSET_BIT(obj->extra_flags, ITEM_INVENTORY);
      }


Only problem now, is on a reboot, all items in a shop are level 0. Whats up with that?
Australia Forum Administrator #6
Don't know, try the debugger. Maybe pObjIndex->level is 0. Maybe it gets changed later.