The only problem with the variables is that the secondary object and the secondary target are passed by act() in the same location. This means that if you reference $t in an A puts B in C situation, the result will probably be a happy mud crash or some weird side effect, especially if $t is used in an if_check (i.e. if ISNPC $t in the above situation) The basic fix for this is to change everyone who calls the act() procedure to specify a secondary object and a secondary character. But that is a fairly comprehensive trivial twiddle, so we left it the way it is so that, you aren’t forced to make all those twiddles to use the MOBprograms.
ISVIOLENT if_check:
Is the player violent??
-=====-
Syntax:
if ISVIOLENT $n
shake $n
say You are too riled up to come in here $N.
else
say Welcome $N!!
mob transfer $N
endif
NOTE: This is useful for clans (escort), for prisons etc.
MOBHERE if_check:
This check is simple, Is a certain mob here?
-=====-
Syntax:
if MOBHERE tarantula
mob force tarantula mob kill $n
else
say Damn, if my spider was here, you'd be toast $N.
endif
NOTE: You can interchange the name with a vnum to be more specific.
OBJHERE if_check:
This check is simple, Is a certain object here?
-=====-
Syntax:
if OJBHERE table
sit table
else
say Damn, did you take my table $R.
endif
NOTE: You can interchange the name with a vnum to be more specific.
PEOPLE if_check:
This check is a value comparison, are there argument PC’s + NPC’s here?
-=====-
Syntax:
if PEOPLE >= 5
say Wow, we're getting full in here.
else
say The place seems pretty deserted doesn't it $N?
endif
NOTE: You can be more specific with MOBS or PLAYERS checks, to determine numbers of PC’s or NPC’s.
PLAYERS if_check:
This check is a value comparison, are there argument players here?
-=====-
Syntax:
if PLAYERS >= 2
say Quite a few players here.
else
say You're the only player here $N.
endif
MOBS if_check:
This check is a value comparison, are there argument mobs here?
-=====-
Syntax:
if MOBS >= 2
say Quite a few mobs here $N.
say Why don't you kill some?
else
say Not very many mobs here $N.
endif
MOBEXISTS if_check:
This check is simple, is there a mob called/number argument in existance?
-=====-
Syntax:
if MOBEXISTS Julia
say You should go talk to Julia $N.
else
say Julia must not be around $N.
endif
OBJEXISTS if_check:
This check is simple, is there an object called/number argument in existance?
-=====-
Syntax:
if OBJEXISTS whitegold
say Sorry $N, you can't have one, someone already has a White Gold Ring.
else
say Oh sure, take my nice ring $N.
mob oload 1342134 0 none
give ring $n.
endif
CLONES if_check:
This check is a value comparison, are there argument of the same mob here?
-=====-
Syntax:
if clones >= 4
say More than four!
else
if clones == 3
say Exactly three, plus me!
else
if clones == 2
say Exactly two, plus me!
else
if clones == 1
say Just one clone of me!
else
if clones == 0
say Not just me!
else
say Just me!
endif
endif
endif
endif
endif
NOTE:
Clone can be used with the usual operators > < >= <= ==. It checks for clones of itself, so if clones == 1, means there is ONE mob JUST like it in the room, it’s clone. If clones can be used to check IN ROOM only. It’s useful for a guard loading more guards, but only if there are only say less than 8 in the room.
ORDER if_check:
This check is a value comparison, is victim the argument in line?
-=====-
Syntax:
if ORDER $n >= 2
say Why don't you ask your master $N?
else
say Ahh, you are the boss $N.
endif
NOTE: This one is useful for letting the mob only listen to the first person to come into the room, or to attack the person if they are second etc.
HOUR if_check:
This check is a value comparison, does the time >=< the argument?
-=====-
Syntax:
if HOUR >= 8
say Wow, it's past eight already.
else
say Sorry, I don't do squat until 8 am $N.
endif
NOTE: This check can be used to have the mob do certain things at certain times, like closeup shop, sell certain items at certain times (via mob oload etc). All sorts of uses.
ISACTIVE if_check:
This check is simple, is victim NOT sleeping?
-=====-
Syntax:
if ISACTIVE $i
say Hey, I'm awake already.
else
rest
stand
emote looks around with bleary eyes.
endif
NOTE: This check can be used to have the mob do certain things based on its position, like wake if it’s sleeping, or not attack if it has a grall etc.
LANGUAGE if_check:
This check is a value check, is victim’s language the same as the argument?
-=====-
Syntax:
if language $i goblin
say I'm speaking goblin, you fool you can't understand me.
else
say I'm uh, not speaking goblin!
endif
A good way to use this particular one is to check the target, then say something else, this simulates subterfuge. Or have the target ONLY accept the command in the language it wants!
IE:
If language $n silvanesti
say My greetings $n, that is the correct password.
MOB TRANS $n 1234
else
language silvantesti
say I only speak Silvanesti you uncouth heathen.
endif
POS if_check:
This check is a value check, is victim in the position argument?
-=====-
Syntax:
if POS $i fighting
say Hey, I'm kind of busy here $N, please come back later.
else
say Hey, I'm not fighting, wanna brawl $N?
endif
NOTE: This check can be used to have the mob do certain things based on its position, or check others, like ‘if pos $N fighting’ say Calm down $N! etc. Or if position $r sleeping, wake $r, say No sleeping $R!!
ISDELAY if_check:
This check is simple, does <actor> have a delay?
-=====-
Syntax:
if ISDELAY $i
say Sorry $N, I'm busy already.
else
mob remember $n
mob delay 20
endif
NOTE: This check is very useful for having mobs act out things via delay. It keeps them from changing the delay, or starting it over before they finish the first one. Also, other mobs can see if a certain mob is busy etc.
ISVISIBLE if_check:
This check is simple, is victim able to be seen by the mob?
-=====-
Syntax:
if ISVISIBLE $n
say I can seeeee you!
else
say Hey, who's there?
endif
NOTE: Useful for having mobs not try to do something with someone they can’t see.
HASTARGET if_check:
This check is simple, does <actor> have a target? ($q)
-=====-
Syntax:
if HASTARGET $i
say Hey, have you seen $Q $N?
else
say Hey, I'll remember you $N!
mob remember $n
endif
NOTE: This one is great for mobs checking first to see if they are already after someone etc.
ISTARGET if_check:
This check is simple, is victim the target of $i?
-=====-
Syntax:
if ISTARGET $n
say Hey, just the man I've been looking for $Q!
mob kill $Q
mob forget
else
say You're not who I'm looking for $N, I'm after $Q.
endif
NOTE: This one works with HASTARGET well to determine who the mob is after etc.
EXISTS if_check:
This check is simple, does $q exist?
-=====-
Syntax:
if EXISTS $q
mob at $q mob echoat $q Time to come home $Q.
mob at $q mob echoaround $q $I comes to take $Q home for dinner.
mob at $q mob transfer $q 12151
else
say My victim has left the game.
mob forget.
endif
NOTE: Useful for having mobs not error when looking for a target that has quit the game. You can also use it with a name of obj/mob etc.
AFFECTED if_check:
This check is a value check, is victim affected by argument?
-=====-
Syntax:
if AFFECTED $n fly
mob echo You float across the water.
else
mob echo You begin to drown in the pool!
mob damage $n 100 200 lethal
endif
NOTE: Can also be used to have the mob see if it is affected by spells etc.
IE.
if AFFECTED $i haste
break
else
eat pill
endif
ACT if_check:
This check is a check against the victim for how they act.
-=====-
Syntax:
if ACT $i warrior
flex
say I'm a tough warrior.
mob kill $n
else
say I'm much to wimpy to fight you $N.
endif
NOTE: This is useful if you are using the same mprog on a few mobs and want them to react differently depending on how thier ‘act’s are set.
OFF if_check:
This check is a check against the victim for what offensive behaviors
are set for them.
-=====-
Syntax:
if OFF $i dirtkick
emote looks at the ground.
dirt $n
else
say You know, I'd kick dirt on you if I could.
grumble
endif
NOTE: This is useful if you are using the same mprog on a few mobs and want them to react differently while fighting depending on how thier ‘OFF’s are set.
IMM if_check:
This check is a check against the victim what Immunities they have.
-=====-
Syntax:
if IMM $n magic
say Damnit, my magic can't harm you $N.
emote slashes at you with a dagger instead.
else
say Ha ha!
mob cast fireball $n
endif
NOTE: This works well for mobs fighting to not make the mistake of trying damage mobs/pc’s with things those mobs/PC’s are immune to. IE, IMM cold so the mob loads a different weapon that isn’t flagged cold, etc.
CARRIES if_check:
This check looks to see if the victim carries or wears the argument (vnum or
name)
-=====-
Syntax:
if CARRIES $n sword
say That's a nice sword you have there $N.
else
say You should go buy a sword.
endif
NOTE: This check only checks to see if they are equiped with or have the item in thier inventory. If it’s inside a container, it will not trigger (will do the else statement).
WEARS if_check:
This check looks to see if the victim wears(has equipped) the argument (vnum or
name)
-=====-
Syntax:
if WEARS $n holy symbol
bow $n
say Welcome to our humble sanctuary $N.
else
say You shouldn't be here $N.
mob force $N south
endif
NOTE: This check only checks to see if they are equiped the item. If it’s inside a container, or just in inventory, it will not trigger (will do the else statement).
HAS if_check:
This check looks to see if the victim carries,wears, or has the argument (vnum or name)
-=====-
Syntax:
if HAS $n dagger
if WEARS $n dagger
say That dagger looks real sharp $N.
else
say Your dagger would be better used in your hand $N.
mob force $n wear dagger
endif
else
say You should go buy a dagger $N.
endif
NOTE: This check checks to see if they are equiped with, have the item in thier inventory, or inside a container. Just flat out, do they ‘have’ one?
USES if_check:
This check looks to see if the victim is wearing the TYPE of argument.
-=====-
Syntax:
if USES $n light
say Not so dark is it $N?
else
say Nyyaaa, it's dark and you can't see me!
endif
NOTE: This check checks to see if they are EQUIPPED with a certain TYPE of object. Rather than the name or vnum of it, it looks for object type.
NAME if_check:
This check checks the name of an object/victim.
-====-
Syntax:
if NAME $o pie
say Yum, what a tasty pie!
eat pie
else
say Hey, this is an $O, I wanted a pie!
endif
NOTE: This check looks at the name of a victim or object, useful for personal rooms with a NAME check to make sure it’s the right person going in. Or an exact object they are looking for etc.
CLAN if_check:
This check checks the CLAN of the victim.
-=====-
Syntax:
if CLAN $n kot
salute $n
say Welcome home $N.
else
say Hey, you aren't a Knight of Takhisis!!
scream
mob kill $n
endif
NOTE: This check looks at the clan affiliation of the victim.
RACE if_check:
This check checks the RACE of the victim.
-=====-
Syntax:
if RACE $n gnome
grumble
say Wherehaveyoubeen$N?
else
say You aren't a gnome, want to see the flinger?
endif
NOTE: This check looks at the race of the victim.
CLASS if_check:
This check is simple. Is the player class of $N = the argument.
-=====-
Syntax:
if CLASS $n thief
say You are a thief, come on in and take my stuff!
else
say Whew, you aren't a thief, you had me worried $N.
endif
NOTE: Useful for training halls etc.
OBJTYPE if_check:
This check checks the type of object of the victim.
-=====-
Syntax:
if OBJTYPE $o food
say Thanks, I was very hungry!
eat $o
say Mmmm, that $O was delicious $N!
else
say This isn't food!
drop $o
emote hops around rubbing $k tummy.
endif
VNUM if_check:
This check checks the virtual number of the victim.
-=====-
Syntax:
if VNUM $i 12345
say I am a strong guard.
flex
else
say I am a ninny squire!
say I wish I was a guard.
endif
NOTE: This is useful if you wish to make a complex mprog for a few mobs, then have it so the mob’s own vnum determines what it does based on the prog.
HPCNT if_check:
This check checks the type of hit point percentage of the victim.
-=====-
Syntax:
if HPCNT $i >= 30
say Damn $N, you're kicking my ass!
else
say I'm not quite dead!
endif
NOTE: Useful for making mobs flee, or bring in reinforcements. Combine with a if POS $n/$i fighting, for an effective program.
ROOM if_check:
This check checks the virtual number of the room the victim is in.
-=====-
Syntax:
if ROOM $i == 12345
say I am standing in the East Wing.
push $n west
else
if ROOM $i == 12346
say I am standing in the West Wing.
push $n east
else
say I'm not in my room.
sniff
endif
endif
NOTE: This is useful if you wish to make a complex mprog for a few rooms, then have it so the mob’s room determines what it does based on the prog.
SEX if_check:
This check checks the sex of the victim.
-=====-
Syntax:
(1 is male, 2 is female, 0 is 'IT')
if SEX $n == 1
say Hey there big boy.
else
if SEX $n == 2
say Hey there hot mamma.
else
say Oh my god!
say You're an IT!!!!
endif
endif
NOTE: Sex check, works well for different actions based upon sex of the PC.
LEVEL if_check:
This check checks the level or level range of the victim.
-=====-
Syntax:
if LEVEL $n >= 5
say You're sure getting up there in levels $N.
else
say You need to go level $N!
endif
ALIGN if_check:
This is a value comparison. The program checks the alignment number of the
victim.
-=====-
Syntax:
if ALIGN $n >= 0
say You aren't so bad.
else
say You aren't so good.
endif
NOTE: This check is more specific than the ISGOOD/EVIL/NEUTRAL check, allowing you to select exact numbers other than -333 0 and 333.
MONEY if_check:
This is a value comparison. The program checks the combined money of the victim.
-=====-
Syntax:
if MONEY $i >= 300
say I'm pretty rich
else
say Dang, I dont have much money.
emote Opens a safe.
mob oload 12314 0 room
get coins
say Now I'm rich!
endif
NOTE: This check can be used to see if players have enough cash to pay for something, before they attempt it. Or give the mobs more cash etc.
OBJVAL0-4 if_check:
This is a value comparison. The program checks the value of the object.
-=====-
Syntax:
if OBJVAL $o >= 300
say This is quite nice.
else
say This is a piece of junk.
say Who would want a $O?
endif
GRPSIZE if_check:
This is a value comparison. The program checks the group size of the victim.
-=====-
Syntax:
if GRPSIZE $n >= 7
say Hello there your lordship.
else
say Hehe, you don't look so tough.
mob kill $n
endif
NOTE: This check can be used to have the mob estimate a group size, either it’s own group (and load more mobs), or the victims group, and fight (or not fight, or load more mobs ;p).
STATUS if_check
MOB STATUS [int] STATUS lets you check mobiles different states,
this is simply an integar you attach to them, and can check on them.
-=====-
Syntax:
if STATUS $i == 0
say My status is 0, going to 1
MOB STATUS 1
end // We add these END to stop it from continuing
//as mob status would be 1 after this and trigger more
endif
if STATUS $i == 1
say My STATUS is 1, going to 2
MOB STATUS 2
end
endif
if STATUS $i == 2
say My STATUS is 2, going to 0
MOB STATUS 0
end
endif
end
Operators
Most of the basic numeric operators are legal and perform the same
function as in C.
Operators:
==
is equal to
!=
is NOT equal to
>
is greater than
<
is less than
>=
is greater than or equal to
<=
is less than or equal to
If_Checks In Control Flow (Summary)
The provided list of if_checks and their arguments are below. They
should all be fairly obvious in what they do, but some of the more obtuse
deserve a slight explanation. Any '==' operator can be replaced with any of
the available ones described above. The argument $* refers to any of the
variables which make sense for that if_check (i.e. for an if_check which is
referencing a person the only valid variables would be $i, $n, $t, $r or $q)
A value type of string is a sequence of characters. It does not need to be
included in quotes or anything like that (i.e. if name $n fido )
There are five types of if checks:
Type 1 : Keyword /value Explanation
rand num - Is random percentage less than or equal to num
mobhere vnum - Is a NPC with this vnum in the room
mobhere name - Is a NPC with this name in the room
objhere vnum - Is an object with this vnum in the room
objhere name - Is an object with this name in the room
mobexists name - Does NPC 'name' exist somewhere in the world
objexists name - Does object 'name' exist somewhere in the world
Type 2 : Keyword /compare /value Explanation
people == integer - Is the number of people in the room equal to integer
players == integer - Is the number of PCs in the room equal to integer
mobs == integer - Is the number of NPCs in the room equal to integer
clones == integer - Is the number of NPCs in the room with the same
vnum as the NPC who activated the program equal
to integer
order == integer - Is the order (of several similar NPCs) of the NPC
who activated the trigger equal to integer
hour == integer - Is the hour (game time) equal to integer
Type 3 : Keyword /actor Explanation
isnpc $* - Is $* an NPC
ispc $* - Is $* a PC
isgood $* - Does $* have a good alignment
isneutral $* - Does $* have a neutral alignment
isevil $* - Does $* have an evil alignment
isimmort $* - Is $* an immortal (level of $* > LEVEL_HERO)
ischarm $* - Is $* affected by charm
isfollow $* - Is $* a follower with their master in the room
isactive $* - Is $*'s position > POS_SLEEPING
isdelay $* - Does $* have a delayed MOB PROGRAM pending
isvisible $* - Is $* visible to NPC who activated the program
hastarget $* - Does $* have a MOB PROGRAM target in the room
istarget $* - Is $* the target of NPC who activated the program
Type 4 : Keyword /actor /value Explanation
affected $* 'affect' - Is $* affected by 'affect'
act $* 'act' - Is $*'s ACT bit 'act' set
off $* 'off' - Is $*'s OFF bit 'off' set
imm $* 'imm' - Is $*'s IMM bit 'imm' set
carries $* 'name' - Is $* carrying object 'name'
wears $* 'name' - Is $* wearing object 'name'
has $* 'type' - Does $* have object of item_type 'type'
uses $* 'type' - Is $* wearing object of item_type 'type'
name $* 'name' - Is $*'s name 'name'
pos $* 'position' - Is $*'s position 'position' (sleeping etc.)
clan $* 'name' - Does $* belong to clan 'name'
race $* 'name' - Is $* of race 'name'
class $* 'name' - Is $*'s class 'name'
objtype $* 'type' - Is $*'s item_type 'type'
Type 5 : Keyword , actor , comparison and value
vnum $* == integer - Is $*'s virtual number equal to integer
hpcnt $* == integer - Is $*'s hitpoint percentage equal to integer
room $* == integer - Is vnum of the room $* is in equal to integer
sex $* == integer - Is $*'s sex equal to integer
level $* == integer - Is $*'s level equal to integer
align $* == integer - Is $*'s alignment equal to integer
money $* == integer - Does $* have money (in gold) equal to integer
objval# $* == integer - Is $*->value[#] equal to integer (# from 0-4)
Mob Command List
Each MOBcommand must be preceeded by "MOB"
For Example:
MOB ECHOAT $n [string]
MOB Command argument_list Explanation
MLOAD (mobile) – Lets the mobile load another mobile.
OLOAD (obj vnum) (level) (location) – Lets the mobile load an object
2ND ARGUMENT
# – the level to load the object at
Use 0 if you wish to continue building.
3RD ARGUMENT
None – inventory
R – in room (can also use Room)
W – on mob (must be hold/wearable)
KILL (victim) – Lets the mobile kill any player or mobile
without murder
PEACE – Stops all fighting in that room
ASSIST (victim) – Lets the mobile assist another mob or player
MPDUMP 1234 – Displays the source code of a given MOB PROGRAM
ECHO (text_string) – Prints the message to the room at large
ECHOAT (victim) [string] – Prints the message to only the victim
ECHOAROUND (victim) [string] – Prints the message to everyone in the room other
VECHO (room vnum> [string] – Echo a string at a specific room
MVECHO (vnum vnum> [string] – Echo a string at a specific RANGE of rooms
GECHO (text_string) – Prints the argument to all active players
ZECHO (text_string) – Prints the argument to all players in the
same area as the mob
ASOUND (text_string) – Prints the argument to all the rooms around the mobile
than the mob and victim
PURGE (target) – Lets the mobile purge all objects and other
npcs in the room, or purge a specified object
or mob in the room. The mobile can
purge itself, but it must be the last command.
GOTO (dest) – Lets the mobile goto any location it wishes
that is not private.
AT (location) [commands] – Lets the mobile do a command at another location.
TRANSFER (target|’all’) [location]- Lets the mobile transfer people. The ‘all’
argument transfers everyone in the current
room to the specified location
(room vnum or mobile name)
SLIP (target|’all’) [location]- Lets the mobile slip people. The ‘all’
argument transfers everyone in the current
room to the specified location
(room vnum or mobile name)
NOTE: This is a transfer, but there is no
‘look’ so the PC won’t know it happened.
GRTRANSFER (victim) [location] – Lets the mobile transfer all chars in same group
as the victim.
OTRANSFER (item name) [location] – Lets the mobile to transfer an object. The object
must be in the same room with the mobile.
REMOVE (victim) [object vnum|’all’]- Lets the mobile to strip an object or all objects
from the victim. Useful for removing e.g.
quest objects from a character.
JUNK (object) – Lets the mobile destroy an object in
its inventory
– it can also destroy a worn object and
it can destroy items using all.xxxxx
or just plain all of them
FORCE (victim) [commands] – Lets the mobile force someone to do something.
Must be mortal level and the all argument only
affects those in the room with the mobile.
GFORCE (victim) [commands] – Lets the mobile force a group something. Must be
mortal level.
VFORCE 1234 [commands] – Forces all mobiles of certain vnum to do something
CAST (spell) [target] – Lets the mobile cast spells —
Beware: this does only crude checking on the target
validity and does not account for mana etc., so
you should do all the necessary checking in your
mob program before issuing this cmd!
DAMAGE (victim) [min] [max] (kill)- Lets mob cause unconditional damage to someone.
Nasty, use with caution. Also, this is silent, you must show your own damage message. If kill parameter is omitted, this command is “safe” and will not kill the victim. REMEMBER (victim) – Lets the mobile to remember a target. The target can
be referred to with $q and $Q codes in MOBprograms. See also “mob forget”.
FORGET (victim) – Reverse of “mob remember”.
DELAY (pulses) – Sets a delay for MOB PROGRAM execution. When the delay time expires, the mobile is checked for a mob program with DELAY trigger, and if one is
found, it is executed. Delay is counted in PULSE_MOBILE
CANCEL – Reverse of “mob delay”, deactivates the timer.
CALL [vnum] [victim|’null’] [object1|’null’] [object2|’null’] – Lets the mobile to call another MOB PROGRAM withing a MOB PROGRAM. This is a crude way to implement subroutines/functions. Beware of nested loops and unwanted triggerings… Stack usage might be a problem. Characters and objects referred to must be in the same room with the mobile.
FLEE – Forces the mobile to flee.
STATUS – An integar the mob can set/change on itself.
PORTALTO (vnum to) (portal used)- This command let’s a mob create a portal
between the room it’s in, and the room you specify (if you specify a portal then it uses THAT one, so you can use a specific gangplank, door etc).
CREATE – Used to create random objects, amounts of money or gems as rewards for quests.
GOTORESET No argument used, this will take the mob back to
the room that it loaded in, it’s reset room.
MOBcommands are special commands that allow mobiles to perform
immortal-like actions within a MOB PROGRAM (transferring players
or loading items, for example). Most MOBcommands them are wiz
commands which have been changed to allow for mobiles to perform
the commands. In this version of MOBprograms, players have been
prevented from using these commands by adding a separate
interpreter for MOBcommands. This also speeds up (in most cases)
MOB PROGRAM execution when MOBcommands are used. All MOBcommands
are preceded with the word ‘MOB’ on the command line.
MOB STATUS [int]
NOTE:
STATUS lets you put mobiles in different states, this is
simply an integar you attach to them, and can check on them.
Syntax Example:
if STATUS $i == 0
say My status is 0, going to 1
MOB STATUS 1
end
endif
if STATUS $i == 1
say My STATUS is 1, going to 2
MOB STATUS 2
end
endif
if STATUS $i == 2
say My STATUS is 2, going to 0
MOB STATUS 0
end
endif
end
MOB ASOUND [string]
MOB ZECHO [string]
MOB GECHO [string]
ASOUND prints the text string to the rooms around the mobile in
the same manner as a death cry. This is really useful for
powerful aggressives and is also nice for wandering minstrels or
mobiles like that in concept. (Or certain gnomish contraptions ;0)
ZECHO prints the string to all players in the same area with the
mobile. Short for Zone Echo.
GECHO prints the string to all players in the game. Short for Global Echo.
MOB ECHO [string]
MOB ECHOAT [victim] [string]
MOB ECHOAROUND [victim] [string]
ECHOAT displays the string to the victim only.
ECHOAROUND displays the string to everyone except the victim.
The three options let you tailor the message to goto victims or
to do things sneaky like having a merchant do: mob at guard mob
echoat guard rescue_please This coupled with a guard act trigger
on rescue_please to: mob goto $n mob echo $I has arrived. It is
an affective way of quickly bringing guards to the scene of an
attack. (Note that the merchant has to be the only one of its
kind in the game or have a unique name, otherwise the guard
might go to different mobile…).
MOB MLOAD [vnum]
MOB OLOAD [vnum] {‘room’|’wear’}
(without second argument, loads in inventory)
IE: MOB OLOAD 16203 0 WEAR // Loads it, wears It if it can
IE: MOB OLOAD 16203 0 ROOM // Loads it in the ROOM
IE: MOB OLOAD 16203 0 NONE // Loads it in inventory
MOB KILL [victim]
MOB FLEE
MOB REMOVE [victim] [vnum|’all’]
MOB JUNK [object]
MOB PURGE [argument]
MOB AT [location] [command]
MOB GOTO [location]
MOB TRANSFER [victim/’all’] [location]
MOB GTRANSFER [victim] [location]
MOB OTRANSFER [object] [location]
Gtransfer works like transfer, except that the group the victim
belongs to is transferred with the victim. Otransfer
transfers an object in the room.
MOB FORCE [victim/’all’] [command]
MOB GFORCE [victim] [command]
MOB VFORCE [vnum] [command] ***** Didn’t seem to work on Ansalon
Vforce affects all mobiles with given vnum in the game world.
This is useful for, for example, purging certain type of NPCs
from the game (by forcing them to purge themselves).
MOB CAST [spell] [victim]
MOB DAMAGE [victim/’all’] [min] [max] {lethal}
MOB DELAY
MOB CANCEL
MOB CANCEL resets the delay timer.
MOB REMEMBER [victim]
MOB FORGET
MOB CALL [vnum] {victim} {target1} {target2}
MOBprograms can be called recursively, but as a safety measure,
parser allows only 5 recursions (unless altered).
MOB PORTALTO [vnum][portal vnum]
Example: We have a new gangplank portal named gangplank trsgp
(Pick a UNIQUE name if you want the mob to be able to find/purge old ones)
if objexists trsgp
mob at trsgp mob purge trsgp
endif
if objexists trsgp
mob at trsgp mob purge trsgp
endif
say Thanks, we're just arriving at the docks of Caergoth now!
mob portalto 16200 13610
mob echo A sailor pushes a gangplank off the stern onto the docks at Caergoth.
mob vecho 16200 A sailor ties off the Percheron and pushes a gangplank to the dock.
mob junk ticket
MOB CREATE $n [type] [arguments]
Note: Types are equip, money or gem and arguments for each are below:
equip : green, red, white
gem: diamond, ruby, emerald, opal, pearl, garnet
money: low value, high value
if $N has questobject
say Thank you so much for completing the quest $n!
mob junk questobject
mob create $n equip green
mob create $n money 250 350
mob create $n gem garnet
endif
Attaching Mprogs to Mobs
Commands within Medit (while editing a mob, AFTER mprog created)
addmprog [vnum] [trigger] [phrase]
Example: (with a mob being edited)(medit)
addmprog 13456 greet 80 – This adds mprog 13456 to the mobile,
which greets pc’s when they enter
80% of the time.
delmprog 0 (or 1,2,3 etc) – removes an mprog from a mob.
NOTE:
[vnum] The vnum of the mob program (mpedit)
[trigger] List of valid triggers and explanations above
[phrase] A single word, or a phrase within quotes
(example: “looks at you” or “yes” etc)
Or a percentile (ie ’80’ happens 80% of the time)
Loading Mobiles and Objects
No doubt you want to load objects and mobiles in your MOBprograms
with “mob oload” and “mob mload”. There are two problems connected
to this. One is that mloaded mobiles will appear without equipment
and the other is that it is difficult to keep track of the number of
created mobiles and objects.
If you want to mobiles to appear in your area as a result of the
players’ action, create a “storage room”. Define resets for the
mobiles as usual (equipment etc.) and place them in the storage
room. When you need to use the mobiles, just “mob transfer” them to
the location you want. This is better than creating mobiles on the
fly, since you don’t have to worry about creating too many mobiles
or equipping them, area resets take care of all that.
If you have a MOB PROGRAM that creates new mobiles, you might want
to make the mobiles “self-destructing”. This is easiest to do with a
random trigger that checks if the mobile is doing anything useful
and possibly does ‘mob purge $i’.
Another possibility is to use a “purgemaster”. Create a storage room
with a single mobile. Attach a random trigger that does ‘mob purge’
to that mobile. Now, when you need to get rid of anything, just ‘mob
transfer’ the mobile or item to purgemaster, and it will be
destroyed sometime later.
Miscellaneous Information
There is really no limit to the number of MOBprograms a given mobile
can have. However, the length of a single command block is limited
by the value of MAX_STRING_LENGTH. In my version it was around 4k,
so that is probably about 100 lines. The indentation spaces shown
in the example above are NOT required, but do make it easier to read
(and debug). HOWEVER, all spaces and indentations are loaded into
memory as a part of the program, so you’re using up memory.
Memory usage can also be reduced by using subroutines
(see MOB CALL).
It IS possible to accidentally make mobiles which can trigger in
loops. Infinite loops have been prevented, but in case of a loop,
the mobile behavior is undefined. An example of a looping action
would be using a RANDOM mprog with an UPDATE_ALWAYS mob, this
doesn’t actually loop, but may cause this error:
[*****] BUG: MOBprogs: MAX_CALL_LEVEL exceeded, vnum #
(note: vnum refers to calling mob’s vnum NOT mprog vnum)
this is when too many mprogs are being called simultaneously, and
the rom can’t deal with them, happens with UPDATE_ALWAYS and RANDOM
trigger combinations, especially when there are 20 of the mob, each
with 3 random mprogs each, you do the math.
The list of variables and triggers and if_checks will grow
continuously as mud creators demand the ability to do certain
things. If you have a request or if you have a new one, I don’t mind
hearing about them, and if you find bugs, I shall gladly attempt to
squash them for you. As additions or fixes are made, the code will
occasionally be redistributed. However, if you want a current
version, please feel free to ask. When the code is redistributed, a
file containing the change history from the original release will be
provided (when possible) to allow you to patch in the changes with
low grief.
– Note: Who do we call again? If someone knows, please let the
immortal staff know.
CREDITS
The reason this code was written was to enhance the playing
experience at ThePrincedom (a Merc 2.0 based world scheduled to open
in October 1993)
The original idea for this type of MOB PROGRAM came from playing on:
WORLDS of CARNAGE, a DIKU MUD implemented by Robbie Roberts and
Aaron Buhr. Aaron (known as Dimwit Flathead the First) was the
original author from what I have been told, and I hope he will not
be totally offended and angered by my coding and sharing a mimicked
version with the world. This version is probably not as good as the
original and I do feel remorse for publishing the idea. However,
since Carnage has been down for months without a word of information
regarding its return, I am glad to let one of the best features live
on in future generations of MUDs.
There are no objections to this code being shared, since, aside from
a nuclear destruction of all the Temples of Midgaard (excepting the
original one!!), bland mobiles are the greatest bane of Dikumuds
today. It would be nice to get a message saying you are using the
code just for our references. We shant answer questions from anyone
until told where they are using the code. *grin* Since this code is
not copyrighted, you of course dont have to do anything we say, but
it would be nice of you to put the mobprog help screen into your
database. and have mobinfo show up somewhere on a more visible help
screen (possibly tagged onto the bottom of credits as a see also…)
I acknowledge all the work done by the original Diku authors as well
as those at Merc Industries and appreciate their willingness to
share code. Also, quick thanks to Wraith for doing a little
beta-installation testing.
N’Atas-Ha June, 1993
natasha@gs118.sp.cs.cmu.edu
In addition to this DOC file credit section, I’d like to add a thank
you to Yaz, Mahatma, Zelda, and the rest of the 4th Realm crew for
extensively testing MOB PROGRAM 2.1 for me. You may see MOBPrograms
in action as well as their own “flavor” of mud at marble.bu.edu 4000.
Kahn Oct 28th, 1993
MERC Industries
MORE CREDITS
This text was compiled from several mob prog/mpedit texts in order to give you a more complete guide to mob progs in Ansalon (Rom 2.4 based in 1996) The previous credits/copyrights are for the ‘extended’ or ‘more info’ parts which I added to the existing document to further explain functions/syntax etc.
Other notes and examples added from my trials in CRASHING MUD! As I rewrite code and write better explanations of how to use the different aspects of mobprogs, they are updated here.
Zivilyn aka Skol December 10th, 2001 – Oct 20th, 2023
Ansalon
This document was created for use with Ansalon, ROM 2.4 and OLC on…
www.Ansalon.net
telnet://ansalon.net:8679
Version 2.3.7 September 27, 2017
PS. If you run into questions/scenario’s not handled here, feel free to talk with me about them. If they are something that needs to be added or discussed, I’ll be happy to do so. – Skol.