24 Nov, 2008, RedPyramid wrote in the 1st comment:
Votes: 0
I've got a complex question and if there is a coder somewhere in the world that can help me with this endeavor, I would greatly appreciate it!
Alright, I run a Silent Hill based MUD, and on of the unique features I'd like to implement is something I suppose we can call "teleport time". Within the Silent Hill series (a video game developed for the Sony Playstation and owned by Konami Studios. All rights reserved) there is a timer on when the darkness comes. It switches between two different descriptions for each area. We're developed in Diku/Merc/Rom 2.4 and here is a wonderful preview of something VERY similar to what we are trying to impletment. http://www.mudbytes.net/index.php?a=file.... Now, yes, as the darkness comes, I would like the description to change around the player seamlessly. An environment shift will be great. The way we were first going to go about this was two different areas and somehow, create a code to transfer the player; however, with this code snippet I see maybe we can go about it in a different way and only shift things.

This code should work properly in executing my idea, but I need a few things inserted into it. Anyone willing to take a swing at this project and maybe I'm making this too complicated. It may only need a few lines of code added. Let me know what you think.
24 Nov, 2008, elanthis wrote in the 2nd comment:
Votes: 0
Why don't you actually state what changes you want, and then people will actually know if they're interested or not. :)
24 Nov, 2008, RedPyramid wrote in the 3rd comment:
Votes: 0
Great idea. c.c I'm still working out my own newbie bugs on coding. Alright let's see. The code above in my previews post will work just fine for my mud. I want to send out a local command to the players when this occurs. And I'm not sure if that will need to be added, or if it is already in the rom 2.4 stock code and I just need to locate it and edit the output to players.
25 Nov, 2008, The_Fury wrote in the 4th comment:
Votes: 0
RedPyramid said:
Great idea. c.c I'm still working out my own newbie bugs on coding. Alright let's see. The code above in my previews post will work just fine for my mud. I want to send out a local command to the players when this occurs. And I'm not sure if that will need to be added, or if it is already in the rom 2.4 stock code and I just need to locate it and edit the output to players.


I am assuming that you want to somehow inform players when the descriptions change from day to night? This happens already when time is updated, there is an echo something along the lines of "It has become night"

Also a little advice, I remember when i was a newbie, my questions were all convoluted and asked in round about ways too and sometimes not questions at all, the best thing you can do is be as direct and to the point as possible including relevant information. It took me a while to get there and i have had occasion to look back and grimace at some of my earliest posts. The better the questions the easier it is to give you a useful answer.

Anyways welcome to Mudbytes, hope we can be of help to you.
25 Nov, 2008, Ssolvarain wrote in the 5th comment:
Votes: 0
I know we have night time descriptions on End of Time, so Hades_Kane or Midboss might be willing to lend some insight. They may or may not, but it's worth a shot :)
25 Nov, 2008, RedPyramid wrote in the 6th comment:
Votes: 0
The Fury, are you familiar with ROM? And do you know what file the "It is now Nighttime" would be in?
25 Nov, 2008, The_Fury wrote in the 7th comment:
Votes: 0
RedPyramid said:
The Fury, are you familiar with ROM? And do you know what file the "It is now Nighttime" would be in?


Sure its in update.c in the void weather_update( void ) function.

case 20:
weather_info.sunlight = SUN_DARK;
strcat( buf, "The night has begun.\n\r" );
break;
25 Nov, 2008, The_Fury wrote in the 8th comment:
Votes: 0
RedPyramid said:
My next question is I want to see if there is a code snippet to add to modify the whole fight system so that it displays in a numerical how much damage is done. Are you able to help me with this?


Sure, there should be a snippet for this in the rom section somewhere, but i could not find it, there is just to many snippets in there. I am not all that familiar with rom, but it should not be all to hard to work out. In fight.c you need to locate

void dam_message( CHAR_DATA *ch, CHAR_DATA *victim,int dam,int dt,bool immune )


Then within this function you need to locate these lines

if ( dt == TYPE_HIT )
{
if (ch == victim)
{
sprintf( buf1, "$n %s $melf%c",vp,punct);
sprintf( buf2, "You %s yourself%c",vs,punct);
}
else
{
sprintf( buf1, "$n %s $N%c", vp, punct );
sprintf( buf2, "You %s $N%c", vs, punct );
sprintf( buf3, "$n %s you%c", vp, punct );
}
}


if (immune)
{
if (ch == victim)
{
sprintf(buf1,"$n is unaffected by $s own %s.",attack);
sprintf(buf2,"Luckily, you are immune to that.");
}
else
{
sprintf(buf1,"$N is unaffected by $n's %s!",attack);
sprintf(buf2,"$N is unaffected by your %s!",attack);
sprintf(buf3,"$n's %s is powerless against you.",attack);
}
}
else
{
if (ch == victim)
{
sprintf( buf1, "$n's %s %s $m%c",attack,vp,punct);
sprintf( buf2, "Your %s %s you%c",attack,vp,punct);
}
else
{
sprintf( buf1, "$n's %s %s $N%c", attack, vp, punct );
sprintf( buf2, "Your %s %s $N%c", attack, vp, punct );
sprintf( buf3, "$n's %s %s you%c", attack, vp, punct );
}
}
}


Then you need to change each of the sprintf's adding [%d] and ,dam as i have in the following example.

sprintf( buf1, "$n %s $melf%c [%d]",vp,punct, dam);


And thats all there is to it.
25 Nov, 2008, Hades_Kane wrote in the 9th comment:
Votes: 0
The_Fury said:
RedPyramid said:
The Fury, are you familiar with ROM? And do you know what file the "It is now Nighttime" would be in?


Sure its in update.c in the void weather_update( void ) function.

case 20:
weather_info.sunlight = SUN_DARK;
strcat( buf, "The night has begun.\n\r" );
break;


One issue here is by default this will only show when the player is outdoors.

Two things you might want to consider doing here:

1) Change that to where the night time message update and the morning time message update will show regardless of whether or not they are indoors, and change those messages to something that informs the player the happy world just bled away, revealing the darkness underneath. The reason you don't want to change all of the update messages here to work indoors is because things like rain, lightning, etc. wouldn't be appropriate when the player is indoors, but you do want the day/night desc change to be visible indoors.

2) Add in additional messaging for daytime/nighttime that shows regardless of indoor/outdoor, and otherwise leave those other messages alone to update as normal.
25 Nov, 2008, quixadhal wrote in the 10th comment:
Votes: 0
While it's tempting to just store alternate descriptions for day and night, if you're trying to do a more dynamic change to the envrionment (as the game/movie tie-in suggests), you might instead consider crafting two seperate areas, and silently move the players between matching rooms.

I suggest this, because the "nighttime" zone would most likely have wandering creatures, accessible doorways that are locked during the day, perhaps even environmental effects – all of which would have to be dealt with by code on each transition between day and night. If you make two mirror-image areas, you could shift people between them and just make sure each side is not accessible during the wrong time.

Of course, I'm assuming you have a small number of chokepoints (whose exits would have to be tweaked), and that you handle summon/teleport/etc. If someone saves in vnum 10045 at night, and they log back in during the day they'd be moved to room 20045 (if you had zones 10000 and 20000). That kind of thing.
25 Nov, 2008, RedPyramid wrote in the 11th comment:
Votes: 0
quixadhal said:
While it's tempting to just store alternate descriptions for day and night, if you're trying to do a more dynamic change to the envrionment (as the game/movie tie-in suggests), you might instead consider crafting two seperate areas, and silently move the players between matching rooms.

I suggest this, because the "nighttime" zone would most likely have wandering creatures, accessible doorways that are locked during the day, perhaps even environmental effects – all of which would have to be dealt with by code on each transition between day and night. If you make two mirror-image areas, you could shift people between them and just make sure each side is not accessible during the wrong time.

Of course, I'm assuming you have a small number of chokepoints (whose exits would have to be tweaked), and that you handle summon/teleport/etc. If someone saves in vnum 10045 at night, and they log back in during the day they'd be moved to room 20045 (if you had zones 10000 and 20000). That kind of thing.


This was my original deal, but not sure exactly how to execute it. Creating two different areas would work, but I am not sure how to do a check to run against people and teleport them to a different location. The code for that seems custom and I'm not completely ready to tackle that. Once I get in there to see if the nighttime thing will work, our idea might just have to knuckle down and have a custom code like that. :stare:
25 Nov, 2008, David Haley wrote in the 12th comment:
Votes: 0
At some point, yes, you will have to just bite the bullet and write code, if you're wanting something advanced enough. :smile: Nighttime descriptions work if all you want to change is the description. If you also want exits, mobs, and so on to change, you're pushing the boundaries of what is practical or even possible with mudprogs.
25 Nov, 2008, Hades_Kane wrote in the 13th comment:
Votes: 0
It actually wouldn't be that difficult to make mobs switch out based on the time of day.

I've considered in the past making an area where the town is full of life during the day, then once night hits, most of the mobs would go back to their homes and other mobs would come out. In alleys you might have thieves and rats, and so on.

This is how I would recommend setting up an area like this if you were trying to avoid creating two areas for every area in the game and wanted to avoid having to code in a lot of extra code to pull this off…

From what I recall of stock ROM (we've made so many additions to our programs, sometimes its hard to recall)… you would need to add in one new program trigger, and one if check, assuming that neither of these come with stock ROM programs…
1) reset trigger - this would be a program that when the mob is loaded into the room either through repop or being loaded manually, it would trigger.
2) hour check - this would check what time the MUD is in.

So then what you would do is create your two sets of mobs, daytime and nighttime. Go through and reset all of your day time mobs as you normally would but then put your reset trigger program on them. Your reset trigger would check for the hour, and if the hour is within daytime, the program would stop. If it is night-time, your mob would then load its 'night-time' counterpart and then purge itself, I would also probably include messaging of the mob fading away and something in its place. Next, you would put a "tick" program on the day-time mobs that would fire every tick, and basically have the same check as above. The main thing I would add in addition to this is something to where if the mob is fighting, to make it stop the fight incase of any possible crash bugs with a mob purging itself in mid combat. Next, you would go into your night-time mobs and make your tick programs basically do the same thing, but reversed.

This would be one way to go about this using programs if you don't have the time, ability, or inclination to add in the code that would be necessary to pull this off.

Of course, with anything that would be a widely used "feature" or "system" of one's game, it is better to hard-code the system as code will always be more efficient on memory and such, and will always be more stable and less prone to breaking. But, this is one thing to consider if you aren't quite up to the task yet of coding in such a feature.

Edited to add:
In fact, even exits wouldn't be that difficult. It would probably require a little bit of additional code, but using the tick triggers, you could have a mob go through and basically create new exits by closing/opening and locking/unlocking doors. An additional exit flag that could be set on these exits to basically not act as a door (not be recognized when a player attempts to "bump" into it or when they attempt to open/close) would also take care of any issue of seeming obvious or sloppy to the players.

The thing about adding to your mob programs is a lot of the time, that is some of the simplest code to change that allows you to do so much because there is already so much there to go off of. That's one of the places I started with when I was learning to code.
25 Nov, 2008, David Haley wrote in the 14th comment:
Votes: 0
Having to do that for every single mob and object and possibly even some exits in every single area of the game sounds like an awful lot of work to me, frankly. It is "possible", but hardly practical, which is what I meant in my previous post. As you say, hard-coding it would be much easier in the long run.
26 Nov, 2008, Hades_Kane wrote in the 15th comment:
Votes: 0
DavidHaley said:
Having to do that for every single mob and object and possibly even some exits in every single area of the game sounds like an awful lot of work to me, frankly. It is "possible", but hardly practical, which is what I meant in my previous post. As you say, hard-coding it would be much easier in the long run.


A good bit of my early building experience was on MUDs with coders that didn't really do much in the way of making things easier for builders. So a lot of my first instinct on things like that automatically goes toward how you can program it. That likely has a lot to do with why I've spent probably more time improving OLC and our programs to make things easier and more stable for the builders on my game than in any other area of the code :p

Even still, the task of basically building every area in the game twice will be quite a feat.
26 Nov, 2008, David Haley wrote in the 16th comment:
Votes: 0
Hades_Kane said:
Even still, the task of basically building every area in the game twice will be quite a feat.

What I would do would be to build the base area, and then have a script of some kind that duplicates the area automatically; then, you can edit the alternate area as you see fit.
0.0/16