Author Topic: Trigedit Examples  (Read 24673 times)

0 Members and 1 Guest are viewing this topic.

Offline Fizban

  • Maniacal Scroder!
  • Administrator
  • Full Member
  • *****
  • Posts: 183
  • Fizban, the Mangy Wizard
    • MSN Messenger - Fizban1216@hotmail.com
    • AOL Instant Messenger - Fizban1216
    • View Profile
    • Email
Trigedit Examples
« on: February 28, 2008, 11:09:43 pm »
The following three sites have vast #'s of Trigedit examples, feel free to browse them for examples, look to see how to do something when stumped, post your own examples and/or post when you need help with something scripting related:

http://tbamud.com
http://cwg.lazuras.org/modules.php?name=Forums&file=index
http://fizban.zapto.org/~Fizban/forum

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigedit Examples
« Reply #1 on: September 20, 2009, 09:57:00 am »
This is an example of a script I use quite often.  I really hate the default move descriptors for mobs and thus usually one of the scripts I put in is movement for my special mobs (non-special ones can have the silly defaults).  This is an enter script since it has to do with the mob moving from one room to another.

Name: 'Mobile Move In House',  VNum: [27513], RNum: [ 1448]
Trigger Intended Assignment: Rooms
Trigger Type: Enter, Numeric Arg: 100, Arg list: None
Commands:
if %actor.is_npc%
*checks to see if it is a player or a mob*
  switch %actor.vnum%
*takes the vnum of the mob*
    case 27515
*if the mob's vnum is this set of numbers then continue*
      %echoaround% %actor% %actor.name% waltzes out of the room.
*At this point in time, the mob hasn't actually moved, so we can echo into the room it's moving FROM*
      return 0
*We don't want the mob to actually move - if it does, you get the default move message*
      %teleport% %actor% %self.vnum%
*We now have to teleport the mob to the room it was going to move into - since we stopped it from actually moving earlier*
      %echoaround% %actor% %actor.name% waltzes into the room.
*And now our entrance message in the room the mob was just teleported into*
    break
  done
end

I must thank Mordecai for taking his time and helping me out with this script (ok, more than likely he built it for me) years ago when I started building NightDragon Realms.  It's been used and copied a lot in my various zones.

<Note: As Britnoth pointed out - there is a possibility that this could be done without the teleport.  Make mobs sneak.  In the place of the %teleport% %actor% just put a wait so the mob can actually get into the second room before having the message for that room.  I've not tried it so am not sure if it would work or not, but it is plausable.  Better scriptors may be able to tell you.>
« Last Edit: September 20, 2009, 05:32:15 pm by Kvetch »

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigedit Examples
« Reply #2 on: September 20, 2009, 10:00:55 am »
Another script that should be used often - when you're talking about asking a mob to follow you for part of a quest (example being a rescue quest like those in NightDragon Realms along with others) - is a script so the mob will follow the player through portals - otherwise the mobs just get left behind.  It may seem strange to put this on a mob that won't be leaving its area (at least we hope not) but you never know what the player will do, so it's a good idea to put it on all mobs that will follow a player for one reason or another.  I got this one from Molly when I did my Madonna quest a long time ago.

Name: 'Follower portals',  VNum: [21928], RNum: [ 4879]
Trigger Intended Assignment: Mobiles
Trigger Type: Command, Numeric Arg: 100, Arg list: *
Commands:
return 0
if %self.master% != %actor%
  halt
end
switch %cmd.mudcommand%
  case enter
    case climb
    case descend
    case jump
wait 1
    %cmd.mudcommand% %arg%
  break
  case leave
    leave
  break
done

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigedit Examples
« Reply #3 on: September 20, 2009, 10:30:19 am »
Troglodytes in D&D are supposed to be smelly creatures and it is their smell that warns people away - their worse curse, I guess you could say in trying to get prey.  Because of that, I really didn't want my troglodytes in NDR2 to be able to "suddenly sneak up on people" as there should be some warning.  So after headaches of trying to figure out how to do it on my own, I went to the masters of TBA.  Fizban and Rumble both gave me something to work with, but it was Rumble's script that worked perfectly the first time.  So, here it is for anyone else that may want to use it.  Of course, this does only go off when the trog's move so players can still be surprised when they walk into a room the trog is in.

Name: 'Smelly Bum - M168',  VNum: [  206], RNum: [  206]
Trigger Intended Assignment: Mobiles
Trigger Type: Entry , Numeric Arg: 100, Arg list: None
Commands:
* By Rumble of The Builder Academy    tbamud.com 9091
* A trig to let people smell the bum from 1 room away.
* For the first move there is no from_room so set it.
if !%from_room%
  eval from_room %self.room.vnum%
  global from_room
  halt
end
wait 1 sec
eval inroom %self.room%
*
%at% %from_room% %echo% %self.name%'s smell slowly dissipates with %self.himher%.
if %inroom.north% && %inroom.north(vnum)% != %from_room%
  %at% %inroom.north(vnum)% %echo% You notice a nasty smell to the south.
end
if %inroom.south% && %inroom.south(vnum)% != %from_room%
  %at% %inroom.south(vnum)% %echo% You notice a nasty smell to the north.
end
if %inroom.east% && %inroom.east(vnum)% != %from_room%
  %at% %inroom.east(vnum)% %echo% You notice a nasty smell to the west.
end
if %inroom.west% && %inroom.west(vnum)% != %from_room%
  %at% %inroom.west(vnum)% %echo% You notice a nasty smell to the east.
end
if %inroom.up% && %inroom.up(vnum)% != %from_room%
  %at% %inroom.up(vnum)% %echo% You notice a nasty smell below you.
end
if %inroom.down% && %inroom.down(vnum)% != %from_room%
  %at% %inroom.down(vnum)% %echo% You notice a nasty smell above you.
end
*
eval from_room %self.room.vnum%
global from_room


Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigedit Examples
« Reply #4 on: September 20, 2009, 05:47:16 pm »
I seem to be on a trigedit kick, so here's some more thoughts and ideas.  Another thing I like to do is make areas come alive using atmospheric random echos.  I know somewhere in Molly's building guidelines it says not to do it, but that's only because it can be spammy AND you have to think of enough different random things to make it worthwhile.  I spent some time picking apart some of TBA's atmospheric triggers to get the following lists - hopefully they can help.  Now remember, Trigger type random by itself goes off every 13 seconds *IF* someone is in the zone.  GlobalRandom will go off every 13 seconds *whether or not* someone is in the zone.  The lower your numarg is on these triggers the less likey they will go off.  If you have your numarg at 100 it is every 13 seconds.  If you have it at 50, it goes off less, 10 is even less than that.  I tend to keep mine around 5 to minimize spam.  If you want one of the messages to happen more often than another, just use more than one case for it.  I have divided these up into Inside and Outside messages.

<note change: The word zone above is in bold because most people (me included) keep thinking this is if they are in the room.  It isn't (as per Mord's post on another segment of the scripting board). In fact, now that I realize that, I gotta go take some global flags off some things as they don't need to happen unless someone's in the zone (but not neccessarily that particular room).>

The basic atmospheric trigger:
Name: Name your trigger here  VNum: [275], RNum: [ 1436]
Trigger Intended Assignment: Rooms
Trigger Type: Enter, Numeric Arg: 10, Arg list: None
Commands:
wait 3s
eval randomnum %random.5%
*The 5 on the end of that is the number of cases I have - try to keep this number high - 20 at least, this is only an example*
switch %randomnum%
*Basically chooses a number between 1 and my highest number - in this case 5 as I told it in the eval line*
  case 1
*if the number is 1 then do this*
<enter your message here>
break
case 2
*if the is 2 then do this*
<enter your message here>
break
case 3
case 4
*If the number is 3 OR 4 do this*
<enter your message here>
break
case 5
return 1
*If the number is 5 it will do nothing due to the return 1*
break
done
*we are now done with the switch/case script so must tell it that*

That's it!

Here are the messages - thanks to the TBA gods.

Outside
    %echo% You hear a rustling sound as some animal scrambles frantically away.
    %echo% A fine mist wafts on the air, coating your body with sticky moisture.
    %echo% You feel a stab of pain as an engorged leech releases its grip on your skin.
    %echo% A swarm of midges dances momentarily around your head before moving on.
    %echo% The awful sound of some animal's dying shrieks pierces the air.
    %echo% You feel a tickling sensation as some insect runs down your back.
    %echo% The distant sound of primal war drums pounds out a rhythm.
    %echo% A long black centipede wriggles out of the ground, only to burrow back in.
    %echo% You feel slightly short of breath as the air becomes muggier.
    %echo% The sickly scent of cooking meat wafts in the sweltering air.
    %echo% You hear the sound of several crows suddenly screeching.
    %echo% A little firefly winks in and out of existence.
    %echo% A putrid stench fills the air as some vile animal rustles past.
    %echo% Ribbit... ribbit... a frog's croaking call echoes through the still air.
    %echo% A droplet of moisture runs down your forehead.
    %echo% A fly buzzes annoyingly around your face.
    %echo% The gently chirping of crickets peacefully resonate across the forest.
    %echo% A haze of fireflies dart in between some ancient cedars.
    %echo% A thick fog drifts in, dampening the moss.
    %echo% The area is surrounded by a visually impenetrable mist.
    %echo% The grey haze starts to glow a dim silvery shade as the moonlight strikes it.
    %echo% The damp fallen clouds swirl slightly in an eddying wind.
    %echo% The thick brume shifts and ebbs away slightly.
    %echo% A hushed whispering sound seems to emanate from the patch of toadstools.
    %echo% The largest toadstool yawns openly and mumbles something to one of its friends.
    %echo% Like a diminutive choir, the patch of toadstools let loose a high-pitched song of peace.
    %echo% From the east, tiny voices talk amongst themselves in their own plant-like language.
    %echo% The patch of toadstools sway synchronisingly in the silver moonlight.
    %echo% The peaceful chirping of bird-song floats down from above.
    %echo% A piping little note sings down to you from above.
    %echo% The tweeting of a newly born bird calling to its mother echoes around the forest.
    %echo% The trill bird call of love emanates from the branches above.
    %echo% The sound of ruffling and the snapping of small twigs reaches your ears.
    %echo% A rapid chattering drifts down from the giant trees to the northeast.
    %echo% With inequitable grace, a snowy white owl ghosts in on silent wings.
    %echo% A black bat flutters across the forest, high above.
    %echo% A relaxed nattering can be heard in the top of a tree to the south.
    %echo% A hedgehog slowly wanders in between some trees and out of view.
    %echo% A faint wind breathes in from all directions, steeping the mists.
    %echo% A rainbow-colored butterfly floats across the clearing.
    %echo% A strange glowing luminescence drifts off to the north, fading into the damp fog.
%echo% Sweet sounds of bird song float past you.
%echo% A gentle breeze rustles the hedge.
%echo% A column of butterflies rises out of the hedge and flutters away.
%echo% Happy insects buzz within the hedge.
%echo% A flock of singing birds soar over the hedge.
%echo% Life is good....
%echo% A singing bird lands on the hedge and beams a birdly smile.
%echo% A light breeze picks up, causing the leaves to rustle quietly.
%echo% Nearby, a bird chirps its greetings to the world.
%echo% A rabbit hops across the path, pursued by a wily red fox.

Inside
%echo% You hear the sound of footsteps creeping softly through the room.
%echo% A sudden shriek pierces through the air and suddenly dies away.
%echo% A child's laughter echoes mysteriously through the room.
%echo% A voice whispers: Trust nothing, illusion is the master of this place.
%echo% A bright red bead of fluid oozes from the wall and runs down onto the floor.
%echo% The room suddenly grows very cold, silent breath chilling your neck.
%echo% A shadowy figure suddenly steps from the wall and flickers out of existance.
%echo% The sound of glass shattering echoes through the temple.
%echo% Your skin starts to crawl, as though covered in insects.
%echo% Tiny cold fingers grasp your arm.
%echo% A small child tugs at your hand, only to giggle and run away.
%echo% The delicate tune of a music-box drifts through the room.
%echo% The sound of deep breathing rasps harshly against your ear.
%echo% A voice whispers: All you will find here is yourself.
%echo% Little hand prints blossom along the wall, only to fade away.
%echo% A single tear forms in the air and splashes onto the floor.
%echo% A small child tugs at your hand, only to giggle and run away.

** Special note: if you don't put in a check to see if the person triggering your script is a pc, it will also trigger on mobs - keep that in mind when figuring out your numarg.  Also, keeping it so mobs can also trigger this makes the command %asound% useful.  %asound% will echo the message to the rooms surrounding the room that the trigger was activated in.**
« Last Edit: September 20, 2009, 05:55:46 pm by Kvetch »

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Trigedit Examples
« Reply #5 on: September 20, 2009, 05:56:26 pm »
The following three sites have vast #'s of Trigedit examples, feel free to browse them for examples, look to see how to do something when stumped, post your own examples and/or post when you need help with something scripting related:

http://tbamud.com
http://cwg.lazuras.org/modules.php?name=Forums&file=index
http://fizban.zapto.org/~Fizban/forum

I tried that last one, Fizzy and it only gave me a blank page.

Offline Fizban

  • Maniacal Scroder!
  • Administrator
  • Full Member
  • *****
  • Posts: 183
  • Fizban, the Mangy Wizard
    • MSN Messenger - Fizban1216@hotmail.com
    • AOL Instant Messenger - Fizban1216
    • View Profile
    • Email
Re: Trigedit Examples
« Reply #6 on: November 04, 2009, 03:53:18 am »
The following three sites have vast #'s of Trigedit examples, feel free to browse them for examples, look to see how to do something when stumped, post your own examples and/or post when you need help with something scripting related:

http://tbamud.com
http://cwg.lazuras.org/modules.php?name=Forums&file=index
http://fizban.zapto.org/~Fizban/forum

I tried that last one, Fizzy and it only gave me a blank page.

The dyndns expired, it can be reached via:

http://www.zeno.biyg.org/~Fizban/forum

Offline Molly

  • Administrator
  • Hero Member
  • *****
  • Posts: 691
    • View Profile
Re: Trigedit Examples
« Reply #7 on: November 05, 2009, 02:12:48 am »
Oh my god, Fizzy is a DBZ fan now?

Offline Fizban

  • Maniacal Scroder!
  • Administrator
  • Full Member
  • *****
  • Posts: 183
  • Fizban, the Mangy Wizard
    • MSN Messenger - Fizban1216@hotmail.com
    • AOL Instant Messenger - Fizban1216
    • View Profile
    • Email
Re: Trigedit Examples
« Reply #8 on: November 05, 2009, 08:17:46 am »
Oh my god, Fizzy is a DBZ fan now?

Them be fightin' words.