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 more values to an specific item type?

adding more values to an specific item type?

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


Posted by Mopop   (115 posts)  Bio
Date Sun 18 Dec 2005 06:38 PM (UTC)
Message
The snippet im using is in ROM, It is highly crappy in smaug. I have edited it some to be more smaugish. But the one problem is with the 4th value is used to see what type of gun it is, what ammo it requires and how hard it recoils. It wont let me assign all those things to a value. So I was wondering the possiblity of creating more than 4 values?
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Sun 18 Dec 2005 06:54 PM (UTC)
Message
Smaug has 6 values, value0 to value5.

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

Posted by Mopop   (115 posts)  Bio
Date Reply #2 on Tue 20 Dec 2005 03:56 AM (UTC)
Message
Ah right how would i go about chaning the values? I looked over the object codes and couldnt find where the vaules are to be edited.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #3 on Tue 20 Dec 2005 12:51 PM (UTC)
Message
In the code? Like this will set value0 to 1:
obj->value[0] = 1;

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

Posted by Mopop   (115 posts)  Bio
Date Reply #4 on Tue 20 Dec 2005 04:27 PM (UTC)
Message
Where can I find that at grep seems to geek out on me for some reason....
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #5 on Tue 20 Dec 2005 04:42 PM (UTC)
Message
What exactly do you want to do? You want to change the values... I really don't understand that.

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

Posted by Mopop   (115 posts)  Bio
Date Reply #6 on Tue 20 Dec 2005 04:57 PM (UTC)
Message
I'm trying to add a new item in a gun (remember the gun snippet? Well its not very good, like you said). So I dont know how to code a value for an item. I just need v1 to be gun type, v2 ammo type v3 recoil v4 and how much ammo it can hold. I never really did anything like this so its all new to me...
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #7 on Tue 20 Dec 2005 07:50 PM (UTC)
Message
You just code that in the snippet. There isn't a specific place to put it other than that.

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

Posted by Mopop   (115 posts)  Bio
Date Reply #8 on Tue 20 Dec 2005 08:38 PM (UTC)
Message
I know this, how tho I see in this snippet several
if (obj->value[0])

I dont know, can you tell me where to look for an example?
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #9 on Tue 20 Dec 2005 09:28 PM (UTC)
Message
Quote:
I know this, how tho I see in this snippet several
if (obj->value[0])


That will work fine if it's in the snippet already.

I already gave you an example:
Quote:
In the code? Like this will set value0 to 1:

obj->value[0] = 1;

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

Posted by Conner   USA  (381 posts)  Bio
Date Reply #10 on Wed 28 Dec 2005 05:45 PM (UTC)
Message
I think the problem here may be that you, Mopop, aren't explaining what it is that yur asking clearly enough. I'm guessing that what you're really after is how to change what the value of one of those v0 through v5 means, but only you can point out whether or not I'm guessing correctly.

-=Conner=-
--
Come test your mettle in the Land of Legends at telnet://tcdbbs.zapto.org:4000
or, for a little family oriented medieval fun, come join us at The Castle's Dungeon BBS at telnet://tcdbbs.zapto.org
or, if you just want information about either, check our web page at http://tcdbbs.zapto.org
Top

Posted by Mopop   (115 posts)  Bio
Date Reply #11 on Thu 29 Dec 2005 01:30 PM (UTC)
Message
Yeah thats what I mean, I just didnt understand it. :(
Top

Posted by Conner   USA  (381 posts)  Bio
Date Reply #12 on Thu 29 Dec 2005 05:16 PM (UTC)
Message
The best way I know to approach this would be to have you look over the way the v0 - v5 are used by other object types in the code for examples to use as guidance, you might start with grepping for salve since salves actually use all 6 values (you could even start looking in misc.c, but you might expand your review to include each of the other files that include salve information as well).

-=Conner=-
--
Come test your mettle in the Land of Legends at telnet://tcdbbs.zapto.org:4000
or, for a little family oriented medieval fun, come join us at The Castle's Dungeon BBS at telnet://tcdbbs.zapto.org
or, if you just want information about either, check our web page at http://tcdbbs.zapto.org
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #13 on Thu 29 Dec 2005 06:34 PM (UTC)
Message
You do not need to add anything new, the only thing you need to do is tell the code which value to look at. For example:

  if ( gun->value[4] == 0 )
    send_to_char( "You need to reload your weapon.\n\r", ch );


If remembering which values you need to use is too much for you, you can go as far as defining values in mud.h:

#define  V_GUNTYPE    0
#define  V_AMMOTYPE   1
#define  V_RECOIL     2
#define  V_CURAMMO    3

#define  MAXAMMO      15  // Clips can hold up to 15 bullets

then inside your snippet you would do something like:

do_reload:
  if ( gun->value[V_CURAMMO] <= MAXAMMO ) {
    bullets_left -= MAXAMMO - gun->value[V_CURAMMO];
    gun->value[V_CURAMMO] = MAXAMMO;
  }
  else {
    send_to_char( "Your clip is full.\n\r", ch );
  }
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.


43,007 views.

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.