Random object loads

Posted by Hanaisse on Mon 18 Jun 2007 01:10 AM — 8 posts, 31,344 views.

Canada #0
Hi everyone,

I’ve been browsing this and other SMAUG related forums for awhile now and have gathered a lot of information, ideas and some snippets, although I haven’t seen any topic related to the question I have on the code’s capabilities. I’m hoping the collective intelligence here can help me.

I understand the code to be very linear – equip object A on mob B in room C and every reset it will always be there. Is there any way to randomize the load of an object on various mobs at various times?

For example, this is what I’d like to have: Randomly load an object - a healing potion - on any mob throughout an area during random resets. So that players are not always killing the same mob for the same object every reset. Sometimes it’s there, sometimes it’s not.

Really hoping this could be accomplished with some kind of prog and not messing too much with code (I'm using SMAUG1.4a). Any thoughts would be appreciated.
USA #1
What I did for something similar was to add a new mudprog trigger, spawn, that was called after a mob was created during the reset process. Then I could do whatever I wanted post-creation, such as random object loading.
USA #2
What is simple to do is just add a death prog. Set it to the amount you want the obj to spawn, and have it invoke the item. The item will appear in the corpse.
USA #3
Oh, yes, that's a good way too. The reason I did the other thing was because I wanted the item to be visible when you looked at the mob.
USA #4
Spawn progs are a perfect compliment to the death progs. Not sure why nobody ever thought of it before.

One other alternative is to attach a percentage argument to the reset itself so that you can then have a random chance of the mob itself showing up or not. That might be doable with a room based spawn prog but I'm not sure it would be a good idea to fill up the mud with a bunch of those. Prog processing is brutally inefficient.

Percentage based resets also allow you to have doors which are sometimes closed, sometimes not. Traps that don't always show up, and anything else resets are already capable of doing. Done well it can add a lot of variety to the game.
Australia Forum Administrator #5
Quote:

Prog processing is brutally inefficient.


Must be time to convert them to Lua. ;)
USA #6
I've been arguing that for some time now. I just need to find a good way of doing it. :-) (And I need to find the time to find a good way etc.)

One temporary fix, though, would be to preparse the mudprog files into a byte-code of sorts to avoid having to interpret them from scratch every single time. But I think if you're going to go to that trouble you may as well just use Lua...
Canada #7
Thank you all for the responses. I don't think I've heard of a spawn prog before but a death prog I can probably handle.

I probably should have mentioned I'm not a coder, but I will have my coder take a look at all the suggestions.

Thanks again.