[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Adding obj level variable
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Adding obj level variable
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  

Posted by Zeno   USA  (2,776 posts)  [Biography] bio
Date Thu 12 May 2005 05:30 PM (UTC)  quote  ]

Amended on Thu 12 May 2005 05:31 PM (UTC) by Zeno

Message
I don't even see where it saves index data. Looking at item_type (since this saves the index):

fwrite obj:
    if ( obj->item_type != obj->pIndexData->item_type )
        fprintf( fp, "ItemType     %d\n",       obj->item_type       );


fread_obj:
            KEY( "ItemType",    obj->item_type,         fread_number( fp ) );

...
                    obj->item_type = obj->pIndexData->item_type;


Now the last line... that wouldn't be it would it? I doubt it, since each obj level is unique. (IE, if spawned off a mob its that mobs level)

Here's object level:

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


fread_obj:
            KEY( "Level",       obj->level,             fread_number( fp ) );


That's it.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Gatewaysysop2   USA  (142 posts)  [Biography] bio
Date Thu 12 May 2005 05:09 PM (UTC)  quote  ]
Message
As was mentioned to me before when working out the hotboot / rare items issues, it's probably one of two broad possibilities. Either it's not saving properly and thus not being read properly back in (the level I mean) OR it is saving properly but just not reading back in properly and therefore taking the default / initial value of zero.

I realize that's no exact solution but that's all I can suggest, that maybe something is off in fread_obj or fwrite_obj somehow?


"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
[Go to top] top

Posted by Zeno   USA  (2,776 posts)  [Biography] bio
Date Thu 12 May 2005 04:44 PM (UTC)  quote  ]
Message
Yes it turns out mset wasn't setting the index var. But now if I set the index variable, save/foldarea, and hotboot, it'll reset to 0.

Level: 7 (7)
(foldarea, hotboot)
Level: 7 (0)

Does anyone know why?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Txzeenath   USA  (54 posts)  [Biography] bio
Date Fri 06 May 2005 10:52 AM (UTC)  quote  ]

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)
[Go to top] top

Posted by Gatewaysysop2   USA  (142 posts)  [Biography] bio
Date Fri 06 May 2005 04:37 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,776 posts)  [Biography] bio
Date Fri 06 May 2005 12:09 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Robert Powell   Australia  (349 posts)  [Biography] bio
Date Fri 06 May 2005 12:01 AM (UTC)  quote  ]
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.

EldhaMUD Game Developments
The_Fury: Lead Developer, Head Coder
http://fury.eldhamud2.org
[Go to top] top

Posted by Zeno   USA  (2,776 posts)  [Biography] bio
Date Thu 05 May 2005 09:39 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,776 posts)  [Biography] bio
Date Tue 30 Nov 2004 02:41 AM (UTC)  quote  ]
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
[Go to top] top

Posted by David Haley   USA  (3,824 posts)  [Biography] bio
Date Tue 30 Nov 2004 02:33 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,776 posts)  [Biography] bio
Date Tue 30 Nov 2004 12:24 AM (UTC)  quote  ]

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
[Go to top] top

Posted by Zeno   USA  (2,776 posts)  [Biography] bio
Date Tue 30 Nov 2004 12:12 AM (UTC)  quote  ]
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
[Go to top] top

Posted by David Haley   USA  (3,824 posts)  [Biography] bio
Date Mon 29 Nov 2004 11:56 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,776 posts)  [Biography] bio
Date Mon 29 Nov 2004 11:41 PM (UTC)  quote  ]

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
[Go to top] top

Posted by David Haley   USA  (3,824 posts)  [Biography] bio
Date Mon 29 Nov 2004 11:34 PM (UTC)  quote  ]
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
[Go to top] 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.


2,615 views.

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

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]