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 ➜ Issue adding a new affect

Issue adding a new affect

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


Posted by Sypher-Z   (4 posts)  Bio
Date Fri 22 Aug 2008 03:08 PM (UTC)
Message
Hello. I'm relatively new to coding in C++, and though I've some knowledge of VBA, I do not believe it is enough for the problem I'm facing.

I recently added a new affect. I've defined it in various places, such as mud.h, handler.c, and build.c.

The issue I encounter, is that when I set myself with the affect, it's giving me a different affect in mstat. It's actually giving me dead affects that are embedded in the code, but not used in the MUD itself. There isn't even a way to mset these affects, yet all of a sudden they appear out of the blue with this new affect I've added.

I'm not sure if it has to do with the order I've placed the code for the affect in each individual file, or if it's that I forgot to define it in another file altogether.

Anyway, if any more information is needed, just let me know. I appreciate any assistance offered, and I thank you for your time.

Sypher
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Fri 22 Aug 2008 04:11 PM (UTC)
Message
Could you show what you did to add the effect? The details of what it does in terms of gameplay aren't terribly important for now.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Sypher-Z   (4 posts)  Bio
Date Reply #2 on Fri 22 Aug 2008 06:13 PM (UTC)
Message
Sure,

**In the handlers, I noticed I needed to define a new aff_, so I went ahead and defined aff_bl and proceeded to add:

aff_bl = IS_AFFECTED( ch, AFF_THORNS );

*Further down in the handler file, I added:

if( aff_bl)
xSET_BIT( ch->affected_by, AFF_THORNS );

*As well as:

if ( xIS_SET(*vector, AFF_THORNS ))
strcat( buf, " thorns" );


**In mud.h, I added the AFF_THORNS in the affected_by_types table.

**In act_info.c I added the flag for the affect.

if( IS_AFFECTED( victim, AFF_THORNS ) )
ch_printf( ch, " &P*&G%s is covered in dangerous thorns.\n\r", name );

**In build.c I added this in *const a_flags[] as the last one.

..., "thorns"
};

Those are all the changes that I made to add the affect. I'm not sure why it's rolling over to different affects.

Let me know if I'm missing anything, please. Thanks for looking.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Fri 22 Aug 2008 06:23 PM (UTC)
Message
Quote:
**In mud.h, I added the AFF_THORNS in the affected_by_types table.

Could you show how you did this please?

Effects are implemented with bitvectors, and if the bitvectors are not set up correctly, then setting a flag can set other things. So, if the value is not exactly correct, or the flag data structure isn't set up correctly, things can go wrong.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Sypher-Z   (4 posts)  Bio
Date Reply #4 on Fri 22 Aug 2008 06:55 PM (UTC)

Amended on Fri 22 Aug 2008 06:56 PM (UTC) by Sypher-Z

Message
I had a feeling it was that. I had moved the affect in mud.h to another spot and it was reflecting a different affect.

At the moment, I don't really know where to put it. I wouldn't want to mess up anything that would..say..change all the mobs affects due to another of these "roll-overs".

mud.h is a little whacky at the moment. It looks like some of these affects were crammed in there, mainly the useless ones.

I'm not sure of how much of this you'd like to see, but here's the final few lines.. The final 4 to be exact. I'll label each line with an asterisk.

*AFF_SUPER_OOZARU, AFF_NOSHADOW, AFF_SERAPHIM, AFF_MECHAFIGHTER,
*AFF_APPMAGE, AFF_MASTERMAGE, AFF_ARCHMAGE, AFF_SHADOWMAGE, AFF_SEMIMORT, AFF_GESPETITE, AFF_MALACHITE, AFF_EMERALD, AFF_THORNS,
*MAX_AFFECTED_BY,
*} affected_by_types;

I'm now sure if you can decipher this with such little data, but the piece that I added in handler.c:

*if ( xIS_SET(*vector, AFF_THORNS )) strcat( buf, " thorns" );

This piece was put at the end of the list. So I figured thorns should be at the end of the list. I guess I was wrong, heh. Newbie luck = 0. :P

Let me know if you need any more info in particular.

Edit:
I was wondering if it's necessary to add these effects in ibuild.c. If so, I've no clue how to deal with the fourth number in the individial MENU_DATA sequences. But I'm not worried about that for now. Just figured I'd ask if it's necessary at all.
Top

Posted by Sypher-Z   (4 posts)  Bio
Date Reply #5 on Fri 22 Aug 2008 09:33 PM (UTC)
Message
I'm not sure if it's against the forum policy to double post or anything, but...believe it or not, I found the fix.

Now...remember this is like..SMAUG. >.>

I had to go in build.c where I added thorns and, since there are dead affects in the MUD from unused races, I had to add "", before thorns in the char *const a_flags[].

Took me a while to figure this one out. I basically moved the code up and down a notch in multiple files until I caught the one that was actually affecting it. Like I said, I'm relatively new. At least I know more or less how computers work, heheh.

Thank you for all the help. I really appreciate you taking the time. I'll definitely come back if I have any other issue that I can't figure out. I know how SMAUG can be tricky. Lol.

Sypher
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #6 on Sat 23 Aug 2008 07:04 PM (UTC)
Message
Glad to hear you figured it out. :-) The SMAUG code is indeed persnickety and doesn't always make it easy to figure out how to add things like this. Sometimes you just need to know the right arcane incantation to do the trick...

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
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.


20,664 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.