ID:166098
 
I am making a game but i am having troble coding spells because I want the kind of spells that you say
So you want a spell to go into effect when you say the name of it only? One method would be to make a chat-filter type system.

Example:
#define SAY 1
mob
verb/say(m as text) if(m) ChatSystem(SAY,m) //checks if m is TRUE and if it is, calls the chatsystem procedure
proc/ChatSystem(channel,msg)
msg=html_encode(msg)//get those pesky people again from font, span, etc. HTML abuse
switch(channel)
if(SAY)
switch(lowertext(msg))//lower caps the message [making the spells in the say verb non-caps sensitive (though the spell names below MUST be in lower text)]
if("fireball")//Checks if the person only said fireball
Fireball code stuff here
if("icebeam") //important, no 'else if' in switch()... once else shows up in switch, that's basically it.
Ice beam code here
else //if it isn't fireball/icebeam ONLY
view(6,src)<<msg //says the message


ofcourse that chat system could have been improved a LOT but you should get the general idea of what to do.

- GhostAnime - Remember, this is one of many possible ways to achieve the effect you want
In response to GhostAnime
Thats Gr8 but i need some spells to work only for certian races.

BUMP
In response to Miran94
I need to have a spell system that works for specific classes but i want one spell that you say that will randomy change ur class to witch (invisiblity,molecular,telkentic ect..)
BUMP
In response to Miran94
Use a list:
var/list/spell2race = list( // spell:class
"fireball" = "wizard",
"blizzard" = "wizard",
"berseker" = "knight")

if(msg == "fireball" && spell2race["fireball"] == usr.class)
world << "a fireball was cast!"


Personally, I like the params version better:

var/spell2class = {"\
fireball=wizard&\
blizzard=wizard&\
berseker=knight"}



var/list/check = params2list(spell2class)
if(msg == "fireball" && usr.class == check["fireball"])
world << "a fireball was cast!"]


But meh, that's just me.
In response to DivineO'peanut
I ment i want a spell that if you cast it itll unlock a class. BUMP
In response to Miran94
Eh? I don't get it. Be more specific.
In response to DivineO'peanut
I guess what he is trying to say is that he wants a spell which is able to change their class, such as , lets say, using "Phero Spirit" will allow the person to become either the class "Pheroie" or the class "Ankai" (making these stuff up btw ._>)

Mirai, do yourself and us a favor and read this tutorial, and than some more, and the DM Guide + DM Ref... because what you want is very simple... it involves if() and input()

- GhostAnime
i read the tutorial u told me about but i want some one to make me one spell to gte me started off. BUMP
In response to Miran94
mob/proc/SpellThatChangesUrClass()
usr.gender = "male"
usr.class = "witch"
usr.EditClassStuff(usr.class)

// note: usr, being the 'user' of the spell.