Open new window
Last update:

OasisOLC and Deaths Gate script reference

Examples

Global

This demo trigger will send an annoying message to the room every 13 seconds, regardless if there's a player in the room.

Trigger Intended Assignment: Mobiles
Trigger Type: Global Random , Numeric Arg: 100, Arg list: None
Commands:
      %echo% The trigger fires now!

Random

This demo will send a message to the room every 13 seconds, whenever there's a player in the room.

Trigger Intended Assignment: Mobiles
Trigger Type: Random , Numeric Arg: 100, Arg list: None
Commands:
   %echo% The trigger fires now!

Command

 This demo will send a message when a player types 'hop' in the room - note to implementors - this doesn't work for gods.

Trigger Intended Assignment: Mobiles
Trigger Type: Command , Numeric Arg: 100, Arg list: hop
Commands:
   %echo% The trigger fires now!

Speech

 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!

Action

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%

Death 

The script below let's the mob move a bit around - however - at this point it's already dead! - don't let it move too far...

Trigger Intended Assignment: Mobiles
Trigger Type: Death , Numeric Arg: 100, Arg list:
Commands:
   %echo% %self.name% curses %actor.name% before drawing the final breath.

Greet

The script below just greets the person entering the room - if the mobile can see the person in question.

Trigger Intended Assignment: Mobiles
Trigger Type: Greet , Numeric Arg: 100, Arg list:
Commands:
   say Hello, and welcome, %actor.name%

Greet-all

Identical to greet except the mobile does not have to see the entering character for this trigger to activate.

Trigger Intended Assignment: Mobiles
Trigger Type: Greet-All , Numeric Arg: 100, Arg list:
Commands:
   say Hello, and welcome, %actor.name%

Entry

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

Receive

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

Fight 

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

Hitprcnt

 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

Bribe

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

Load

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.

Trigger Intended Assignment: Mobiles
Trigger Type: Global Load , Numeric Arg: 50, Arg list:
Commands:
      mload obj 4037
      wield hammer

Memory

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%

Cast

The example below works as a d&d 'shield' spell, negating the effects of Magic missile. The %echo%es are there for explanatory reasons only.

Trigger Intended Assignment: Mobiles
Trigger Type: Cast , Numeric Arg: 100, Arg list:
Commands:
    if (%spellname%==magic missile)
      %echo% %self.name% is protected by a shield spell negating %actor.name%s Magic Missile.
      return 0
    else
      %echo% %self.name%s shield spell doesn't protect %self.himher% from %actor.name%s magic.
      return 1
    end

Leave

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

Door

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

Time

Time trigger example still not done

Currently no example.
      

© 2005 Thomas Arp (Welcor). All rights reserved.