Skip to main content

MPEXAMPLES2

Keywords: MPEXAMPLES2
Example of using DELAY and REMEMBER: In #MOBILES text file: M greet 1002 100 M delay 1003 100 In the olc mobile edit: MOBPrograms for [ 1000]: Number Vnum Trigger Phrase ------ ---- ------- ------ [ 0] 1002 GREET 100 [ 1] 1003 DELAY 100 In #MOBPROGS #1002 if isevil $n say You infidel! Go away or face the wrath of mighty Mota! mob remember $n mob delay 10 break endif #1003 if hastarget $i growl mob echo $I screams and attacks $Q. mob kill $q else mob forget endif How this works: When the player enters a room, the mobile checks if the player is evil. If this is the case, the mobile makes the player the target (mob remember) and sets up a delay of 10 * PULSE_MOBILE. When the delay expires, program #1003 is activated. The mobile checks if the target is still in the room (hastarget), and if the player hasn't left, the mobile attacks ($q and $Q refer to the target). If the player has left, the mobile will forget the player (mob forget). More Examples: help mpexamples3