This section will probably get larger if I get more questions, but for now I will list a few of the more common questions people ask me about making mobprogs work.
Is there a limit to the number of mobprogs I can have or
their size?
There is no limit to the number of mobprogs you use whatsoever. Individual mobprogs must, however, be smaller than 16000 characters in size. Most word processors, and in particular Textpad, have character counting tools should you think you are coming close to breaking this limit.
Where do I put these ~ and | symbols?
This is a common problem. If you look at the examples on this tutorial, they will show you where they belong, but I will put it here as well. The ~ symbol goes after your mobprog type line (such as >act_prog p sneezes.~) and on a new line at the end of each individual mobprog. The | symbol goes at the very end of your entire listing of mobprogs, NOT after each one.
How do I make a mob perform an action only once?
You basically do this, normally, by checking a stat of the mob and then setting the stat higher than the if check. Let’s say you want a mob to say hi on a greet_prog only once, and never again. Here’s what you’d do:
>greet_prog 100~
if <(stat($i,”con”),16)
mpadd mpset me con 22
mpadd mpecho $I says, ‘Hi.’
else
endif
endif
Now the mob will check on a greet_prog whether its con is less than 16. Since a mob’s con starts at 11, like all of their stats, the prog will go off the first time someone enters. However, after that, the mob’s con is set to 22, thus making all future greetings on the if check go to the endif rather than having the mob say hello.
What common problems should I look for in my mobprogs?
Nine out of ten times if a mobprog isn’t working like it’s supposed to, it’s because of something easily overlooked. Bad keywords, mobs who can’t see invis when they need to, can’t see in the dark and are in dark rooms, are trying to do certain actions when they are in the sitting position, using skills they haven’t been given, trying to do certain actions when ghosted, etc. The list runs on and on. The best you can do is pay careful attention to the keywords and vnums you use, and to make sure that your mob can do the things you want it to do. Heavily nested mobprogs can also make a mobprog that looks good end up falling flat.
How do I make a mob need several different things to happen before doing something?
This isn’t as difficult as it might seem. What you do is use mob stats again. You could also use variables, if you set it up correctly. Whenever one of your multiple things gets done, have the mob that’s in charge of it (like one of three mobs you must kill to get a mob to open a door) trigger the main mob. This main mob, triggered by the event mob, sets a stat. Let’s say you have red, blue, and white dragons. Each one must be killed before a central mob unlocks and opens a door. Whenever one of the dragons dies, it does this: mpat xxxcentralmobxxx lightbulb xxxcentralmobxxx and have a trigger for each colored dragon on the central mob, triggering off the message given from each dragon lightbulbing it. Each dragon will cause the mob to set a different stat. The prog then checks to see if all of the stats are above the mark yet. It might look like this:
>act_prog p It seems you've given the white dragon a great idea!~
if and(>(stat($i,”con”),16), >(stat($i,”maxmana”),1000))
mpadd mpoload 10005
mpadd unlock door
mpadd open door
mpadd mpjunk key
else
mpadd mpset me cha 22
endif
~
>act_prog p It seems you've given the red dragon a great idea!~
if and(>(stat($i,”con”),16), >(stat($i,”cha”),16))
mpadd mpoload 10005
mpadd unlock door
mpadd open door
mpadd mpjunk key
else
mpadd mpset me maxmana 2000
endif
~
>act_prog p It seems you've given the white dragon a great idea!~
if and(>(stat($i,”cha”),16), >(stat($i,”maxmana”),1000))
mpadd mpoload 10005
mpadd unlock door
mpadd open door
mpadd mpjunk key
else
mpadd mpset me con 22
endif
~
You can play around with this, and even use variables if you want. Just be sure to remember that variables that haven’t been set yet are difficult to check, so you may want to have a greet_prog or rand_prog or something that sets all the variables you will use to 1 before the initial change.
What are the integer values for classes, races, positions (for the position function, and affects (for isaffected)?
Classes: magic user 1 chaos cleric 2 thief 3
warrior 4 paladin 5 anti-paladin 6
bard 7 ranger 8 order cleric 9
barbarian 10 druid 11 monk 12
artificer 13
Races: human 1 elf 2 ogier 3
dwarf 4 aracoix 5 half giant 6
shade 7 minotaur 8 undead 12
dragon 13 feral 16 sylvan 17
storm dragon 18 frost dragon 19 fire dragon 20
earth dragon 21 lich 22 zombie lord 23
wraith 24 vampire 25 tiger 26
raven 27 wolf 28 serpent 29
voadkyn 30 satyr 31 sidhe 32
centaur 33
Positions: 0 dead 1 mortally wounded 2 incapicitated
3 stunned 4 sleeping 5 resting
6 sitting 7 fighting 8 standing
Affects: 1 invis 2 detevil 3 detinvis
4 detmagic 5 senselife 6 hold
7 sanc 8 group 9 curse
10 permsleep 11 poison 12 pfe
13 freeact 14 watwalk 15 ward
16 sleep 17 reflection 18 sneak
19 hide 20 blackmantle 21 charm
22 follow 23 wimpy 24 infrared
25 desecrate 26 deaths door 27 imp invis
28 fleetfeet 29 ghost 30 featherfall
31 still 32 blind 33 silence
34 sustain 35 dreamsight 36 haste
37 vshroud 38 fireshield 39 stoneskin
40 barkskin 41 pfg 42 ambidex
43 nosummon 44 guarded 45 parry
46 protcold 47 protheat 48 polymorphed
49 truesight 50 circled 51 tread
52 detect traps 53 halfsanc 54 wall of thorns
55 berserk 56 dreamwalk 57 banished
58 tongues 59 landed 60 flamegloss
61 vorpalize 62 courage 63 confusion
64 light 65 diseased 66 unused c
67 breathe water 68 absorbtion 69 slow
70 detect good 71 artifact 72 darkness
73 know align 74 faerie fire 75 move silently
76 used fireshield 77 cloak of dark 78 nopoison