Welcome to the Builder Academy

Question Parna's trigger tips pt. 2 - Consolidated triggers

More
26 Nov 2013 00:26 #4530 by Parnassus
One of the new builders was mentioning to me that he didn't think that 100 triggers would be enough. What many builders don't realize is that, due to the flexibility of the system, triggers can be consolidated. It's a bit like what Humpty Dumpty in Alice in Wonderland calls a portmanteau: 'You see it's like a portmanteau — there are two meanings packed up into one word.'

To start, if you've ever popped into room 3 (and who hasn't?), you've probably seen Socrates greeting people with pithy comments: tstat 183. This is an example of how to make a mob say random statements, making a more interesting trigger than having him say the same things all the time. tstat 6 - Obj Command Magic Eight Ball - O47 uses a switch and cases to do the same thing. It generates a random number to output a random line. This is the format I'll be talking about.

Now, let's expand this a bit. tstat 153 - Angel Follows Masters Commands - 207. This one, instead of just randomly sending out lines, needs the player to input commands. But which commands? A basic builder might make a trigger for each command like so:
Trigger type: speech, Numeric arg: 100, Arg list: speak
Trigger type: speech, Numeric arg: 100, Arg list: sit
and so on. However, this particular trigger takes 10 different commands and stuffs them all in the portmanteau. Instantly, instead of using 10% of the available triggers, you're only using 1%! If you've met the conditions of tstat 152, you can give Angel various commands for various reactions.

So now I'm going to move on to one of my own triggers.
Code:
Name: 'Zoo, Day, Movement Out', VNum: [56013], RNum: [ 4156] Trigger Intended Assignment: Rooms Trigger Type: Leave , Numeric Arg: 100, Arg list: None Commands: *This trigger is just to give the park creatures a more * interesting description of moving out of rooms. *It also prevents them from moving out of their sections. *This is the petting zoo and daytime version. if %actor.is_pc% else if %self.vnum% == 56006 && %direction% == east return 0 else if %self.vnum% == 56010 && %direction% == west return 0 else if %self.vnum% == 56020 && %direction% == north return 0 else if %self.vnum% == 56040 && %direction% == south return 0 else switch %actor.vnum% case 56002 set walk bounces break case 56003 case 56020 case 56024 set walk bounds break case 56004 case 56013 case 56022 set walk scurries break case 56005 set walk wanders break case 56006 case 56014 case 56023 set walk hops break case 56007 set walk trots break case 56008 case 56021 set walk burrows break case 56009 set walk swings break case 56010 set walk pounces break case 56011 set walk lumbers break case 56012 set walk slithers break case 56015 case 56016 set walk flutters break case 56017 set walk swoops break case 56018 case 56019 case 56025 set walk flies break done if %actor.vnum% > 56001 && %actor.vnum% < 56026 set msg %actor.name% %walk% %direction%. %echo% %msg% end end end end end end
This code is doing two things. First, it's keeping mobs from going places they shouldn't and second, it's giving the mobs a more interesting movement message. This works because the mobs are flagged as sneaking so they have no movement messages of their own. There is a barely noticeable oddity where the mobs seem to 'ghost', moving when they aren't really there.

I feel this is a nice portmanteau because, not only does it do these two tasks, it covers over 20 mobs and over 30 rooms. Doesn't this seem efficient? There are a lot of builders even more efficient than this. Fizban is an excellent example of trigger efficiency.

If you can get the hang of this, you may find that that 100 trigger limit isn't nearly as limited as it seems.

Good luck with the building.

Please Log in or Create an account to join the conversation.

Time to create page: 0.167 seconds