I am using the polymorph code for a couple of my new classes, but I was wondering, is there a way to have it actually show the players name instead of the long description of the polymorph? Like "$n is morphed into a whatever". Any help on that is much appreciated. Running Smaugfuss 1.7 with mucho snippets, and so far everything looks beautiful!
Polymorph And Player names
Posted by Jynxdarkspell on Sat 24 Feb 2007 08:39 PM — 17 posts, 60,655 views.
Are you doing this via the code, or no?
Well, whichever way works the best, and that'll probably be code related. I mean If I look through the code in comm.c or act_info.c long enough, I'm sure I could figure out a sloppy way to do it, but I'd rather not be sloppy. It'd be nice if the command worked like "setmorph lycan4 long &z$n is transformed into a Stage 4 Lycan.&d", but like I said, any help is appreciated, and looking more closely, I think I'm actually working with a smaugfuss 1.6 base. I'll give you an example of what I hope to get accomplished :) maybe that'll narrow it down :)
<start example>
Crow's Loft [ - ]
-<----------------------------------------------->- [<---(*)-D->]
[ _ ]
You have entered the private sanctuary of Crow. This is where
he comes to get away from it all. The walls are painted black
with a blood red trim surrounding the windows, doors, and floor.
The carpet underneath your feet appears to be of oriental descent.
Standing in the center of the room is Crow's Coffin. Down will
lead you back to the Parlour Of The Immortals.
Exits: none.
A gigantic black "Lovesack" is here for you to sit on.
A red coffin with black trim adourns the center of the room.
Lucian is Hard at Work is standing here.
Lucian is transformed into a Stage 4 Lycan.
[10044hp 42bp 29900] [1201][]
<end example>
I don't know, i mean I suppose if I look more at the flameshield code? Anyways, just hoping someone may have the answer for me so I can make this turn out nice :)
Appreciate it :)
By the way Zeno, I notice you reply to lots of the people's posts, thank you man :)
<start example>
Crow's Loft [ - ]
-<----------------------------------------------->- [<---(*)-D->]
[ _ ]
You have entered the private sanctuary of Crow. This is where
he comes to get away from it all. The walls are painted black
with a blood red trim surrounding the windows, doors, and floor.
The carpet underneath your feet appears to be of oriental descent.
Standing in the center of the room is Crow's Coffin. Down will
lead you back to the Parlour Of The Immortals.
Exits: none.
A gigantic black "Lovesack" is here for you to sit on.
A red coffin with black trim adourns the center of the room.
Lucian is Hard at Work is standing here.
Lucian is transformed into a Stage 4 Lycan.
[10044hp 42bp 29900] [1201][]
<end example>
I don't know, i mean I suppose if I look more at the flameshield code? Anyways, just hoping someone may have the answer for me so I can make this turn out nice :)
Appreciate it :)
By the way Zeno, I notice you reply to lots of the people's posts, thank you man :)
In that case, you'd need to parse setmorph to handle variables. You could probably look over the act function to see how that is done.
Sounds like a great start, but which act function should I get the example from?
There's only one act function. If not, then the one called "act" (there might be "act2" although that may just be my MUD).
And the act functions can be found in which file, bud?
Not sure offhand. You could grep for it, or check mud.h for the prototype and you'll find a comment saying what file it's in.
Thank you Zeno :) I'll see what I can dig up :)
I think if you look in act_info.c in either show_list_to_char or show_list_to_char1 or something along those lines. You mentioned looking at the flameshield code. Search for that part then under it put something like:
if (IS_POLYMORPHED(victim))
sprintf( %s is a %s, victim->name, victim->race);
Something along those lines. That code is not correct in anyway or form, but it gives you an idea of what you could do.
Look at the flameshield peice in the show_to functions. I can't remember which one. See how it works and then create your polymorph if statement.
You might want to search for polymorph and see if there's a polymorph if statement somewhere that you can work off of and put it into your act_info file.
Again, my example was just pseudocode. I can't really remember how exactly to write it as I don't have code in front of me, but that's kind of a basic outline.
I'm sure someone will correct me. :)
if (IS_POLYMORPHED(victim))
sprintf( %s is a %s, victim->name, victim->race);
Something along those lines. That code is not correct in anyway or form, but it gives you an idea of what you could do.
Look at the flameshield peice in the show_to functions. I can't remember which one. See how it works and then create your polymorph if statement.
You might want to search for polymorph and see if there's a polymorph if statement somewhere that you can work off of and put it into your act_info file.
Again, my example was just pseudocode. I can't really remember how exactly to write it as I don't have code in front of me, but that's kind of a basic outline.
I'm sure someone will correct me. :)
I believe Jynxdarkspell wants to actually code something to parse variables in the string, not hardcode it in.
Yea, I just reread the first post. That is what he's wanting.
Well, so far it's coming out the way I wanted it to. There was alot of stuff I noticed in polymorph that didn't quite work right, such as hps. By default it's coded to raise or lower your current hp, not your max hp, so if you have a level restore like I do, when you leveled and got restored, your hitpoints returned to their normal max. I added a max_hit call to the morph structure, along with a max_mana and a max_move to get that taken care of. I had to change the way the show_char_to_char stuff worked, and I coded in a "shockshield" like flag in build.c and created a "shockshield" like speel to show players what I want them to see. It looks and works real well, but now we come to another problem, albeit slight. When a morphed character speaks, it shows the short desc of the morph saying it, i.e. "A stage 1 lycan says 'blah'" I'm trying to figure out how to get it to show the players name says instead of the morph short desc says, and I'm a little stumped.... I've looked at the do_say function, I've looked in comm.c and I'm just not seeing it. Any ideas folks?
Search for "says" I can't exactly remember but I think it has to do with talk_channels or something like that. There's probably an if statement to see if they are polied. I'm thinking that all the other chat channels and such go through the talk_channels.
The line that does the say to the room:
act( AT_SAY, "$n says '$t'", ch, sbuf, vch, TO_VICT );
found in act_comm.c
The code surrounding it has no mention of morphs. Still looking for the answer.....
act( AT_SAY, "$n says '$t'", ch, sbuf, vch, TO_VICT );
found in act_comm.c
The code surrounding it has no mention of morphs. Still looking for the answer.....
Since it looks like $n is being parsed to the short desc and not player name, then your answer is probably in the act function.
I got it :)
It was actually in the MORPHPERS stuff, as far as the speech went. That could have been very annoying having 5 people who were lycans saying something and not having a clue which one said it. It's fixed now :) Back to the creation of the different stages of these classes for me, and I appreciate the help all :) Thank you very much :) Until, I run into another snag!
~Jynx Darkspell~
Crow, Owner of Devil's Night
It was actually in the MORPHPERS stuff, as far as the speech went. That could have been very annoying having 5 people who were lycans saying something and not having a clue which one said it. It's fixed now :) Back to the creation of the different stages of these classes for me, and I appreciate the help all :) Thank you very much :) Until, I run into another snag!
~Jynx Darkspell~
Crow, Owner of Devil's Night