The trigger below fires, when the complete (stupid) sentence 'test ing
hop jump' is said in the room. If the Numeric arg had been 1, it would fire on 'test', 'ing', 'test
ing', and even 'test hop' or 'hop' alone.
Trigger Intended Assignment: Mobiles
Trigger Type: Speech , Numeric Arg: 100, Arg list: test ing hop jump
Commands:
%echo% The trigger fires now!
The trigger below will fire, if anyone uses the 'vis' command and thus become
visible in the room, the mob with the script attached is standing in. In this
case only the %actor% var is interesting. However, act() sends most of the
things you see on the screen. Many exciting options are open, using this trigger.
Trigger Intended Assignment: Mobiles
Trigger Type: Act , Numeric Arg: 0, Arg list: slowly fades into existence.
Commands:
%echo% The trigger fires now!
%echo% triggered by %actor.name%
This trigger activates every time the mob enters a new room. However, the
%echo% is only run if he enters room 3021, which I guess is a pub.
Trigger Intended Assignment: Mobiles
Trigger Type: Entry , Numeric Arg: 100, Arg list:
Commands:
* first find the room the mob is in and put the value in %inroom%
eval inroom %self.room%
* then check on the rooms vnum
if (%inroom.vnum% == 3021)
%echo% 'Give me beer! NOW!', %self.name% shouts, as he enters the pub.
end
The demo trigger triggers every time someone gives anything to the mob.
However, if it's not object number 1201, it's refused and 0 is returned -
this means the object does not change hands! If it's object number 1201,
the mob gives money in return, and thanks the person handing him the item.
Trigger Intended Assignment: Mobiles
Trigger Type: Receive , Numeric Arg: 100, Arg list:
Commands:
if (%object.vnum% != 1201)
say I don't want that!
return 0
else
say thanks!
give 10000 coins %actor.name%
end
The fight trigger will be checked every time the mob hits! - not as stated in
the original dg_script home page after all attacks are done. This makes it very
powerful. This demo trigger just makes the mob say something - but it might as
well be a dg_cast. The fight demo 2 trigger cast's a magic missile every second
round.
Trigger Intended Assignment: Mobiles
Trigger Type: Fight , Numeric Arg: 100, Arg list:
Commands:
say trigger hit!
Trigger Intended Assignment: Mobiles
Trigger Type: Fight , Numeric Arg: 100, Arg list:
Commands:
context %self.id%
if (%already_fighting%)
wait 10
unset already_fighting
else
dg_cast 'magic missile' %actor.name%
set already_fighting 1
global already_fighting
end
A hitpercent trigger is nice for making mobs call for help - now this
mob will call for help when it goes below 80% hitpoints. If there wasn't a
variable to tell it, that it had already shouted, it'd shout after every hit.
Another way would have to make the mob wait for a set period of time after
shouting.
Trigger Intended Assignment: Mobiles
Trigger Type: HitPrcnt , Numeric Arg: 80, Arg list:
Commands:
context %self.id%
if (%have_shouted%)
return 0
halt
else
%echo% %self.name% shouts 'HELP! I'm under ATTACK! HELP!'
set have_shouted 1
global have_shouted
end
This example bribe demo lets a player pay to get teleported to another room.
NOTE: if you don't give the specified amount it works as a normal give - to work
around it, either use two bribe triggers with different amounts like suggested
on the Mark Heilperns dg script
page, or use one bribe trigger with a Narg of 1 and use if sentences in the
command list.
Trigger Intended Assignment: Mobiles
Trigger Type: Bribe, Numeric Arg: 2000, Arg list:
Commands:
say thank you, step inside.
wait 2
%echoaround% %actor% %self.name% pushes %actor.name% through a concealed door.
%send% %actor% %self.name% helps you through a concealed door.
%teleport% %actor% 3001
This demo trigger is used in conjunction with the global
trigger. The demo trigger lets a mob load object number 4037 - which
incidentally is a hammer. This is a way of getting your mobs to not ALL have the
same equipment. If you randomize the number, there's not telling how it ends.
A memory trigger is needed if you use the mremember command, like I do below.
I use it for nothing special in this example, but there MUST
be a memory trigger attached to a mob, before it uses the
mremember
command to remember the characters/mobs it meets.
Trigger Intended Assignment: Mobiles
Trigger Type: Greet , Numeric Arg: 100, Arg list:
Commands:
mremember %actor.name%
say I'll remember you now, %actor.name%
Trigger Intended Assignment: Mobiles
Trigger Type: Memory , Numeric Arg: 100, Arg list:
Commands:
wait 4 s
poke %actor.name%
say i've seen you before, %actor.name%.
mforget %actor.name%
This trigger activates
when someone tries to leave the guards room. The only ways to get out are:
summon, portal, recall or kill the mob... Note: this triggers on immortals too.
Trigger Intended Assignment: Mobiles
Trigger Type: Leave , Numeric Arg: 100, Arg list:
Commands:
if (%actor.level% > 10)
say You may not leave here, %actor.name%.
%send% %actor% %self.name% prevents you from leaving the room.
%echoaround% %actor% As %actor.name% tries to leave the room, %self.name% stops %actor.himher%.
return 0
end
This example consist of 3
triggers; a bribe trigger, a door trigger and a leave trigger. The bribe trigger
lets you bribe the guard, so he'll let you pass. The door trigger prevents you
from using 'pick door' to sneak past the guard. The leave trigger unsets the
used vars, so you have to pay next time you enter, too.
Trigger Intended Assignment: Mobiles
Trigger Type: Bribe , Numeric Arg: 1, Arg list:
Commands:
wait 1
if (%amount% < 400)
say Did you really think I was that cheap, %actor.name%.
snarl
else
context %actor.id%
set has_bribed_guard 1
global has_bribed_guard
whisper %actor.name% Enter when you're ready. I'll lock the door behind you.
unlock door
end
Trigger Intended Assignment: Mobiles
Trigger Type: Door , Numeric Arg: 100, Arg list:
Commands:
context %actor.id%
if (%has_bribed_guard%)
return 1
halt
end
if (%cmd%==pick)
return 0
wait 1
say No way, you don't fool me, %actor.name%.
if (%actor.canbeseen%)
mkill %actor.name%
end
end
Trigger Intended Assignment: Mobiles
Trigger Type: Leave , Numeric Arg: 100, Arg list:
Commands:
if (%direction%==east)
context %actor.id%
if (%has_bribed_guard%)
unset has_bribed_guard
return 1
halt
end
%send% %actor% You try to leave, but %self.name% stops you.
return 0
end