[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  A few questions.
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

A few questions.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1 2  3  4  5  6  

Posted by Longbow   (102 posts)  [Biography] bio
Date Wed 30 Mar 2005 11:49 PM (UTC)

Amended on Thu 31 Mar 2005 12:00 AM (UTC) by Longbow

Message
Howdy yall, I'm not the best of coders(really poor) so I'm requesting that if you reply you explain your answers thoroughly please. Thanks!

1. Is is possible to skin corpses? I feel certain there is a way to do this, but I have only had Smaug for a little while.

2. Is it possible to make objects out of other objects? For example, if I had a flour obj and a waterskin obj and I wanted to type bake/cook/make bread, how would I go about turning it into a bread object? The same question applies to making clothing out of cloth.

3. Everytime I aassign myself an area and savearea in it, it erases all my work when I reboot the MUD. Why is this happening?

4. I want to make a fishing program where there is a random chance of a fish passing by(ie a message telling you that you see a fish swimming by), and when that message occurs if you type catch there will be a chance you will catch the fish, thus adding a fish obj to your inventory.

5. I want a turn-based combat system(ie, One player attacks and then the battle stops. Then the other person attacks, and so forth.), but I'm not sure about what to remove. I still have to make it so that after a period of time a NPC will attack since unlike players they have no one to type in attacks. I saw an article somewhere in this forum about it but the coding is over my head.

I may add more questions later but enough for now. If you can only answer one or two of them that's fine, I will be glad for the help.

Godbless,
Longbow
[Go to top] top

Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Reply #1 on Thu 31 Mar 2005 05:52 AM (UTC)
Message
1. yes, there is a skin command in smaug already, which is used by PK's to skin each other as trophies.

2. yes, there are a number of ways you can achieve this, how you would do it would depend on the outcome you want. For your baking example you would check in the baking function that the player had the objects needed to bake a cake, remove the objects from their inventory and then put a cake object in.

3. If you have aassigned an area to yourself you cannot savearea, you must use foldarea to save changes. savea only works on prototype area's, not ones that are live and in the game.

4. WHat is it with fishing, i have been asked to add fishing into my mud by another imm, read about it in a thread oon mudconnect,, was asked to code it for another mud and now we have it again. Below sudo code by me LOL.

check they entered the command and any paramiters correct
check they can use the skill/ if its a skill
check they are in the right place to fish/ cant fish in the city huh
check they have the right objects/ bait and tackle
bailout if if any of these fail
remove bait / 1 bait 1 cast
roll dice to see of there is a fish
if no fish, wait till they retrieve line then end.
if fish is there, wait till they pull  the line,
% chance of catching based on gear used and type of fish.
if no catch wait till they retrieve line then end
if caught fish, load fish object to room, end

That would cover most of what you would need to d for fishing.

5. this is way over my head, if your struggeling with some of the easy things then i would wait on this for a long time to come.

Hope i have been of some help.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #2 on Sat 02 Apr 2005 12:22 AM (UTC)
Message
Ok, thanks for the help so far. A few questions though...

1. I couldn't seem to skin ANY corpse, be it a mob or a pc. I want to be able to skin mobs in particular.

2. Where would one insert his baking function(ie, which file, there are multiple ones with commands in them)?

3. Will have to try this, thanks!




Thanks again, if anybody has any more ideas or additions to the old ones please let me know.

Godbless,
Longbow
[Go to top] top

Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Reply #3 on Sat 02 Apr 2005 05:16 AM (UTC)

Amended on Sat 02 Apr 2005 05:24 AM (UTC) by Robert Powell

Message
The skill do_skin is in skills.c, if you dont have it, here is the code for it, it doesnt need many changed to make it skin mobs.

void do_skin( CHAR_DATA *ch, char *argument)
{
    OBJ_DATA *korps;
    OBJ_DATA *corpse;
    OBJ_DATA *obj;
    OBJ_DATA *skin;
    bool found;
    char *name;
    char buf[MAX_STRING_LENGTH];
    found = FALSE;
 
    if ( !IS_PKILL(ch) && !IS_IMMORTAL(ch) )
    {
        send_to_char( "Leave the hideous defilings to the killers!\n", ch );
        return;
    }
    if ( argument[0] == '\0' )
    { 
        send_to_char( "Whose corpse do you wish to skin?\n\r", ch );
        return;
    }
    if ( (corpse=get_obj_here(ch, argument)) == NULL )
    {
	send_to_char( "You cannot find that here.\n\r", ch );
	return;
    }
    if ( (obj=get_eq_char(ch, WEAR_WIELD)) == NULL )
    {
        send_to_char( "You have no weapon with which to perform this deed.\n\r", ch );
        return;
    }
    if ( corpse->item_type != ITEM_CORPSE_NPC )
    {
        send_to_char( "You can only skin the bodies of player characters.\n\r", ch);
        return;
    }
 /*   if ( obj->value[3] != 1
    &&   obj->value[3] != 2
    &&   obj->value[3] != 3
    &&   obj->value[3] != 11 )
    {
        send_to_char( "There is nothing you can do with this corpse.\n\r", ch );
        return;
    } */
    if ( get_obj_index( OBJ_VNUM_SKIN ) == NULL )
    {
      bug( "Vnum 23 (OBJ_VNUM_SKIN) not found for do_skin!", 0);
      return;
    }
    korps               = create_object( get_obj_index(OBJ_VNUM_CORPSE_PC), 0 );
    skin                = create_object( get_obj_index(OBJ_VNUM_SKIN), 0 );
    name                = IS_NPC(ch) ? korps->short_descr : corpse->short_descr;
    sprintf( buf, skin->short_descr, name );
    STRFREE( skin->short_descr );
    skin->short_descr = STRALLOC( buf );
    sprintf( buf, skin->description, name );
    STRFREE( skin->description );
    skin->description = STRALLOC( buf );
    act( AT_BLOOD, "$n strips the skin from $p.", ch, corpse, NULL, TO_ROOM);
    act( AT_BLOOD, "You strip the skin from $p.", ch, corpse, NULL, TO_CHAR);
  act( AT_MAGIC, "\nThe skinless corpse is dragged through the ground by a strange force...", ch, corpse, NULL, TO_CHAR);
    act( AT_MAGIC, "\nThe skinless corpse is dragged through the ground by a strange force...", ch, corpse, NULL, TO_ROOM);
    extract_obj( corpse ); 
    obj_to_char( skin, ch );
    return;
}


Dont forget to make the required entries in tables.c and mud.h, and then, when cleaned and made, cedit the command.


As for what file to put your baking command in, it is realy a matter of choice, tho, as it is a skill(if your making it a skill that a class receives) and not a command, you could put it in skills.c with all the other skills.

On the other hand, if your going to be making a lot of new skills that are all related, (baking, fishing, mining, chop_trees_down, ect) you might want to start a new C file, crafting.c where all the crafting related skills are kept. Ultimately its up to you to place the functions in a place that is easy to find them later.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #4 on Sat 02 Apr 2005 03:20 PM (UTC)
Message
Ugh, I wish I knew C.


I found I did have that skin bit in my file, but for some reason I still can't skin folks! Ugh....


BTW, is there a simple way to add more than one type of money?


Thanks for all the help and Godbless,
Longbow
[Go to top] top

Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Reply #5 on Sat 02 Apr 2005 10:25 PM (UTC)
Message
Ok with the skin code this is what you want to look at and change to suit how you want it to work.

if ( !IS_PKILL(ch) && !IS_IMMORTAL(ch) )
    {
        send_to_char( "Leave the hideous defilings to the killers!\n", ch );
        return;
    }


In this section you have to be a Pkiller or an Immortal to skin

if ( corpse->item_type != ITEM_CORPSE_NPC )


Hmmm guess i changed this already so that you can skin the corpses of Mobiles instead of Players. Yours will read ITEM_CORPSE_PC.

I dont know about a simple way to add more than one type of money. There is a snippet out there that adds in Silver and Bronze. It was written by Sadiq, i think you can find it on Samsons snippet site.

I just looked through it, seems to be a lot of aditions there, i wouldnt say that it is a simple snippet to add tho.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #6 on Sun 03 Apr 2005 04:20 AM (UTC)
Message
Three questions: do I need to make an object for the ITEM_CORPSE_NPC or does it figure out that item for itself?

Second question: What's the link of that Sadiq fellow's page? I might take a look at that.

Third question: I tried foldarea and it says it saved but my mob was gone! Does it have to be a prototype or something?

Thanks for all your help and Godbless!

Longbow
[Go to top] top

Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Reply #7 on Sun 03 Apr 2005 06:54 AM (UTC)
Message
1. ITEM_CORPSE_NPC is defined in mud.h, the actual items vnum is a part of limbo.are, tho i cannot think of hand what the vnum is. So no you dont need to make an object for this as it is already a part of limbo.are

2. It www.afkmud.com its in the download section under sadiq's stuff, its called alternate currency system.



3. If you have a look in the area file you should find the mobile, that you created there, as long as you have created one within the vnum range of the area file.

When you make a mobile, you also have to create a reset for the mobile to make it come into the area when the area resets.

There are a number of ways to acheive this. Instaroom, Instazone, and Reset are all commands that can be used to make a reset. Read the help files on them to become more familure with them.

On another note, if your having trouble understanding the whole building process, there is an exelent website that i learned much from. I cannot think of the address offhand, but do a google for Herne's Smaug Building Guide. Its the most comprehensive builders guide that i know of.

Hope this has been some help.

Peace.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Thu 07 Apr 2005 05:24 AM (UTC)
Message
Quote:

What is it with fishing, i have been asked to add fishing into my mud by another imm, read about it in a thread oon mudconnect,, was asked to code it for another mud and now we have it again.


Some MMORPGs have fishing (eg. World Of Warcraft), maybe the idea is spilling across to text MUDs.

It is a way of gathering food (and occasionally treasure, like a message in a bottle).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #9 on Thu 07 Apr 2005 06:27 PM (UTC)
Message
Final Fantasy XI has fishing as well. A fairly good way to make some money, if I remember right. Lots of gear and stuff for it (some tackle that would allow you to catch 4-5 fish at once or something).

~Nick Cash
http://www.nick-cash.com
[Go to top] top

Posted by Gadush   (92 posts)  [Biography] bio
Date Reply #10 on Fri 08 Apr 2005 02:03 AM (UTC)
Message
It adds another thing for players to do besides killing mobs, and is, as Nick said, a source of food. Both the Muds I've played on had fishing, and that was long before the high-falootin' MMORPG craze. =)
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #11 on Sun 10 Apr 2005 02:50 AM (UTC)
Message
I thought I might mention I've never added a new command before. How would one learn how to add a new command such as fish/bake/sew/etc?

And I'm not sure I understand how to add fishing even after all of this. Could somebody give me an example?

Thanks and Godbless,
Longbow
[Go to top] top

Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Reply #12 on Sun 10 Apr 2005 06:02 AM (UTC)

Amended on Sun 10 Apr 2005 06:03 AM (UTC) by Robert Powell

Message
To add a new command (SKILL??) you would follow the following, not exactly in that order, but this pretty much covers it. I will assume that its a skill (fishing) as that has a few more parts to do with GSN's that a command doesnt.

1. Write the code for fishing skill, Will leave this upto you for now, if you cannot get it to work, post what you have and i will help you from there.

2. Add entries in tables.c there are 2 massive tables, where everything is ment to be in alphabetical order. You need to add entries that are the same as below, where do_fish replace do_fixed.

if ( !str_cmp( name, "do_fixed" ))
        return do_fixed;
AND..... further down
if ( skill == do_fixed )
    return "do_fixed";


IN mud.h you have this to add.

DECLARE_DO_FUN( do_fixed	);
and for the gsn(global skill number)
extern	sh_int	gsn_fixed


Next part goes in db.c

sh_int			gsn_fixed;


Lastly we know that our coding skills are the best, and it all compiles cleanly, the mud starts up and there is no crash(Tm), we sset the command in if we are suckers for punishment, or we open skills.dat and add in somthing that looks like this,

#SKILL
Name         fish~
Type         Skill
Info         0
Flags        0
Minpos       110
Slot         550
Rounds       8
Code         do_fish
Dammsg       ~
Misschar     You are a tops fisher person.~
Minlevel     1
End

I think that just about covers it all, hope that helps some.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #13 on Sun 10 Apr 2005 07:01 PM (UTC)

Amended on Sun 10 Apr 2005 07:38 PM (UTC) by Longbow

Message
Ok, I don't understand the commands for adding the code for a new skill. I'm quite willing to try it myself but I don't know how to check if I'm in a room where you can fish or how to check the bait on my pole or your skill or anything. Could somebody give me a list of commands for writing code?

Also, does anyone know how to change the desc color in room descs? And what kind of food CAN you cook, it says you can only cook certain types of food.

Thanks for your patience, I really wish I knew some coding skills but I'm picking up a bit.



Godbless,
Longbow
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #14 on Mon 11 Apr 2005 02:20 AM (UTC)
Message
Ok, I went and examined my do_skin bit, and I found that there wasn't a skill even using it, so no wonder it never worked. So I made a new skill(following the steps of Kevin London's tutorial, http://www.cs.utk.edu/~london/smaug/SMAUGDOC.html#spells)
I assigned the do_skin command to the skill, but it still says the same thing: "huh?"
HUH? WHY DOES IT SAY HUH? I killed a deer(npc) and typed skin corpse, and it says "huh?".

Here's my do_skin code:

void do_skin( CHAR_DATA *ch, char *argument)
{
OBJ_DATA *korps;
OBJ_DATA *corpse;
OBJ_DATA *obj;
OBJ_DATA *skin;
bool found;
char *name;
char buf[MAX_STRING_LENGTH];
found = FALSE;

if ( !IS_PKILL(ch) && !IS_IMMORTAL(ch) )
{
send_to_char( "Leave the hideous defilings to the killers!\n", ch );
return;
}
if ( argument[0] == '\0' )
{
send_to_char( "Whose corpse do you wish to skin?\n\r", ch );
return;
}
if ( (corpse=get_obj_here(ch, argument)) == NULL )
{
send_to_char( "You cannot find that here.\n\r", ch );
return;
}
if ( (obj=get_eq_char(ch, WEAR_WIELD)) == NULL )
{
send_to_char( "You have no weapon with which to perform this deed.\n\r", ch );
return;
}
if ( corpse->item_type != ITEM_CORPSE_NPC )
{
send_to_char( "You can only skin the bodies of player characters.\n\r", ch);
return;
}
if ( obj->value[3] != 1
&& obj->value[3] != 2
&& obj->value[3] != 3
&& obj->value[3] != 11 )
{
send_to_char( "There is nothing you can do with this corpse.\n\r", ch );
return;
}
if ( get_obj_index( OBJ_VNUM_SKIN ) == NULL )
{
bug( "Vnum 23 (OBJ_VNUM_SKIN) not found for do_skin!", 0);
return;
}
korps = create_object( get_obj_index(OBJ_VNUM_CORPSE_PC), 0 );
skin = create_object( get_obj_index(OBJ_VNUM_SKIN), 0 );
name = IS_NPC(ch) ? korps->short_descr : corpse->short_descr;
sprintf( buf, skin->short_descr, name );
STRFREE( skin->short_descr );
skin->short_descr = STRALLOC( buf );
sprintf( buf, skin->description, name );
STRFREE( skin->description );
skin->description = STRALLOC( buf );
act( AT_BLOOD, "$n strips the skin from $p.", ch, corpse, NULL, TO_ROOM);
act( AT_BLOOD, "You strip the skin from $p.", ch, corpse, NULL, TO_CHAR);
/* act( AT_MAGIC, "\nThe skinless corpse is dragged through the ground by a strange force...", ch, corpse, NULL, TO_CHAR);
act( AT_MAGIC, "\nThe skinless corpse is dragged through the ground by a strange force...", ch, corpse, NULL, TO_ROOM);
extract_obj( corpse ); */
obj_to_char( skin, ch );
return;
}


Thanks and Godbless,
Longbow
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


40,798 views.

This is page 1, subject is 6 pages long: 1 2  3  4  5  6  [Next page]

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]