Welcome to the Builder Academy

Question Sing system like cast

More
26 Oct 2017 22:29 - 27 Oct 2017 07:46 #7036 by JTP
Sing system like cast was created by JTP
If i wanted to copy the cast system and also make a sing system, what parts of the code do i need to copy and rename ?

And what about a hole new define song..... list ?

Any ideas, thoughts about this ?
Last edit: 27 Oct 2017 07:46 by JTP.

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

More
29 Oct 2017 20:31 #7042 by WhiskyTest
Replied by WhiskyTest on topic Sing system like cast
The spellcasting system is kind of ingrained in all sorts of places. I think it would be more efficient to make songs the same way you make spells, just adding the cosmetic changes needed so players are singing not casting.

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

More
30 Oct 2017 06:53 - 30 Oct 2017 10:02 #7047 by JTP
Replied by JTP on topic Sing system like cast
Can you be more specific about what you mean cosmetic changes ?

I still need the cast for all other classes, but need sing for one class, and that class must not be able to use cast. And others May not use the sing.
Last edit: 30 Oct 2017 10:02 by JTP.

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

More
30 Oct 2017 21:22 - 30 Oct 2017 21:25 #7049 by WhiskyTest
Replied by WhiskyTest on topic Sing system like cast
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'."; }
Last edit: 30 Oct 2017 21:25 by WhiskyTest.
The following user(s) said Thank You: thomas

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

More
08 Nov 2017 21:43 #7069 by JTP
Replied by JTP on topic Sing system like cast
Hmm, no matter if my test char types cast or sing, i get:

Sing what where?

Something must be slightly off with above code ?

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

More
08 Nov 2017 21:46 - 08 Nov 2017 21:50 #7070 by JTP
Replied by JTP on topic Sing system like cast
Infact no matter what class types cast or sing, it says

Sing what where?
Code:
if (s == NULL) { send_to_char(ch, "%s what where?\r\n", (subcmd == SCMD_SING ? "Sing" : "Cast")); return; }

Something must be wrong with this part, but what ?
Last edit: 08 Nov 2017 21:50 by JTP.

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

Time to create page: 0.813 seconds