Sunday, July 6, 2008

Snippet Summary

Here is a summary of all the published snippets.
Click here to return to the main page.


Room Affects:

Allows you to add affects to rooms, like hp, mpdamage, and so on. Players who enter the room will gain those stats. Technically, stock SMAUG already has this feature, but it's badly broken and shouldn't be used. This snippet fixes it.

MPREDIT:

The MPREDIT command allows mobs to modify a room. It's similar to mposet and mpmset. This makes it possible for a mobprog to do things like flood a room with water, change a room's description and name in realtime, modify a room's tunnel size, and so on.

Loot Command:

For pkill, a command for corpse-looting. It has four modes: random, specific, both, or disabled. The modes can be changed without rebooting the MUD, using the cset command. In random mode, the command will loot three random items. In specific mode, the looter can choose one item to loot. In both mode, the looter can choose to loot three random or one specific.

Improved Ventriloquism:

An improvement to the ventriloquism spell. Significantly upgrades the spell.

Improved Mpdamage:

A major improvement to the mpdamage command. Old mpdamage syntax will still work, so old progs will still work fine, but many new options are enabled which really bring mpdamage to life. Now when the message says the mob breathes fire at the player, the damage can actually be fire-elemental!

Improved Detect Poison:

A total overhaul of the detect poison spell.

Extra Identify Strings:

Add custom extra lines to an item's "identify" (and auction) display. This lets you put fake stats on an item, historical notes, indicate a special property the item has, or anything.

Elemental Items:

Isn't it odd how a mob can be susceptible to fire, yet still take normal damage from "a flaming lance"? Elemental items fixes that, letting you add elements to weapons, causing their damage to be of that element (in addition to being piercing/slashing/blunt/whatever). Other items can also have elements added, see the file for specific effects.

Doom:

Kind of a beefed up version of "curse". When a victim is doomed, the very fates conspire against him. The worst things suddenly tend to go wrong at the worst possible time. Very fun and evil.


Return to main page

Room Affects: How to make a room affect hitpoints, damroll, etc.

The bare bones room affect system SMAUG comes with is unfinished and extremely dangerous to use. This snippet fixes it up and brings it up to par with all SMAUG's other robust features.

"But what's a room affect?" It's like an object affect, but on a room. Say you want everyone in your room to get +2 damroll. You simply type: "redit affect damroll 2".

I set the saving up in a way so that you can put as many room affects as you want in an area, and, assuming everything else is standard, it will still load fine on a stock SMAUG MUD without this snippet (although without the room affects). (It was necessary to add a saving feature because the bare bones room affects which come with SMAUG don't even save)

DOWNLOAD THE ROOM AFFECTS SNIPPET

MPREDIT: Finally, a room version of MPMSET and MPOSET. (Or: How to let mobs edit rooms)

DESCRIPTION:
Creates a new mobprog command, MPREDIT. This allows mobs to edit
rooms, similar to MPMSET and MPOSET. It is set up so that if a
builder saves an area, changes done by MPREDIT will not be saved.

TESTING:
This has been fairly rigorously tested, but has changed slightly in the
conversion to stock SMAUG.

KNOWN PROBLEMS/BUGS:
Stock SMAUG's room affect code is buggy. One of the things mpredit can
do is manipulate room affects. I've posted snippets at mudbytes.net and
fussproject.org which fix the room affect bugs. If you don't want to
install them, then it's probably a good idea not to use mpredit to manipulate
room affects (nor manipulate them with regular redit either).
If you don't have any idea what room affects are, and don't plan on making
mobs mess with them, then this is a non-issue.

IN-GAME MECHANICS:
The syntax of the mpcommand are as follows.

mpredit affect (affect): add a room affect
mpredit rmaffect #: remove a room affect
mpredit bexit (dir) [destination]: create (or remove) an exit and its reverse
mpredit description (text): set the room description
mpredit description +(text): add to the room description
mpredit description clear: clear the room description
mpredit ed (keyword) (text): add or modify an extradescription
mpredit ed (keyword) +(text): add text to an extradescription
mpredit rmed (keyword): remove an extradescription
mpredit exkey (dir) (key): set an exit's key
mpredit exname (dir) (name): set an exit's name
mpredit exdesc (dir) (text): set an exit's description
mpredit exflags (dir) (flags): toggle exit flags
mpredit exit (dir) [destination]: create (or remove) an exit.
mpredit flags (roomflags): toggle room flags
mpredit name (name): change room's name
mpredit pull (dir) #: set the strength of an exit's pull
mpredit push (dir) #: set the strength of an exit's push
mpredit revert: return room to its original state before any mpredits took place
mpredit sector #: change the room's sector type (Water traps!!!:)
mpredit tunnel #: change the room's tunnel size
mpredit teledelay #: change the room's teleport delay
mpredit televnum #: change the room's teleport destination

The snippet also installs an imm command "unmpredit" which is the same as
"mpredit revert". Also it adds support for the "rstat" command to tell an
imm when a room is under the effects of mpredit. An imm can type "rstat mpredit"
to see a list of exactly what those changes are.

DOWNLOAD THE MPREDIT COMMAND SNIPPET

Loot Command: A pkill command for looting corpses, customizable through cset

One of my earlier snippets, this creates a "loot" command for pkillers. What distinguishes it from other snippets of this type is it guides you through adding a cset option so that high level imms can use cset to adjust which loot option to use: "random" to let people loot 3 randomized items, "single" to let people loot 1 specified item, "both" to enable both, "none" to disable looting altogether.

Syntax: loot (loot 3 random items from a random lootable corpse, if random is enabled)
Syntax: loot (loot 3 items from corpse, if random is enabled)
Syntax: loot (attempt to loot a specific item from a random lootable corpse, if enabled)
Syntax: loot (like "get", if enabled)

Since pkill is an area which is so sensitive to details, I doubt this will catch on very wildly, however, when I wrote the snippet, I did it with extremely verbose explanations of each step, so maybe newbie coders will be able to benefit from it.

DOWNLOAD THE LOOT COMMAND SNIPPET

Improved Ventriloquate Spell: Bring ventriloquism to life

An upgrade for the ventriloquate spell. Some of the changes include...

- If the target can be identified as a specific person or mob, the verbs are changed appropriately.
For instance:
Someone makes the Grand Sultan proclaim 'Dang ventriloquists!'.
Someone makes the fountain gurgle 'Don't drink me!'.

- Ventriloquate takes silent rooms and silenced players into account

- Imms can see who the ventriloquist is

- Better handling of silly targets like "me", "you", and the famous " ' ' "

- And more!

DOWNLOAD THE IMPROVED VENTRILOQUATE CODE SNIPPET

Improved MPDAMAGE: Make your battle progs super elite

This snippet will inject pure liquid steroids into your SMAUG's mpdamage command. Best of all, you can now make mpdamage generate a real damage message, like "The mage's unique mystical attack _maims_ you!", where you just specify the name of the attack (in this case "unique mystical attack").

EXAMPLES:
mpdamage $n 100 fire
-- Does 100 damage to $n, of type "fire"

mpdamage $n 100 head
-- Does 100 damage to $n, and aims for the head

mpdamage $n 100 fire head
-- Does 100 fire damage to $n's head

mpdamage $n 100 !spinning blade!
-- Does 100 damage and generates a damage message, like
"The ninja's spinning blade wounds you!"

mpdamage $n 500 fire !dark flame of doom!
-- Does 500 fire damage and generates a damage message, like
"The archmage's dark flame of doom _maims_ you!"

mpdamage $n 100 fire cold
-- Does 100 damage, with 50% probability of fire, 50% of cold

mpdamage $n 100 fire fire cold
-- Does 100 damage, with 66% probability of fire, 33% of cold

mpdamage $n 100 body body head
-- Does 100 damage, with 66% probability of hitting body, 33%
of hitting head

DOWNLOAD THE MPDAMAGE UPGRADE CODE SNIPPET

Upgraded Detect Poison: Enhance your MUD's "detect poison" spell and make it actually useful

In SMAUG, I noticed that players very rarely (if ever) used the "detect poison" spell. Out of the box, detect poison is a very barebones spell without much use. So I upgraded the hell out of it, and now you can have the upgraded version too.

Here's an exhaustive list of changes this does.
- Works on all items, not just edibles.
- Appropriate special message for casting detect poison on
the black poison powder object used for poisoning weaps.
- Detects if a drinkcon is empty
- Detects alcoholic beverage and responds humorously.
- Detects rotting food, warns of food poisoning
- Takes cooking code into account
- For pills/potions/salves, checks whether one of the spells
case is poison, sleep, curse, blindness, gas breath, or
chill touch. Responds accordingly.
- Checks if a weapon is poisoned.
- For weapons, armor, lights, staves, and wands, checks
to see if, when worn, the item has poison/curse/sleep as
an effect.
- Appropriate reply when cast on blood or quills
- When cast on NPC corpse, check if the mob was poisonous
while it lived.
- When cast on a container, count the number of poison
objects inside.
- Detects poison-themed traps.

DOWNLOAD THE DETECT POISON UPGRADE SNIPPET

Identify Strings: Add custom lines to identified items on SMAUG!

This snippet allows builders to add extra lines to an item's
diagnosis on "identify" and "auction". This is quite nice for
cases where a prog has been used to similate a flag which
doesn't exist, for example, if an item is made to reject males
from wearing it, you could add a line:
"This item cannot be equipped by males."
You can even use this to add fake stat lines:
"Affects hitpoints by 25,000. (Just Kidding!)"
Another fun use is to add in-character notes on the item,
"An old prophecy states this sword will slay the evil wizard."

Use oset to add extra idstrings:
oset raft idstring Ahh, the raft of Captain Sparrow!

You can optionally put color in the custom idstring
using the usual color tokens.

Use "oset rmidstring (number)" to remove an idstring.

DOWNLOAD THE EXTRA IDENTIFY STRINGS CODE SNIPPET

Elemental Items: Make fancier, shinier, fierier weapons on SMAUG

This code snippet adds support for elemental items in the SMAUG codebase. This mainly effects weapons and armors. When a fighter uses a non-elemental weapon, his attacks are influenced by his opponent's resistance/susceptibility/immunity just to the weapon's type: slash, pierce, etc. If the weapon is elemental, the attacks are then also influenced by his opponent's res/susc/immunity to the element. For example, a fire elemental sword will do no damage to an enemy who is immune to fire, even if the enemy is susceptible to swords. Thus an elemental weapon can be stronger than a non- elemental weapon against appropriate foes, but it is a very specialized tool, and in most cases is actually weaker, since enemies tend to have more resistances than susceptibility.

Elemental armor is more likely to be damaged and scrapped by attacks from weapons of the opposite element, and less likely to be damaged and scrapped by attacks from weapons of the same element.

Additionally, fire elemental items can be instantly destroyed by the "frost breath" spell, and cold elemental items can be instantly destroyed by the "fire breath" spell. This depends upon the victim's saving spell vs. breath. Fire items, cold items, and acid items are immune to destruction from fire breath, frost breath, and acid breath, respectively.

DOWNLOAD THE ELEMENTAL ITEMS SNIPPET

Doom: A new affect type, like Curse but on steroids

The idea for the "doom" affect type comes from Thomas Biskup's roguelike Ancient Domains of Mystery. In that game, it's possible for a player to become "doomed" by doing various things like insulting the gods, eating a cute puppy corpse, and so on. Once doomed, all hell breaks loose. It's much worse than the simple "-2 hitroll, can't recall" of a normal curse. It actually causes the fates to conspire against the player, and I attempt to reflect that in this code snippet. It does things like, try to make the player flee in the worst possible direction, try to make equipment damage be as bad as possible, and so on. Its in-battle effects are not a flat formula, but are dynamic so they come up at the worst time: the player's defenses are almost unaffected when the player's at full health, but when the player's at low health, suddenly the doom starts interfering a lot more.

DOWNLOAD THE DOOM CODE SNIPPET