[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Spell Affects [CASE CLOSED]
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Spell Affects [CASE CLOSED]

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


Posted by Dark_Trunks   Australia  (27 posts)  [Biography] 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!
[Go to top] top

Posted by Neves   USA  (78 posts)  [Biography] 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
[Go to top] top

Posted by Dark_Trunks   Australia  (27 posts)  [Biography] 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);
[Go to top] top

Posted by Nick Gammon   Australia  (21,674 posts)  [Biography] 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
[Go to top] top

Posted by Dark_Trunks   Australia  (27 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,674 posts)  [Biography] 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
[Go to top] top

Posted by Dark_Trunks   Australia  (27 posts)  [Biography] 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:

affect_to_char(ch,af);

AND

affect_remove(ch, af);


af is setup exactly as in the previous post.
[Go to top] top

Posted by Chris L   USA  (57 posts)  [Biography] 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 ) ?
[Go to top] top

Posted by Dark_Trunks   Australia  (27 posts)  [Biography] 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"	    );
[Go to top] top

Posted by Chris L   USA  (57 posts)  [Biography] 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);
[Go to top] top

Posted by Dark_Trunks   Australia  (27 posts)  [Biography] 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.
[Go to top] top

Posted by Dark_Trunks   Australia  (27 posts)  [Biography] 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)

affect_to_char(ch,&af);


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!
[Go to top] top

Posted by Nick Gammon   Australia  (21,674 posts)  [Biography] 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
[Go to top] 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.


7,701 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]