Add two new definitions in spells.h underneath ACMD(do_cast);
Code:
#define SCMD_CAST 0
#define SCMD_SING 1
Make a new command in interpreter.c
Code:
{ "sing" , "sing" , POS_SITTING , do_cast , 1, SCMD_SING },
For the cast command, add SCMD_CAST at the end instead of the 0.
Now players can type "sing 'armor'" and the code will treat it like they are casting a spell, but it lets do_cast know they are singing with the SCMD_SING being set.
So now you can make the cosmetic changes, by which I mean replacing messages about spells like 'cast', 'casting' or 'spell' with singing messages.
Eg:
Code:
if (s == NULL) {
send_to_char(ch, "%s what where?\r\n", (subcmd == SCMD_SING ? "Sing" : "Cast"));
return;
}
To stop other classes being able to sing their spells, just add a class check.
Code:
if (subcmd == SCMD_SING && GET_CLASS(ch) != CLASS_ROCKSTAR) {
send_to_char(ch, "Simon Cowell sends you a withering stare..\r\n");
return;
}
And conversely, to stop singers from casting:
Code:
if (subcmd == SCMD_CAST && GET_CLASS(ch) == CLASS_ROCKSTAR) {
send_to_char(ch, "You fantasize about being on the cast of Glee.\r\n");
return;
}
There will be some changes to say_spell() to allow it to handle songs.
Update the definition to include the subcmd:
Code:
static void say_spell(struct char_data *ch, int spellnum, struct char_data *tch, struct obj_data *tobj, int subcmd);
say_spell(ch, spellnum, tch, tobj, (GET_CLASS(ch) == CLASS_CLERIC ? SCMD_SING : SCMD_CAST));
In say_spell() add code to handle the singing messages, something like this:
Code:
if (subcmd == SCMD_SING) {
if (tch != NULL && IN_ROOM(tch) == IN_ROOM(ch)) {
if (tch == ch)
format = "$n begins to sing in a clear voice, '%s'.";
else
format = "$n stares at $N and sings the words, '%s'.";
} else if (tobj != NULL && ((IN_ROOM(tobj) == IN_ROOM(ch)) || (tobj->carried_by == ch)))
format = "$n stares at $p and sings the words, '%s'.";
else
format = "$n sings the words, '%s'.";
}
else {
if (tch != NULL && IN_ROOM(tch) == IN_ROOM(ch)) {
if (tch == ch)
format = "$n closes $s eyes and utters the words, '%s'.";
else
format = "$n stares at $N and utters the words, '%s'.";
} else if (tobj != NULL &&
((IN_ROOM(tobj) == IN_ROOM(ch)) || (tobj->carried_by == ch)))
format = "$n stares at $p and utters the words, '%s'.";
else
format = "$n utters the words, '%s'.";
}