Top Mud Sites Forum

Top Mud Sites Forum (http://www.topmudsites.com/forums/index.php)
-   MUD Coding (http://www.topmudsites.com/forums/forumdisplay.php?f=9)
-   -   npc summoning code bug (SMAUG) (http://www.topmudsites.com/forums/showthread.php?t=4513)

tochi 09-03-2007 01:06 AM

npc summoning code bug (SMAUG)
 
howdy folks. i'm a bit of an amatuer coder here so be gentle.

we're working on developing a code that'll summon a large NPC to follow the player inside our MUD. basicly summon up a kind of silly homonculus. took bits from animate dead and a pre-existing summon familiar snippet and went to town.

the problem is that for some reason the NPC isn't showing up with the charm flag. it'll follow you, but you can't order it to do a single thing.

there've also been some odd crashes in our test MUD related to this, but the core dumps tell us nothing helpful and the body of the errors are the enigmatic 'called with threadlist_ix -1' sort.

anyway. here's the code itself. if anyone can figure out why the charm flag isn't turning itself on, it'd be great. if you can figure why it appears to make us volitile too, that'd be absotively astonishing.

code's totally free to use and modify, too. :3

Zeno 09-03-2007 01:18 AM

Re: npc summoning code bug (SMAUG)
 
For one, you don't need the affect_to_char if you already set the affected_by charm.

You also may want to set the mob first before it gets sent to the room, and then add_follower after it gets sent to the room.

tochi 09-03-2007 01:27 AM

Re: npc summoning code bug (SMAUG)
 
well, i'll give it a shot but i kind of wonder if it'll make a difference.

the tail end of things was a direct copy from animate dead, and the charm flag DID work for animate dead.

from animate dead:
compared to the daisy daisy:
essentially my additions were redundant. or are you saying that add_follower ought to be after the redundant xset_bits?

Zeno 09-03-2007 01:32 AM

Re: npc summoning code bug (SMAUG)
 
Here is the end of a function I wrote (it works fine). It creates a mob and goes under the control of the person.
Mine isn't set as a pet though.

If that doesn't work/help, tell me what message you are getting when you try to order it. Or is it not even getting charmed?

tochi 09-03-2007 01:35 AM

Re: npc summoning code bug (SMAUG)
 
it is not even getting charmed, that is the issue. i kind of did say that in the first post.

Zeno 09-03-2007 01:43 AM

Re: npc summoning code bug (SMAUG)
 
I know, but I meant is the problem still happening after you made the changes? Followed the order my code is in? Setting the bit should not fail.

tochi 09-03-2007 02:00 AM

Re: npc summoning code bug (SMAUG)
 
after some tweaking i managed to get it working. your initial suggestion about the char_to_room threw me because i already HAD the add_follower after it, so i thought you must have meant before it and things became messed up.

here's the current working code. i trimmed off some redundancies and nipped the tail end off you mentioned. not sure why it works when prior versions didn't.


Zeno 09-03-2007 02:43 AM

Re: npc summoning code bug (SMAUG)
 
You don't need that af.type etc stuff either, since it's never used.


All times are GMT -4. The time now is 08:41 AM.

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022