Trigger help needed - Randomly load objects into a room?

  • Sascha
  • Sascha's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 3 months ago #6076 by Sascha
With the caveat that I am most likely overthinking this...

What I would like to do is have a trigger that loads one object randomly from a predetermined list into a room, on each zone reset.

For context, I have a garden room. I have 10 flower objects. I'd like a random load of one of those ten flower objects each zone repop. The effect would be that over time the garden would be overflowing with flowers, until someone comes along to harvest them, that kind of thing.

My problem is figuring out the correct context to choose from a random load of predetermined objs. I've read, and re-read, and I think I'm reading so much that it's all muddling together in my head. Any assistance?

Thanks!

Will you stand against the coming Storm? After the Breaking: STORMRIDERS MUD - atbmud.dune.net port 4000

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

More
5 years 3 months ago #6079 by thomas
Have you tried a global world reset trigger (tstat 54 for example)?

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

  • Sascha
  • Sascha's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 3 months ago #6083 by Sascha
Hi, thanks for that. Yes, that's how I have it set up, but I am having issues with putting together a random load of objects, instead of loading them all at the same time.

For example, I would like it to randomly choose loading only one object from a list containing 450,451,452,453,454 and then dropping that object. I can set it up to load an object, wait a predetermined time, and then drop it, but then it goes in a specific order. I'd like to spice it up a bit more by mixing up that order. I feel like I'm missing something very easy.

Will you stand against the coming Storm? After the Breaking: STORMRIDERS MUD - atbmud.dune.net port 4000

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

  • Sascha
  • Sascha's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 3 months ago #6084 by Sascha
So I've managed what I think of as a crude work-around, but something tells me this could be written with a lot more economy and elegance.

%purge%
%echo% A gopher has eaten all the herbs and flowers!
  wait 5 sec
switch %random.10%
  case 1
   %load% obj 450
   break
  case 2
   %load% obj 451
   break
  case 3
   %load% obj 452
   break
  case 4
   %load% obj 453
   break
  case 5
   %load% obj 454
   break
  case 6
   %load% obj 455
   break
  case 7
   %load% obj 456
   break
  case 8
   %load% obj 457
   break
  case 9
   %load% obj 458
   break
  case 10
   %load% obj 459
   break
   done
%echo% Some flowers gracefully unfurl their petals.
end

Will you stand against the coming Storm? After the Breaking: STORMRIDERS MUD - atbmud.dune.net port 4000

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

More
5 years 3 months ago #6085 by thomas
how about this?
%purge%
%echo% A gopher has eaten all the herbs and flowers!
  wait 5 sec
eval objnum 449 + %random.10%
%load% obj %objnum%
%echo% Some flowers gracefully unfurl their petals.
end

Note: browser code - untested.
The following user(s) said Thank You: Sascha

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

  • Sascha
  • Sascha's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 3 months ago #6086 by Sascha
That looks really interesting! I was combing through examples trying to find something that would potentially work like that. I'll try it and see if it runs.

What I ended up doing with the long, unelegant version that I posted was that I expanded it to give specific echo messages when each type of flower blooms, so that PCs in the room know it's happening/which flower is blooming and also to add ambiance. It made for one long, bulky trigger but I'm kind of liking the effect.

Side note: Man, I love how this works. So much better than what I've been using for almost two decades. :) It's like a great puzzle to figure out, and the first time I got a trigger to work I was doing the happy dance in my desk chair! What a high!

Will you stand against the coming Storm? After the Breaking: STORMRIDERS MUD - atbmud.dune.net port 4000
The following user(s) said Thank You: thomas

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

Time to create page: 0.097 seconds