Danny Roe

Joined: Apr 15, 08

The three chief virtues of a programmer are: Laziness, Impatience and Hubris.

 

 

Modular Spell System

I made this for a friend quite some time ago, and figured I had lost it when my computer died. Luckily enough, I had emailed it to him and I was able to recover it. Have a look, and see what you think.

Danny Roe's Modular Spell System

Like it? Yay me.
Don't like? Nay me and tell me all my faults. </3

Posted by Danny Roe on Wednesday, May 06, 2009 04:03PM - 7 comments / Members say: yea +4, nay -0

« Core Gameplay · Personal Update »

Login to post a comment.

#7 The Naked Ninja:  

No problem. Funny thing is I just learned how to do that about a week ago. It's amazing how many new things I'm learning, just to have a decent working interface.

Thursday, May 07, 2009 01:55PM

#6 Danny Roe:  

Thanks guys, and Ken, I was intending to add a method of players making their own "Custom" spells. Your example is a very neat way of doing so, thanks.

Thursday, May 07, 2009 05:20AM

#5 D4RK3 54B3R:  

Heh, kind of reminds me of what Shadowdarke has set up for DarkeDungeon

Thursday, May 07, 2009 03:21AM

#4 The Naked Ninja:  

You should make use of datums, or if you wanted to you could define all of these into one list like I've done below. This will make adding and removing spells alot easier without manually defining all of those variables.

<dm>

mob
@var/list/spells
@New()
@@..()
@@spells=new()

@proc/addspell(s_name as text,s_mp as num,s_min as num,s_max as num)
@@if(!spells.Find(s_name))
@@@spells.Add(s_name)
@@spells[s_name]="mp=[s_mp]&min=[s_min]&max=[s_max]"

@verb/cast(spell in spells)
@@var/tmp/list/spell_params=params2list(spells[spell])
@@var/tmp/dmg=rand(text2num(spell_params["min"]) , text2num(spell_params["max"]))
@@world<<"[usr] casts [spell] costing [spell_params["mp"]] and dealing [dmg] damage!"

</dm>

Not entirely sure if DM tags work in comments by the way... lol

EDIT... I guess it won't work and it won't allow indentation. So I'll add @ signs to depict indentation.

Thursday, May 07, 2009 02:37AM

#3 Danny Roe:  

Thanks, I'll eventually update it to include enemy spell casting.

Wednesday, May 06, 2009 07:36PM

#2 Ihateblackpeople:  

Cool!

Wednesday, May 06, 2009 04:56PM

#1 Zaole:  

Neat method. Wish I had thought of that before I began Stick World 2... my spells code is a big delicious pile of spaghetti.

Wednesday, May 06, 2009 04:10PM

 

 

My demos