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
➜ Spell Affects [CASE CLOSED]
Spell Affects [CASE CLOSED]
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Dark_Trunks
Australia (27 posts) Bio
|
Date
| Wed 26 Jun 2002 03:55 PM (UTC) |
Message
| Hi everyone. I'm back yet again.
This time I'm wondering if anyone can help me with creating new affects for spells/skills.
At first I thought all I'd have to do is add them to mud.h with the rest of them:
typedef enum
{
AFF_BLIND, AFF_INVISIBLE, AFF_DETECT_EVIL, AFF_DETECT_INVIS,....
But that doesnt seem to work, so I guess theres a bit more to it.
So if anyone can give me a hand with this it'd be much appreciated! | Top |
|
Posted by
| Neves
USA (78 posts) Bio
|
Date
| Reply #1 on Wed 26 Jun 2002 09:54 PM (UTC) |
Message
| Adding it to mud.h will only allow you to put it on a player or remove it, but you will actually have to change the code to check if the effect is on. Meaning if you want an affect like blindness, you will have to put before the part of code that displays a room to have a check if(!IS_AFFECTED(ch, AFF_NEWBLIND) then to continue, or whatever the correct check is, I can't be bothered to look it up. The game won't know what to do with an effect unless it is told, so you will also have to go into the code to make the checks if the player is affected or not.
-Mark Calloway | Top |
|
Posted by
| Dark_Trunks
Australia (27 posts) Bio
|
Date
| Reply #2 on Thu 27 Jun 2002 03:36 PM (UTC) |
Message
| Well thats exactly what I've done, but whenever I make a call to affect_to_char(ch, af) the compiler complains about an incompatible type.
Quote:
misc.c:259: incompatible type for argument 2 of `affect_to_char'
misc.c:272: incompatible type for argument 2 of `affect_remove'
And in case your wondering, I'm pretty sure I've made 'af' properly. (Please correct me if I'm wrong)
AFFECT_DATA af;
af.type = 0;
af.duration = 0;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = meb(AFF_OOZARU);
| Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sat 29 Jun 2002 12:10 AM (UTC) |
Message
| Perhaps post the lines in question that actually cause the error message? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Dark_Trunks
Australia (27 posts) Bio
|
Date
| Reply #4 on Sat 29 Jun 2002 03:15 PM (UTC) |
Message
| Well before I put them in, the compiler assumed I was sending an int as the second argument. Although it was just a warning, I didn't want to run it with something like that - I've had that warning before and it caused many crashes. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #5 on Tue 02 Jul 2002 11:44 PM (UTC) |
Message
| You still haven't posted the lines that are causing the error. I can't tell what is wrong if I have to guess what your code looks like. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Dark_Trunks
Australia (27 posts) Bio
|
Date
| Reply #6 on Wed 03 Jul 2002 03:13 PM (UTC) Amended on Wed 03 Jul 2002 03:16 PM (UTC) by Dark_Trunks
|
Message
| Sorry, I miss read your last post.
Here are the lines in question:
AND
af is setup exactly as in the previous post. | Top |
|
Posted by
| Chris L
USA (57 posts) Bio
|
Date
| Reply #7 on Wed 03 Jul 2002 04:46 PM (UTC) |
Message
| did u add to handler.c in the
char *affect_bit_name( EXT_BV *vector ) ? | Top |
|
Posted by
| Dark_Trunks
Australia (27 posts) Bio
|
Date
| Reply #8 on Wed 03 Jul 2002 04:54 PM (UTC) |
Message
| Yes I added it to that:
if ( xIS_SET(*vector, AFF_OOZARU )) strcat( buf, " oozaru" );
| Top |
|
Posted by
| Chris L
USA (57 posts) Bio
|
Date
| Reply #9 on Wed 03 Jul 2002 06:16 PM (UTC) |
Message
| k not sure if u making this for a spell.. but say if there was a spell 'oozaru' and coded it in ur
ch_ret spell_oozaru( int sn, int level, CHAR_DATA *ch, void *vo )
the af thing should look like
af.type = sn;
af.duration = level * 3;
af.location = APPLY_AFFECT;
af.modifier = 0;
af.bitvector = meb(AFF_OOZARU); | Top |
|
Posted by
| Dark_Trunks
Australia (27 posts) Bio
|
Date
| Reply #10 on Thu 04 Jul 2002 02:39 AM (UTC) |
Message
| Well technically it's not a spell. Its just an affect that I want applied at a peticular time (ie at night on the 30th of every month). The time isn't the problem though, that works fine its the affect that doesn't work.
So what your're saying is that I should make it sort of like a skill/spell? Well I haven't actually done a spell before but I suppose I could give it a go, it makes sense really: Just make it a spell that can't actually be cast by mortals.
Thanks alot for your help. | Top |
|
Posted by
| Dark_Trunks
Australia (27 posts) Bio
|
Date
| Reply #11 on Thu 04 Jul 2002 03:32 PM (UTC) |
Message
| Well thanks to everyone for your help. I managed to finally get it to work!
There was actually two parts to the solution:
PART I:
The compile warning messages were fixed by changing af to &af (I don't know enough about C to understand why)
And the second part was to assign the affect a skill number while not actually making it a skill. (Sure it sounds confusing, I barely understand it - but it works!)
So thanks again! | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #12 on Sun 07 Jul 2002 10:41 PM (UTC) |
Message
|
Quote:
The compile warning messages were fixed by changing af to &af (I don't know enough about C to understand why)
affect_to_char(ch,&af);
The function prototype has an asterisk before "paf", see below:
void affect_to_char( CHAR_DATA *ch, AFFECT_DATA *paf )
The asterisk says to pass the address of an AFFECT_DATA. This is what the ampersand does, takes the address of its argument. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
32,884 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top