Difference between revisions of "TRIGEDIT-MOB-TUTORIAL TRIGEDIT-TUTORIAL"
(Bot: Automated import of articles) |
(formatting) |
||
Line 1: | Line 1: | ||
'''TRIGEDIT-MOB-TUTORIAL TRIGEDIT-TUTORIAL''' | '''TRIGEDIT-MOB-TUTORIAL TRIGEDIT-TUTORIAL''' | ||
[[Category:Help Files]] | [[Category:Help Files]] | ||
− | + | [[Category:Building]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 36: | Line 30: | ||
# Decide what you want the script to do. | # Decide what you want the script to do. | ||
− | # | + | #: In this example, we want to make a small mini quest in an area. The quest |
− | # | + | #: work like this: When you enter the room, where the first mob is, it will |
− | # | + | #: to tell a tale. In this tale, you are instructed to perform a task, in |
− | # | + | #: case, kill an evil ogre, that lives in a nearby forest. As proof of the |
− | # | + | #: you must bring back the ogre's apprehension to the questgiving mob. |
# Make corresponding objects and mobs. | # Make corresponding objects and mobs. | ||
− | # | + | #: Ingredients for this quest: |
− | # | + | #: 1 Questgiver mob - I've chosen 'the questmaster' - vnum 1310 |
− | # | + | #: 1 Target mob - In this case 'an apprehensive Ogre' - vnum 1311 |
− | # | + | #: 1 Quest object - 'some apprehension' - trash object, vnum 1300 |
# Split up the quest. | # Split up the quest. | ||
− | # | + | #: Next thing to do is look at the different steps involved with the quest. In |
− | # | + | #: example, we have three steps: |
− | # | + | #: Player entering room -> tell story |
− | # | + | #: Player finds ogre -> load object (Do not just want the mob to carry it) |
− | # | + | #: Player gives questmaster apprehension -> reward player |
# Find corresponding trigger types. | # Find corresponding trigger types. | ||
− | # | + | #: Having split the quest up also means we reasonably easy can decide what |
− | # | + | #: of triggers we need - in this case: |
− | # | + | #: mob GREET trigger (attached to questmaster) |
− | # | + | #: mob DEATH trigger (attached to ogre) |
− | # | + | #: mob RECEIVE trigger (attached to questmaster) |
# write the scripts for the triggers. | # write the scripts for the triggers. | ||
− | # | + | #: Up to this point, neither trigedit or the script editors have been used. |
− | # | + | #: the info needed is in the help files and on the webpages. Notice most of |
− | # | + | #: work required is PLANNING! You must know exactly what you want to do before |
− | # | + | #: do it. Now is the time to fire up trigedit and start editing the triggers. |
− | # | + | #: give the first one vnum 0, and edit it to look like the script below: |
Line 228: | Line 222: | ||
# Attach the scripts - permanently | # Attach the scripts - permanently | ||
− | # | + | #: Proceed and add the scripts to the two mobiles through medit: |
> medit 1310 | > medit 1310 | ||
Line 275: | Line 269: | ||
# Done ? | # Done ? | ||
− | # | + | #: The scripts are now attached to the correct mobs, and the players of your |
− | # | + | #: can now take the quest whenever they wish. This is a great time for |
− | # | + | #: improvements to the little quest: |
Balance issues: | Balance issues: |
Latest revision as of 11:38, 14 July 2017
TRIGEDIT-MOB-TUTORIAL TRIGEDIT-TUTORIAL
Mob trigger tutorial
This mini-quest is setup in TBA as an example. {cRGOTO 1310{c0 and work your way north
with nohassle off.
The following 7 steps should give you a general idea about what to do, and how to go
about making small quests in the dg scripting language. This example is concentrated
on quests involving mobs.
The process can be broken down to the following:
- Decide what you want the script to do.
- Make corresponding objects and mobs.
- Split up the quest.
- Find corresponding trigger types.
- write the scripts for the triggers.
- Attach the scripts - permanently
- Done ?
- Decide what you want the script to do.
- In this example, we want to make a small mini quest in an area. The quest
- work like this: When you enter the room, where the first mob is, it will
- to tell a tale. In this tale, you are instructed to perform a task, in
- case, kill an evil ogre, that lives in a nearby forest. As proof of the
- you must bring back the ogre's apprehension to the questgiving mob.
- Make corresponding objects and mobs.
- Ingredients for this quest:
- 1 Questgiver mob - I've chosen 'the questmaster' - vnum 1310
- 1 Target mob - In this case 'an apprehensive Ogre' - vnum 1311
- 1 Quest object - 'some apprehension' - trash object, vnum 1300
- Split up the quest.
- Next thing to do is look at the different steps involved with the quest. In
- example, we have three steps:
- Player entering room -> tell story
- Player finds ogre -> load object (Do not just want the mob to carry it)
- Player gives questmaster apprehension -> reward player
- Find corresponding trigger types.
- Having split the quest up also means we reasonably easy can decide what
- of triggers we need - in this case:
- mob GREET trigger (attached to questmaster)
- mob DEATH trigger (attached to ogre)
- mob RECEIVE trigger (attached to questmaster)
- write the scripts for the triggers.
- Up to this point, neither trigedit or the script editors have been used.
- the info needed is in the help files and on the webpages. Notice most of
- work required is PLANNING! You must know exactly what you want to do before
- do it. Now is the time to fire up trigedit and start editing the triggers.
- give the first one vnum 0, and edit it to look like the script below:
> trigedit 0
Trigger Editor [0]
1) Name : {cyMob Tutorial Example 1310 - Quest Offer{c0
2) Intended for : {cyMobiles{c0
3) Trigger types: {cyGreet {c0
4) Numeric Arg : {cy100{c0
5) Arguments :
6) Commands:
{cc* we don't want him to tell this to mobs. vnum -1 is reserved for players.
if %actor.vnum% == -1
* 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 apprehensive 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 apprehension he has stolen.
end
end{c0
The script above will be executed every time anyone enters the room. If the
person entering is a mobile, the if check at the beginning will stop the
execution. Note, that I've named the trigger as I did above. ALWAYS include
the VNUM of where you plan on attaching the trigger. Also, give it a name so
it is easy to see what part of the quest this trigger handles. The second
script is very simple.
> trigedit 1
Trigger Editor [1]
1) Name : {cyMob Tutorial Example 1311 - Kill ogre{c0
2) Intended for : {cyMobiles{c0
3) Trigger types: {cyDeath{c0
4) Numeric Arg : {cy100{c0
5) Arguments :
6) Commands:
{ccsay you got the best of me %actor.name%.
- load some apprehension
%load% obj 1300
- reload the mob for the next questor
%load% mob 1311{c0
The above script will be executed when the mob is killed - just before the
death cry. The last script just needs to check if the object handed over is
the correct one. Let's see it, here with vnum 2:
> trigedit 2
Trigger Editor [2]
1) Name : {cyMob Tutorial Example 1310 - Give/Quest Completion{c0
2) Intended for : {cyMobiles{c0
3) Trigger types: {cyReceive{c0
4) Numeric Arg : {cy100{c0
5) Arguments :
6) Commands:
{cc* check if this was indeed the right object
if %object.vnum% == 1300
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 1300
else
* this wasn't the right object - don't accept it
say I don't want that - bring me back my apprehension.
return 0
end{c0
The script above is pretty self explanatory, but to clarify a bit: 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
the return value of the script to prevent the object being passed over. Lastly,
and very importantly, 'end' ends the if.
- Attach the scripts - permanently
- Proceed and add the scripts to the two mobiles through medit:
> medit 1310
[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 script vnum:
Enter choice : n
Please enter position, vnum (ex: 1, 200): 0
Enter choice ? n
Please enter position, vnum (ex: 1, 200): 2
Enter choice ? x
And add the trigger vnum 3 to the ogre in a similar manner.
- Done ?
- The scripts are now attached to the correct mobs, and the players of your
- can now take the quest whenever they wish. This is a great time for
- 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 old man ?
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.
12DEC01 - mob tutorial by Welcor
04OCT02 - updated/modified by Rumble