Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Adding obj level variable

Adding obj level variable

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Zeno   USA  (2,871 posts)  Bio
Date Mon 29 Nov 2004 11:07 PM (UTC)
Message
I need to have the object level variable written to the object, but when I tested it on my old server, it would be set back to 0. I'm not sure if I have to use the AREA_VERSION idea again, or just code it in. It seems simple, but is getting annoying.

In obj_index_data struct:
    sh_int              level;



In obj_data struct:
    sh_int              level;


In fwrite_obj function:
    if ( obj->level )
      fprintf( fp, "Level        %d\n", obj->level                  );


In fread_obj function:
        case 'L':
            KEY( "Level",       obj->level,             fread_number( fp ) );
            break;



reset.c:
      if ( mob->pIndexData->pShop )
      {
        //int olevel = generate_itemlevel( pArea, pObjIndex );;
        obj = create_object(pObjIndex, 1);
        xSET_BIT(obj->extra_flags, ITEM_INVENTORY);
      }
      else
        obj = create_object(pObjIndex, number_fuzzy(level));
      obj->level = URANGE(0, obj->level, LEVEL_AVATAR);


Now, either it's not saving, or it's not loading it. This is my nearly unchanged code, not the old server test.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Mon 29 Nov 2004 11:09 PM (UTC)
Message
Does the object level work on the new server, but not the old server that doesn't have the level code in it? I'm not sure exactly what the problem is.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Mon 29 Nov 2004 11:11 PM (UTC)
Message
If you didn't know, stock Smaug never saved item levels. It simply generated one. So I disabled the random generation, and set to 1 on the new server. On the old server, I attempted to fix that, and have obj levels save, but they are loading at level 0 after I tried.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Mon 29 Nov 2004 11:34 PM (UTC)
Message
if ( mob->pIndexData->pShop )
      {
        //int olevel = generate_itemlevel( pArea, pObjIndex );;
        obj = create_object(pObjIndex, 1);
        xSET_BIT(obj->extra_flags, ITEM_INVENTORY);
      }
      else
        obj = create_object(pObjIndex, number_fuzzy(level));
      obj->level = URANGE(0, obj->level, LEVEL_AVATAR);
Well, if number_fuzzy(level) yields a negative number, then the URANGE will put it between 0 and LEVEL_AVATAR, hence 0.

I've never played with object levels in SMAUG, mainly because the other people who run the MUD have a very strong objection to them. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #4 on Mon 29 Nov 2004 11:41 PM (UTC)

Amended on Mon 29 Nov 2004 11:46 PM (UTC) by Zeno

Message
Oh, I don't feel object level restrictions are too bad. If FFXI uses them, then I feel they aren't that bad. Let me get my old server up and I will see what I did.

[EDIT] Ugh, what a bad pair of sentences. Tch. You get what I mean. ;)

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #5 on Mon 29 Nov 2004 11:56 PM (UTC)
Message
I don't particularly mind them myself, but when you're not the only admin you don't get to make that kind of decision all by yourself. :P

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #6 on Tue 30 Nov 2004 12:12 AM (UTC)
Message
Right, might as well discuss this with my other admins first. I say keep the levels, and I know some others will too. But hopefully some will bring up some good points. I'll hold off posting my code until I get some responses.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #7 on Tue 30 Nov 2004 12:24 AM (UTC)

Amended on Tue 30 Nov 2004 12:28 AM (UTC) by Zeno

Message
Err, just found something out after I asked about everyone's opinion. Apparently objects that are placed on a mob via a reset are set to that mobs level, and save at that level. So objects DO save, just not through oset? I killed a lvl 64 mob, it dropped a worn item, the item level was 64. I hotbooted, stayed saved. Then I did a reboot. Stayed. Any idea..? Doesn't make much sense.

[EDIT] Hmm, so levels are saved. I checked this in my pfile:
#OBJECT
Vnum         2180
Level        64
Values       12 12 84 3 0 0
End


Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #8 on Tue 30 Nov 2004 02:33 AM (UTC)
Message
I've never looked into object levels at all so I really can't tell you what saves and what doesn't. It doesn't really surprise me that at least something saves. :-)

So what exactly is the problem, then?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #9 on Tue 30 Nov 2004 02:41 AM (UTC)
Message
The problem is, after osetting the object's level, it won't stay. I'm going to have search for this problem. I'm guessing it's in reset.c

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #10 on Thu 05 May 2005 09:39 PM (UTC)
Message
The obj->level does save, but it is reset somewhere. I have yet to find where. Does anyone know?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #11 on Fri 06 May 2005 12:01 AM (UTC)
Message
I would take a look in this function, seems its totaly resoncible for levels.

int generate_itemlevel( AREA_DATA *pArea, OBJ_INDEX_DATA *pObjIndex )

Hope that helps some,

Peace.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #12 on Fri 06 May 2005 12:09 AM (UTC)
Message
Nope, that doesn't have anything to do with it being set to 0.

A dragon arm:
Cost: 0  Rent: 0  Timer: 0  Level: 115 (0)

The last number is obj->pIndexData->level.
I oset it to prototype, oset it to level 64, oset it back to non-proto:
Cost: 0  Rent: 0  Timer: 0  Level: 64 (0)


As you can tell the index isn't being set.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Gatewaysysop2   USA  (146 posts)  Bio
Date Reply #13 on Fri 06 May 2005 04:37 AM (UTC)
Message
Hrmm. I suspect this has a large part to do with your problem of the index value not being set.

Build.c, in function do_oset:


   if( !str_cmp( arg2, "level" ) )
   {
      if( !can_omodify( ch, obj ) )
         return;
      obj->level = value;
      return;
   }


I compared this to the other cases (arguments I mean), where it checks for prototype flags and then sets the index value, and it became obvious that oset <obj> <level> never touches the index value.

I don't know if this answers your question at all about why it's reseting the index to zero, maybe that's an artifact of something else you've changed, but as far as oset'ing it and not having the index change, this appears to be the problem.

Hopefully that helps?


"The world of men is dreaming, it has gone mad in its sleep, and a snake is strangling it, but it can't wake up." -D.H. Lawrence
Top

Posted by Txzeenath   USA  (54 posts)  Bio
Date Reply #14 on Fri 06 May 2005 10:52 AM (UTC)

Amended on Fri 06 May 2005 10:55 AM (UTC) by Txzeenath

Message
This is semi-pseudo code, so you may need to change a word or two.


if( !str_cmp( arg2, "level" ) )
{
if( !can_omodify( ch, obj ) )
return;
if (xIS_SET(obj->flags, ITEM_PROTOTYPE))
obj->pIndexData->level = value;
else
obj->level = value;
return;
}

The problem with this, is all objects will be like this, i'll go look at my code and check how it is done, been a while since I had to mess with this.

--------EDIT---------
int
generate_itemlevel (AREA_DATA * pArea, OBJ_INDEX_DATA * pObjIndex)
{
int olevel;
int min = UMAX (pArea->low_soft_range, 1);
int max = UMIN (pArea->hi_soft_range, min + 15);

if (pObjIndex->level > 0)
olevel = UMIN (pObjIndex->level, MAX_LEVEL);




I believe if you change that pointer to OBJ_INDEX_DATA to OBJ_DATA and than have it check the obj->level than UMIN(obj->level, MAX_LEVEL), than change the other parts to obj->pIndexData that need to point to it, it should generate fine.

Darkness comes along thy path, searching, wanting, calling wrath,
shadows awaken, release the light, one and only.. here to fight,
challenge the darkness, the shadows they call, hunting the living,
more and all. Roaring thunder, full of hate, a single bound, seals
your fate.

-Txzeenath

telnet://divineright.org:8088
Alumuble Arda -
*Player owned shops, clans, and housing
*Multiclass & Stat training
*Random mob name generation implemented and Overland mapping.
*Realistic equipment statistics
*Interactive enviroment(weather/sectors)
*Weapon sheaths(scabbards), Throwing weapons
*Automatic crash recovery, saving, and reporting without disconnecting
*Fully customizeable color, Automapper, "Smart" mobiles, Hiscore tables, and more!

Currently running AGE v1.9.6(Originated and modified from Smaug 1.4a)
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


53,836 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.