Welcome to the Builder Academy

Question spell idea - need assistance

More
09 May 2016 17:25 - 09 May 2016 19:59 #5863 by JTP
Hey

I wanna make a globe of darkness spell, the spell itself is fairly easy to make. And it will display being surrounded by darkness, and hide being affected by sanctuary if affected by that. I can handle that part.

I have a drow and elf race, and those races dont like the sun, hence the spell.


Now come the part that I really could use your help with, im sure it is much more code demanding then what I have ever tried so far. The spell would need those 2 races to take a small damage per tick when not being affected by this spell, and a message about being exposed to the sun bla bla bla.

If the tick based damage is impossible to make, then we need to come up with another cool idea.


When being in dark rooms, tunnel, inside and under Water, you dont take damage.

Hope we can make this.
Last edit: 09 May 2016 19:59 by JTP.

Please Log in or Create an account to join the conversation.

More
09 May 2016 20:05 #5865 by thomas
Replied by thomas on topic spell idea - need assistance
tick based damage is already implemented, see the poison spell, and the couple of lines in point_update, here: github.com/tbamud/tbamud/blob/2f12752373...a4/src/limits.c#L395

It's not VERY demanding to make what you're after. If you model it after the poison spell, there's a good chance you'll get it to work as you wish.

Please Log in or Create an account to join the conversation.

More
09 May 2016 20:18 - 09 May 2016 20:23 #5866 by JTP
Replied by JTP on topic spell idea - need assistance
Code:
if (AFF_FLAGGED(i, AFF_POISON)) if (damage(i, i, 2, SPELL_POISON) == -1) continue; /* Oops, they died. -gg 6/24/98 */ if (GET_POS(i) <= POS_STUNNED) update_pos(i);

So this code damages the player ?

So a new else if with
if (!AFF_FLAGGED(i, AFF_GLOBE_OF_DARKNESS))

would damage the player ? hmm nice, but should only affect drow and elf and not everyone, and only outside.
Last edit: 09 May 2016 20:23 by JTP.

Please Log in or Create an account to join the conversation.

More
09 May 2016 20:27 - 09 May 2016 21:34 #5867 by JTP
Replied by JTP on topic spell idea - need assistance
Would this be douable for the race part, i have never had to check for 2 races before, or wise versa with the && and || ?
Code:
else if (!IS_DARK(ch->in_room) && (GET_RACE(ch) == RACE_DROW || GET_RACE(ch) == ELF) && (!AFF_FLAGGED(i, AFF_GLOBE_OF_DARKNESS) && !something else SECT_UNDERWATER ??) { if (damage(i, i, 2, TYPE_SUFFERING) == -1) act(" bla bla bla... continue; }

Or am i totally off ? no doubt im in over my head with this haha, BUT im trying my best..But pls fill in where im off pls.

And what is the 2 for, and -1 ?
Last edit: 09 May 2016 21:34 by JTP.

Please Log in or Create an account to join the conversation.

More
09 May 2016 21:23 - 09 May 2016 21:25 #5868 by thomas
Replied by thomas on topic spell idea - need assistance
You're on the right track. I'm sure we check the current zone type for a character somewhere. I think you need a check like this where you have the "something else":
Code:
IN_ROOM(ch) != NOWHERE && ( SECT(IN_ROOM(ch)) == SECT_INSIDE || SECT(IN_ROOM(ch)) == SECT_UNDERWATER || ROOM_FLAGGED(IN_ROOM(ch), ROOM_DARK) || ROOM_FLAGGED(IN_ROOM(ch), ROOM_TUNNEL) )
A gotcha you need to be aware off is (x && y || z) is interpreted from left to right - and will be true if x and y are true or if z is true. To get the effect you want, use parentheses to group the ones you care about, like (x && (y || z)).
Last edit: 09 May 2016 21:25 by thomas. Reason: nicer code with macros

Please Log in or Create an account to join the conversation.

More
10 May 2016 20:17 - 10 May 2016 21:12 #5874 by JTP
Replied by JTP on topic spell idea - need assistance
Worked just great...the only thing i havent been able to make yet is the underwater part.

But everything else Works great...Thanks thomas!
Last edit: 10 May 2016 21:12 by JTP.

Please Log in or Create an account to join the conversation.

Time to create page: 0.191 seconds