Area Building

· Home
· Overview
· Helps
· Mobiles
· Objects
· Rooms
· Resets

· Shops
· Specials
· Time
· Weather
· Scripts


Examples

Here are some examples of some scripts you may find useful

Mob Scirpts

Here are some of the scripts on Barliman

@action p falls out of a second-story window!~
{
 mpechoat $n {{Y**OOOMPH!**{{w You fall out of a second-story window!
 mpechoat $n You hit your head HARD!!
 mpechoaround $n $n.persname hits $n.s head HARD!!
 mpforce $n sleep
} ~

@action p goes to sleep.~
{
 if (@cansee($i, $n) and $n.room.vnum == 11700) {
  if (@ispc($n)) {
   if ($n.class == "cleric") {
    say Awwwww! The poor cleric fell asleep ...
    emote tosses $n over his shoulder and heads inside the inn.
   }
   else if ($n.class == "thief") {
    say What a thief! Probably too drunk to find a bed....
    emote drags $n by the feet into the inn.
   }
   else if ($n.class == "warrior") {
    say What a dumb warrior! Sleeping in the road!
    emote drags $n by the feet into the inn.
   }
   else {
    say Geez! Casting spells must be tiring!
    emote grabs $n by $n.s cloak and heads inside the inn.
   }
   mptransfer $n 11702
   mpat 11702 emote trots in, drops $n, and trots back out.
   emote arrives from the inn, chuckling.
  }
 }
}
~
|

Don't forget, after the last script on a mob, object, or room, you MUST put that pipe in there '|' otherwise the mud keeps looking for more scripts.

--------

This room script causes fire damage to players not flying or wearing protective boots. Because the target is $r, it randomly selects a victim.

#4628
The Chambers of Fire~
Groaning, rumbling, trembling, this volcano is disturbed and in constant
flux. Passages open and close apparently at random; the very ground at your
feet is in motion. The heat is intense. You barely have enough strength to
move--and everywhere different ranks of fire demons and other fell creatures
and spirits of the mountain swirl in delicious, incandescent joy....
~
0 DN 11
(Exits removed for space)
@rand 5~
{
if ($r and @ispc($r)) {
if (@isaffected($r, T)) {
echoat $r Flames tickle the soles of your flying feet, but don't harm you.
}
else
if (@iswearing($r, 4423)) {
echoat $r Flames lick up your boots, but don't harm you.
}
else {
damage $r 8 9 4 '{{RHEAT{{w' '{{wThe lava'
}
}
}
~
|

This object script creates a rechargeable ring that upon command damages a player's opponent.

#5255
ring magic missiles~
a ring of magic missiles~
A small reddish ring lies here.~
gold~
9 AG AB
3 3 3 2 0
5 1 1000 P
E
ring magic missiles~
Etched inside the ring in tiny gold script:
<
When in battle, {{RFire!{{w
~
@init
{
declare global persistent $ringcharge number
$ringcharge = 3;
declare global persistent $ringcounter number
$ringcounter = 0;
}
~
@speech P Fire!~
{
if (@ispc($n) and $i.carried_by == $n) {
  if ($i.wear_loc == 1) {
    if (@isfighting($n)) {
      if ($ringcharge > 0) {
      damage $n.opponent 4 5 11 'ring of magic missiles' '$n.name'
      $ringcharge = @add($ringcharge,-1);
        if ($ringcharge == 0) {
          if (@isset($i.extra_flags, A)) {
          set obj $i.id extra glow
          echoat $n {{yYour ring of magic missiles stops glowing.{{w
}
}
}
else {
  if ($ringcharge == 0) {
  echoat $n {{WYour ring of magic missiles sputters and sparks.{{w
  echoaround '{{WSparks fly from the hand of $n.name!{{w' $n
}
}
}
}
}
}
~
@time~
{
if ($ringcounter == 10) {
  if ($i.wear_loc == 1) {
    if ($i.carried_by) {
    $ringcharge = 3;
    $ringcounter = 0;
      if (@isset($i.extra_flags, A)) {
      } else {
        set obj $i.id extra glow
        echoat $i.carried_by {{YYour ring of magic missiles glows.{{w
}
}
}
}
 else {
   if ($ringcharge == 0) {
     if ($i.wear_loc == 1) {
     $ringcounter = @add($ringcounter,1);
}
}
}
}
~
@wear~
{
if (@ispc($n) and $i.carried_by == $n) {
if ($n.level > 15) {
echoat $n Your ring of magic missiles burns your finger!
echoat $n Your ring of magic missiles EXPLODES!
echoaround 'A ring on the finger of $n.name EXPLODES!' $n
damage $n 6 6 11 'EXPLOSION' 'A ring'
purge self
}
else {
  if ($i.wear_loc == 2) {
  jump
  echoat $n A ring of magic missiles slips off your right finger and falls.
  echoaround 'A ring of magic missiles slips off $n.s right finger and falls.' $n
}
}
}
}
~
|

Gotta love those green monkeys!

#11739
green monkey~
a green monkey~
A mischievous green monkey is here.
~
A mischievous green monkey is fooling around here... running in circles and
grinning.  You wonder what mischief it will be up to next.
~
fido~
CGHU 0 -200 S
2 0 1d6+14 1d1+99 1d4+0 10
8 8 8 8
0 0 0 0
8 8 3 0
0 0 S 0
M
$n scampers $T searching for bananas.~
$n swings in $T.~
@init_type
{
  declare global $gmk person
}
~
@death 100~
{
  if (@ispc($n)) {
    $gmk = $n;
  }
}
~
@rand 5~
{
  if ($r) {
    if (@rand(1,100) > 50) {
      laces $r
      inn
    }
    else {
      emote screeches and jumps up and down in excitement.
      pinch $r
    }
  }
}
~
@greet 100~
{
 if (@cansee($i,$n)) {
   if ($n == $gmk) {
     mpechoat $n $i.persname screeches in fright and throws an apple at you!
     mpechoaround $n $i.persname screeches in fright and throws an apple at $n.persname!
     if (@rand(1,2) < 2) {
       n
       e
     }
     else {
       w
       s
     }
   }
   else if (@rand(1,10) < 2) {
     if (@rand(1,100) > 50) {
       laces $n
       inn
     }
     else {
       emote screeches and jumps up and down in excitement.
       pinch $n
     }
   }
 }
}
~
@give banana~
{
 eat banana
 emote happily screeches and scampers off to tell his friends.
 mptransfer monkey
 mptransfer 2.monkey
 mpmload 11739
 mpecho With lots of happy loud screeching, a horde of monkeys storm in.
}
~
|

This object script creates a weapon that levels as its owner levels. It can be used only by the first person who wields it. To interpret it, look at the formula in the Weapons section of the Object document and solve for Y.

|#18004
flicker flame sword fire~
a flicker of flame~
A small fire dances here.~
steel~
5 G AN
1 2 4 29 0
1 5 100 P
@init
{
declare global persistent $player string
$player = "default";
}
~
@wear~
 {
 if (@ispc($n) and $i.carried_by == $n and $i.wear_loc == 16) {
 if ($player == "default" or $player == "$n.name") {
  declare $level number
  declare $twicen number
  declare $twicensubx number
  declare $half number
  declare $average number
  declare $solvey number
  $level = $n.level;
  set obj $i.id level $level
  $half = @divide($level,2);
  $average = @add($half,4);
  $twicen = @multiply(2, $average);
  $twicensubx = @subtract($twicen, 2);
  $solvey = @divide($twicensubx,2);
  set obj $i.id v1 2
  set obj $i.id v2 $solvey
  if ($player == "default") {
    $player = "$n.name";
    string obj $i.id name sword fire
    string obj $i.id short $n.name's Sword of Fire
    string obj $i.id long $n.name's Sword of Fire burns with a hard, gem-like flame.
    echoat $n A flicker of flame bonds with you!
    say A flicker of flame transforms into $n.name's Sword of Fire!
  }
 }
 else {
  say $i.short_descr leaps out of $n.name's hands!
  jump
 }
 }
 ~
|