TRIGEDIT-MOB-TUTORIAL

building

Also known as: TRIGEDIT-TUTORIAL · MOB-TUTORIAL

The following 7 steps should give you a general idea about what to do, and how to go about making small quests with trigedit. This example concentrates on quests involving mobs. The process can be broken down to the following: 1. Decide what you want the trigger to do. 2. Make corresponding mobs, objects, and rooms. 3. Split up the quest into simple sections. 4. Decide which trigger types you need. 5. Write the triggers. 6. Attach the triggers - permanently 7. Done ? 1. Decide what you want the trigger to do. In this example, we want to make a small mini quest in an area. The quest will work like this: When you enter the room with the questmaster it will start to tell a tale. In this tale, you are instructed to perform a task. In this case kill an ogre that lives nearby. As proof of the kill, you must bring back the ogre's wings and give them to the questmaster. 2. Make corresponding objects and mobs. 1 Questgiver mob - I've chosen 'the questmaster' - vnum 14 1 Target mob - In this case 'a quest ogre' - vnum 16 1 Quest object - 'a pair of wings' - vnum 14 3. Split up the quest. Next thing to do is look at the different steps involved with the quest. In this example, we have three steps: Player entering room -> tell story Player finds and kills ogre -> load object Player gives questmaster the wings -> reward player 4. Find corresponding trigger types. Having split the quest up it makes it easy to decide which triggers to use from HELP TRIG-TYPE: mob GREET trigger (attached to questmaster) HELP TRIGEDIT-MOB-GREET mob DEATH trigger (attached to ogre) HELP TRIGEDIT-MOB-DEATH mob RECEIVE trigger (attached to questmaster) HELP TRIGEDIT-MOB-RECEIVE 5. Write the triggers. Up to this point trigedit should not have been used. Most people struggle with triggers because they have not planned what they want to happen or do not know what trigedit is capable of. Read the help files of each type and ask for help if you need it. Remember, most of the work required with triggers is planning! You must know exactly what you want to do before you do it. Now that we know exactly what we want to do we can use trigedit. > trigedit 1 Trigger Editor [1] 1) Name : Mob Tutorial Example Quest Offer - 14 2) Intended for : Mobiles 3) Trigger types: Greet 4) Numeric Arg : 100 5) Arguments : 6) Commands: * we don't want him to tell this to mobs. Check if actor is a player. if %actor.is_pc% * only greet players coming from the south. if %direction% == south * wait 1 second, always give the player time before you start sending text. wait 1 sec say Can you help me, %actor.name%? wait 1 sec say An ogre has something of mine. wait 1 sec say If you slay him I'll give you all the coins I can spare. wait 1 sec say Please, bring me the wings he has stolen. end end The trigger above will fire when a player enters the room from the south. If a mobile enters the if check at the beginning will be false and the trigger will not execute. Note how I named the trigger. ALWAYS include the VNUM of where you plan on attaching the trigger. Also, give it a name so it is easy to understand where it is used. Now for the second trigger: > trigedit 2 Trigger Editor [2] 1) Name : Mob Tutorial Example Kill Ogre - 16 2) Intended for : Mobiles 3) Trigger types: Death 4) Numeric Arg : 100 5) Arguments : 6) Commands: say you got the best of me %actor.name%. * load the wings %load% obj 1 * reload the mob for the next questor %load% mob 16 The above trigger will be executed when the mob is killed - just before the death cry. The last trigger just needs to check if the object handed over is the correct one. Let's see it, here with vnum 2: > trigedit 3 Trigger Editor [3] 1) Name : Mob Tutorial Example Completion - 14 2) Intended for : Mobiles 3) Trigger types: Receive 4) Numeric Arg : 100 5) Arguments : 6) Commands: * check if this was indeed the right object if %object.vnum% == 1 wait 1 sec say Thank you, %actor.name% %send% %actor% %self.name% gives you a gold piece. %echoaround% %actor% %actor.name% is rewarded for his valor. nop %actor.gold(1)% wait 5 sec %purge% obj 1 else * this wasn't the right object - don't accept it say I don't want that - bring me back my wings. return 0 end First check if the object is the correct vnum, then give the reward, and send messages to the player and others in the room. If it wasn't the object, reject it, and use return 0 to prevent the object from leaving the players inventory. Lastly, and very importantly, 'end' the if. Every if must have an end. 6. Attach the triggers - permanently Proceed and add the triggers to the two mobiles through medit: > medit 14 [medit menu] Enter choice ? S Script Editor Trigger List: <none> N) New trigger for this script D) Delete a trigger in this script X) Exit Script Editor Enter choice : Here, add the scripts by typing N, then the trigger vnum: Enter choice : n Please enter position, vnum (ex: 1, 200): 1 Enter choice ? n Please enter position, vnum (ex: 1, 200): 3 Enter choice ? x And add the trigger (vnum 2) to the ogre (vnum 16) in a similar manner. 7. Done ? The triggers are now attached to the correct mobs, and the players of your mud can now take the quest whenever they wish. This is a great time for considering improvements to the little quest: Balance issues: Should players get a smaller reward if they perform the quest many times ? Should it be limited to 1 quest per player or 1 per reboot ? Gameplay issues: Perhaps other mobs in town should tell the player to go see the questmaster ? Should the ogre always load the object, or only when people know he has it ? Are there other mobs who would like to pay for that object ? The above list is just a few examples. All of them could be implemented, but it is beyond the scope of this tutorial.