The Dawn Of Time
The Official Forums for the Dawn Of Time Mud Codebase
 
Log in Register FAQ Memberlist Search The Dawn Of Time Forum Index Goto the Official Dawn Website

Player created custom items.

 
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Snippets
View previous topic :: View next topic  
Author Message
Grey



Joined: 10 Sep 2003
Posts: 42
Location: Australia (Victoria)

PostPosted: Sun Sep 10, 2006 9:59 pm    Post subject: Player created custom items. Reply with quote

Heya folks; looks like my account got 'borked' at some point over the years and my posts were being replaced with spam.

Thanks to mmoritz80's suggestion, using the wayback machine will give you the full post here:

https://web.archive.org/web/20081021171245/http://www.forums.dawnoftime.org/viewtopic.php?p=7890

(I tried to copy/paste this back in, but a bug in the forum caused it to only half-post before spazzing out.)

Good luck everyone. I hope this was or is of some use to you all. Smile



_________________
Known as both "Grey" and "Seethe"


Last edited by Grey on Fri Apr 19, 2019 2:04 pm; edited 10 times in total
Back to top
View user's profile Send private message
Grey



Joined: 10 Sep 2003
Posts: 42
Location: Australia (Victoria)

PostPosted: Sun Sep 10, 2006 10:01 pm    Post subject: Reply with quote

and finally: craft.h

Code:



/**************************************************************************/
// craft.h -
/***************************************************************************
* The Dawn of Time v1.69r (c)1997-2004 Michael Garratt                    *
* >> A number of people have contributed to the Dawn codebase, with the   *
*    majority of code written by Michael Garratt - www.dawnoftime.org     *
* >> To use this source code, you must fully comply with the dawn license *
*    in licenses.txt... In particular, you may not remove this copyright  *
*    notice.                                                              *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* _____ Player Created Custom Items _____                                 *
* Crafting code originally written by Ryan W. Derbyshire                  *
* Repeatedly modified by Seethe and Trellan. 2005                         *
* Some modifications by Icecool. late 2005                                *
* Further modifications by Seethe and Matt. March 2006                    *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* _____ Weapon and Armour Balancing Code _____                            *
* Original balance code written by Daos - Nov. 2003                       *
*                        (as autostat_oedit[autostat.cpp])                *
* Modified by Seethe - Feb. 2006                                          *
* Modified/Rewritten by Matt and Seethe - March 2006                      *
***************************************************************************/

#ifndef CRAFT_H
#define CRAFT_H

DECLARE_DO_FUN(do_craft            );
DECLARE_DO_FUN(do_testweaponbalance   );

void show_olc_flags_types_value(char_data *ch, const struct flag_type *flag_table, const char *command_name, long value);

#endif // CRAFT_H




be sure you add craft.o into your make file and all should work wonderfully Smile

I believe there is no mud-specific code involved, but if there is please leave me a pm on these forums and i will try to help in correcting this (I am very busy though, so don't expect a speedy reply)

The shops that sell these items require two flags to be set, "room2 cust_shop" and ONE of the other cust_flags (be that weapons [cwep_shop] or armour[carmor_shop], etc)

You also need to create a few simple items, one on each of the apropriate pre-defined vnums (you can change these in the code), they must be set to the correct item TYPE, nothing else needs to be set.

One final note: the balance system (which sets the damage of crafted items automatically) will create an item who's AVERAGE damage falls within the bounds of level*0.5 and level*0.75, the actual damage done will of course, move outside those bounds.

(These values were chosen in an attempt to keep it fairly true to the original balance system)



_________________
Known as both "Grey" and "Seethe"


Last edited by Grey on Fri Apr 19, 2019 1:49 pm; edited 2 times in total
Back to top
View user's profile Send private message
Daos



Joined: 29 Jan 2003
Posts: 1224
Location: United States

PostPosted: Wed Oct 25, 2006 8:10 am    Post subject: Reply with quote

*claps* Very cool and well documented Smile



_________________
- Daos

http://www.dawnoftime.org
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Caothas



Joined: 03 Mar 2007
Posts: 5

PostPosted: Tue Mar 06, 2007 1:23 pm    Post subject: Reply with quote

Resolved this issue, please see next post.




Last edited by Caothas on Tue Mar 06, 2007 1:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
Caothas



Joined: 03 Mar 2007
Posts: 5

PostPosted: Tue Mar 06, 2007 1:25 pm    Post subject: Reply with quote

Trying to get this to work and I receive the following error:

Code:

craft.cpp: In function `bool autostat_wepcraft(char_data*)':
craft.cpp:106: `obj_dam' undeclared (first use this function)
craft.cpp:106: (Each undeclared identifier is reported only once for each
   function it appears in.)
craft.cpp: In function `void do_craft(char_data*, char*)':
craft.cpp:380: syntax error before `=' token
craft.cpp:393: `add_apply' undeclared (first use this function)
craft.cpp:580: syntax error before `=' token
craft.cpp:787: syntax error before `=' token
craft.cpp:985: syntax error before `{' token
distcc[13408] ERROR: compile (null) on localhost failed
make: *** [craft.o] Error 1
make: *** Waiting for unfinished jobs....


Line 106
Code:

if(obj_dam.apply_objstat(craft->level, &craft->numdice,&craft->sizedice))

Line 380
Code:

item = create_object(get_obj_index(CRAFT_WEAPON_VNUM));

Line 393
Code:

add_apply(item, "damroll", craft->damroll, craft->level, false);

Line 580
Code:

item = create_object(get_obj_index(CRAFT_ARMOUR_VNUM));

Line 787
Code:

item = create_object(get_obj_index(CRAFT_JEWELRY_VNUM));

Line 984-986
Code:

void do_testweaponbalance(char_data* ch, char *argument)
{
   char arg1[MIL];


Any help is appreciated,

Caothas


Back to top
View user's profile Send private message
Tristan
Moderator (of death!!)


Joined: 21 Apr 2004
Posts: 387
Location: US

PostPosted: Tue Mar 06, 2007 2:39 pm    Post subject: Reply with quote

These errors:

craft.cpp:106: `obj_dam' undeclared (first use this function)
craft.cpp:393: `add_apply' undeclared (first use this function)

are because obj_dam and add_apply are never declared. I'm guessing there's something missing from the snippet.

The other errors are somewhere above the line indicated, try posting the preceding 10 lines or so.


Back to top
View user's profile Send private message Send e-mail Visit poster's website
Grey



Joined: 10 Sep 2003
Posts: 42
Location: Australia (Victoria)

PostPosted: Tue Mar 06, 2007 4:50 pm    Post subject: Reply with quote

Very Happy Firstly, my apologies for taking so long to reply to this thread. I've had a quick glance over the two major issues (as noted by Tristan).

The first is easy enough for fix. Unfortunately my inclusion of the autobalance code is not a stand alone thing and requires the additions of this snippit by Daos:
http://forums.dawnoftime.org/viewtopic.php?t=1679 (You may notice this is the original auto-balance code previously mentioned)

The second however, is (I now realise) a piece of mud-specific code, and I will have to ask permission of the original coder (Trellan I believe) to post the additions needed.

In the meantime, if you comment out any code dealing with modifying the hit and damage modifiers, you should not require the additional code.

I hope that helps somewhat for now

-- Grey//Seethe



_________________
Known as both "Grey" and "Seethe"
Back to top
View user's profile Send private message
Trellan



Joined: 04 Jun 2005
Posts: 45
Location: Columbus Ohio

PostPosted: Wed Jun 25, 2008 8:54 am    Post subject: add_apply Reply with quote

I was digging through old posts and saw this. I let him know a while ago it was ok to post the add_apply function. It's sort of a combination of the affect_to_obj() and affect_join() functions. I wrote one since there wasn't anything comparable I could find in the code. It keeps an obj from having 3 seperate hp modifiers (or any others), instead it combines them into one. I'm just a neat freak. Keep in mind it should only be used with things that have a paf->where of WHERE_MODIFIER unless you fix it up to accept other things, I just didn't need it for that.

Code:

void add_apply(OBJ_DATA * obj, char *loc, int amount, int level, bool special)
{
   if (obj == NULL)
      return;

   AFFECT_DATA *paf;
   int value;
            bool found = false;

   value = flag_value(apply_types, loc);
   affects_from_template_to_obj(obj);

   for ( paf = obj->affected; paf != NULL; paf = paf->next)
   {
      if ( paf->location == value){
         found = true;
         paf->type = -1;
         paf->modifier += amount;
         if (special){
            if (obj->level>paf->level)
               paf->level = obj->level;
         }else
            paf->level = level;
      }
   }
   if (!found){
      paf = new_affect();
      paf->where      = WHERE_MODIFIER;
      paf->type       = -1;
      paf->level      = level;
      paf->duration   = -1;
      paf->location   = (APPLOC)value;
      paf->modifier   = amount;
      paf->bitvector  = 0;
      paf->next       = obj->affected;
      obj->affected   = paf;
   }
   return;
}


Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Isaiah



Joined: 22 Feb 2009
Posts: 7

PostPosted: Sat Mar 28, 2009 6:27 pm    Post subject: Reply with quote

Would you mind posting the obj_dam code as well, Trellan?


Back to top
View user's profile Send private message
Trellan



Joined: 04 Jun 2005
Posts: 45
Location: Columbus Ohio

PostPosted: Fri May 01, 2009 9:36 pm    Post subject: obj_dam Reply with quote

the obj_dam stuff is in the balance snippet, referenced in the second link in the first post at the top of this topic


Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Naylor



Joined: 03 Dec 2012
Posts: 98

PostPosted: Mon Mar 11, 2013 10:44 am    Post subject: Reply with quote

ummm anyone know where i would get a glance at the stuff before the craft.h? all i'm seeing is some light ranting about wat i would guess is a medical thing, and then in the next post it starts:

'and finally: craft.h'

so umm what came before?


Back to top
View user's profile Send private message
Pixie



Joined: 16 Jan 2016
Posts: 54
Location: Pacific Northwest

PostPosted: Sat Jan 16, 2016 4:30 pm    Post subject: Reply with quote

The original post has some weird stuff in it instead of the snippet and stuff.

Anyone know what it had in it? Looking for exactly this.


Back to top
View user's profile Send private message AIM Address
Trell



Joined: 28 Jun 2013
Posts: 49

PostPosted: Sun Jan 17, 2016 10:43 am    Post subject: The orignal snippet Reply with quote

I have a much updated version of the original code for this. I'm at work right now, so can't post, but will be sure to put it up tonight when I get home, or tomorrow afternoon.


Back to top
View user's profile Send private message
Pixie



Joined: 16 Jan 2016
Posts: 54
Location: Pacific Northwest

PostPosted: Sun Jan 17, 2016 2:32 pm    Post subject: Reply with quote

Fantastic! Thanks a lot!


Back to top
View user's profile Send private message AIM Address
mmoritz80



Joined: 21 Sep 2018
Posts: 26
Location: Ohio

PostPosted: Wed Jan 23, 2019 8:32 am    Post subject: Lost Post Info Reply with quote

If you're looking for this lost information here it is reposted by Trell:
http://www.forums.dawnoftime.org/viewtopic.php?t=2800

Here's the original post in all of it's glory, thanks to The Wayback Machine:
https://web.archive.org/web/20081021171245/http://www.forums.dawnoftime.org/viewtopic.php?p=7890



_________________
Lands of Oneiro Pending Alpha Test Two

Melissa's Game Dev Blog
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Snippets All times are GMT + 13 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2005 phpBB Group
Theme created by Vjacheslav Trushkin