RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[1.0-2.0] Sleeping npc's

David

Moderate
[1.0-2.0] Sleeping npc's

Summary:
Compatible with RunUO 1.0 and 2.0.
Causes an npc to appear to go to sleep on a set schedule based on a UO day.

Update:
12/5/04 Players may no longer drop items (such as BOD's) onto the sleeping body. Only SleepingBody.zip updated. Thanks Silverwolfe.
12/2/04 Setting the Bed location to (0,0,0) will now cause the npc to sleep at it's current location rather than the top left corner of the map. Only Sleeper.zip updated.

Description:
This device should be placed near an npc such as a vendor. When properly configured, the Sleeper will remove the npc and place a sleeping body at a predetermined position. Times are based off of UO time and are in 24 hour format (23 is 11 PM, 0 is midnight.)

Settings in Props are:
SleepHour, SleepMinute; when the npc should go to sleep.
WakeHour, WakeMinute; when the npc should wake up.
Mobile; who to send to sleep.
Bed; where they go to sleep at.
Facing; the direction of the sleeping body (opposite what you would think.)
Active; an on / off switch.
Debug; when set to true Sleeper displays time info at every timer tick.
Asleep; read only indicator of current status of npc.
TimeNow; read only indicator of current local UO time.

Additional Information:
At sleep time, the npc will disappear and a visually identical sleeping body will be placed in the location set by the Bed property. At wake time the sleeping body will be deleted and the npc will appear standing on the Sleeper. In most cases you will want the Sleeper placed within the npc's normal range. In some cases, and only on server restart, the npc may be asleep or awake at the wrong time or sleep unclothed. This will correct itself within one UO day.

Notes for users of the Ultima VII spell package:
Two files; SleepingBody.cs, SleepingBodyEquip.cs, together with SleepingNameAttribute.cs replace files in the Ultima VII spell package. These files are compatible with the spell package and enhance it by clothing the sleeping body as well as adding a SleepingName attribute which can be added to creature scripts. The SleepingName attribute is used exactly like the CorpseName attribute is used. (edit: Check the file dates / versions Voran may have updated his scripts. You only need one copy of SleepingBody.cs; use whichever one is most current.)

2.0 Notes:
This script works without modification in RunUO 2.0.

Installation:
There are two zip files. Extract both into your Scripts/Custom folder. The files in the SleepingBody zip replace files in the Ultima VII spell package if it is installed. Add a Sleeper item ingame and update its props as required.

Credits:
I had intended to do something like this for the Britannia shard for a while now, it turned out pretty nice so we decided to share it with everyone. Special thanks go to Voran for his work on the Ultima VII spell package and to crabby654 for his ideas and testing.
 

Attachments

  • Sleeper.zip
    2 KB · Views: 858
  • SleepingBody.zip
    3.2 KB · Views: 754

koluch

Sorceror
Nice as always David ;)

Now I have a silly question:
Id like to have the day/night light levels a little more realistic. Could someone point me to a file where this is located, and would it override the turning off dark nights player option they have?
I dont want to make it pitch black, but think it would add a lot to actually be able to tell a "day" is passing and its night time now.
I also think it would make the whole look of the towns and houses nicer - street lamps are there for a reason :]

Shazzy
 

dstarz20

Sorceror
Dude, you rule. I remember back....Ultima 4 i think. The shop people had work schedules like this. They'd actually go to work during the day, then back to their houses at night. You could kill them in their sleep with one hit, boy was that fun.
 

David

Moderate
Script Updated

Setting the Bed location to (0,0,0) will now cause the npc to sleep at it's current location rather than the top left corner of the map. You only need to download Sleeper.zip to get this update.

Thanks for the positive comments guys!
 

sirens song

Wanderer
Intresting Idea. I wrote something semi-like this. Though my Npcs only walk inside their houses and sit down in a chair via waypoints. Id never thought of using a body. Very creative, keep up the superb work David.


-Jamie
 

DarkeWolf

Sorceror
as always, a new and innovative set of scripts from david. this is awesome! thanks for posting it!
I can also use this for a base for some of the scripts that I had in mind as well. thanks much david
 

JordanK

Wanderer
AWESOME! This sounds kinda cool, i'll add it to my server later.

Just out of curiosity, is there any chance of it being configured to follow a schedule of a real clock instead? If so, just let me know and I'll toy with it on my own time. Thanks! :rolleyes:

-- Jordan
 

David

Moderate
JordanK said:
Just out of curiosity, is there any chance of it being configured to follow a schedule of a real clock instead? If so, just let me know and I'll toy with it on my own time. Thanks!
Sure, take a look at the CheckTime() method in Sleeper.cs. Instead of Clock.GetTime() use DateTime.Now().Hours and DateTime.Now().Minutes.
 
Found and fixed a small bug. When some "Inquisitive" Players try to turn in BOD's the corpse eats it. Solution is posted here, now they sleeping body refuses to accept items dragged onto it.
 

Attachments

  • SleepingBody.cs
    7 KB · Views: 53

flowerbudd

Sorceror
one of my darling players discovered that if you do telekinisis on the sleeping vendors you can steal their items. lol
 

David

Moderate
flowerbudd said:
one of my darling players discovered that if you do telekinisis on the sleeping vendors you can steal their items. lol

That's kinda funny actually ;)

However the SleepingBody is a modified corpse without the loot. All it contains is a generic copy of the clothes the vendor was wearing; which will be deleted as soon as the vendor wakes up. The worst they could do is undress the sleeping vendor, and then hopefully be wearing the items when he wakes up. It's really a self correcting problem I think, but I will look into blocking it at the next revision.
 

otimpyre

Sorceror
Idea

Be nice if they snored. Or if it could set there title to sleeping then reset to "Blah"
Maybe they could run off an emote script. And occasionly play sound

case "snore":
SoundInt = 34;
break;
Just a thought. Great script thanx
 
Top