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

porting the consume code

 
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Migration/Porting
View previous topic :: View next topic  
Author Message
Cyril



Joined: 28 Jan 2003
Posts: 14
Location: North Carolina

PostPosted: Mon Feb 17, 2003 8:00 am    Post subject: porting the consume code Reply with quote

ok...kal told me to move here since it's a porting issue (sorry, wasn't sure where to put it) but i'm trying to port the consume code. For those who don't know it allows vampires and other undead races to consume corpses for hitpoints mana and movement points. anyways...here's the error i keep getting:
Code:
g++ -c -Wall -g -O  act_obj.cpp -o obj/act_obj.o
act_obj.cpp: In function `void do_consume(char_data*, char*)':
act_obj.cpp:228: `MAX_INPUT_LENGTH' undeclared (first use this function)
act_obj.cpp:228: (Each undeclared identifier is reported only once for each
   function it appears in.)
act_obj.cpp:233: `arg' undeclared (first use this function)
act_obj.cpp:235:24: warning: multi-character character constant
act_obj.cpp:249: ISO C++ forbids comparison between pointer and integer
act_obj.cpp:263: `buf' undeclared (first use this function)
gmake: *** [act_obj.o] Error 1

and here's what i coded:
Code:

226:void do_consume( char_data *ch, char *argument)
227:{
228:        char arg[MAX_INPUT_LENGTH];
229:       char buf[MAX_INPUT_LENGTH];
230:
231:        OBJ_DATA *obj;
232:
233:        one_argument( argument, arg );
234:
235:        if ( arg[0] == '/0' || !str_cmp(arg, ch->name ) )
236:        {
237:                act( "%n bites %mself hard and draws blood.", ch, NULL, NULL, TO_ROOM );
238:                ch->println( "You are one sick puppy, consuming yourself!");
239:                return;
240:        }
241:
242:        obj = get_obj_list( ch, arg, ch->in_room->contents );
243        if ( obj == NULL);
244        {
245                ch->println( "You can't find it.");
246             return;
247        }
248
249        if ( obj == ITEM_CORPSE_PC )
250        {
251                if (obj->contains)
252                {
253                        ch->println( "Not a good idea.");
254                        return;
255                }
256        }
257
258        if ((obj->level * 2) <= 10 )
259        {
260                ch->hit += 10;
261                ch->mana += 20;
262                ch->move += 10;
263                sprintf(buf, "You gain 10 hitpoints, 20 mana, and 10 moves  by consuming the corpse!");
264        }
265        else
266 {
267                ch->hit += (obj->level * 2);
268                ch->mana += (obj->level * 4);
269                ch->move += (obj->level * 2);
270                sprintf(buf, "You gain %d hitpoints %d mana and %d moves by consuming the corpse!",
271                                        (obj->level * 2), (obj->level * 4), (obj->level * 2));
272        }
273        act( "$n consumes the blood of the corpse.", ch, obj, NULL, TO_ROOM );
274        ch->println(buf, ch);
275        extract_obj( obj );
276
277        return;
278 }


there's the entire code as it is written in there......any help?

-cyril



_________________
Death cancels everything but truth; and strips a man of everything but genius and virtue.

William Hazlitt
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
Kalahn
Codebase Developer


Joined: 18 Jan 2003
Posts: 710
Location: New Zealand

PostPosted: Mon Feb 17, 2003 12:54 pm    Post subject: Reply with quote

Change the following lines, to read what I have put:

Code:
228:        char arg[MIL];
229:        char buf[MIL];

235:        if ( IS_NULLSTR(arg) || !str_cmp(arg, ch->name ) )

274:        ch->println(buf);


Let us know how you get on.

- Kal


Back to top
View user's profile Send private message Visit poster's website
Cyril



Joined: 28 Jan 2003
Posts: 14
Location: North Carolina

PostPosted: Tue Feb 18, 2003 7:47 am    Post subject: got it working (somehow) Reply with quote

I got the code working (sorta) i got a friend of mine that knows the dawn code (astin) to help out...he fixed it. Only one thing now...it's supposed to give you 2*level of the mob in HP back,4*level mana and 2*level move. However when a mob dies it loads a level 0 corpse so you get a constant 10 20 10 (since mobs below 10 get that) i'm wondering if anyone knows how to alter the code to include a corpse of the mobs level?

-Cyril



_________________
Death cancels everything but truth; and strips a man of everything but genius and virtue.

William Hazlitt
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
Cyril



Joined: 28 Jan 2003
Posts: 14
Location: North Carolina

PostPosted: Thu Feb 20, 2003 9:03 am    Post subject: Reply with quote

woo! i figured out how to do it...it's in fight.cpp. now the consume code works just like it's supposed to Smile yay!

-Cyril aka Khellendros on the-edge.dynip.com:5002



_________________
Death cancels everything but truth; and strips a man of everything but genius and virtue.

William Hazlitt
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Migration/Porting 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