luckylucifer Posted April 14, 2005 Share Posted April 14, 2005 Confusing myself really but if you can make sense please help. I have been away from the TESCS for a while now and have just rekindled my passion and have decided to complete my mod that I started having ideas on years ago.Im sure I came across documentation on which described to me how to make an NPC change location at different times of the day. For example 'NPC would be around town in the morning and all day on sunday and then would be found at the inn at night'. Can anyone help me with the script that would make this happen?A much simpler script would be great because what Ive described isnt the exact situation and I suppose complicated. The final situation that would be perfect for me would be a much more complicated script entailing the NPCs whereabouts throughout the year, with prime locations and times that would be lost out on if missed. Is it also possible to have the NPC change cloths according to the location aswell? (I will be getting Bloodmoon and Tribunal soon so if it only works for them that would be great too) Any help much appreciated! Link to comment Share on other sites More sharing options...
Abramul Posted April 14, 2005 Share Posted April 14, 2005 As I understand it, the way to do it is to have several different copies, one at each location. But if you try and do too many scripted NPCs, it might slow things down. Not entirely sure, though. Link to comment Share on other sites More sharing options...
Adras Posted April 14, 2005 Share Posted April 14, 2005 There are several mods that do this. I dont know the names offhand, but I can get the names when I get home later. Link to comment Share on other sites More sharing options...
Kevin Woodman Posted April 14, 2005 Share Posted April 14, 2005 use positioncell and the global variables GameHour , Day, and Month. Use removeitem and additem and equip to change clothes. Link to comment Share on other sites More sharing options...
Wookiee Posted April 14, 2005 Share Posted April 14, 2005 yep learn to script :) and if you know how already go for it :) Link to comment Share on other sites More sharing options...
luckylucifer Posted April 15, 2005 Author Share Posted April 15, 2005 Ok, that's great! Ill learn to compile such a script. One thing though, to get my NPC to stand where I want him to be is it as simple as making duplicate NPCs that contain the script in the different locations? (Still a bit confused) Thankyou Link to comment Share on other sites More sharing options...
Kevin Woodman Posted April 15, 2005 Share Posted April 15, 2005 The easy way is to just make duplicate NPC's but if you want them to NOT be there in all locations all the time, use one and script it to move locations. What I would do, is to figure out the coordinates you need to place them at, the easy way is to place the NPC in the various locations, you don't need to make a new ID as you will delete them from the cell later. With the NPC placed, single click on it, at the bottom of the editor theres an info line, it will display the object ID(yourNPC ID), Object Type(NPC), and Coordinates. The coordinates will look something like: 291, 537, 261 [0, 0 , 204](Balmora, South Wall Cornerclub) or -22459, -14094, 576 [0, 0, 182](-3, -2) The second example i used is a guard in Balmora -3, -2 Write down the first 3 numbers and the last one in the [ ] and the cell name the first example would be PositionCell 291, 537, 261, 204, "Balmora, South Wall Cornerclub" the second examplePositionCell -22459, -14094, 576, 182, "Balmora (-3, -2)" Then you can remove all of them except one from the gameworld, where you want your NPC to start out at. When making the script, use the IF command to test for conditions. Using the global variables built in to morrowind, I mentioned, GameHour. If ( GameHour == X ) Using == <= >= as appropriate X being the value of the time you figure on. Then use postioncell to move the NPC you'll have to set a DoOnce type of variable or your npc won't be able to move as it will continuously be placed at that spot. Declare the variable ( you can use your own variable name as long as it isn't a global or command) example from one of my mods: short DoOnce If ( doonce == 0 )"K_Elf_Crusader"->positioncell, 4132, 3750, 14048, 0, "Bosmer Island, Elidora's House"set doonce to 1endif This would work if you only moved the NPC once but since this would be daily you'll have to figure out how to reset the doonce variable or try something else entirely. I'm not sure the best place to set it before or after the gamehour condition, i'd have to experiment a little. I haven't attempted anything like this and i'm still a caveman scripter, Download scripting for dummies if you haven't already, it lists what the gamehour day and month values mean. And just about everything else. On changing clothes, usually you simply just have to removeitem then additem and the clothes automatically equip, if not use the equip command. use or disregard anything above, i hope this helps, i confuse myself as well. oh you you might need to add a part in the script to check if he's dead, so his corpse doesn't travel. LOL Link to comment Share on other sites More sharing options...
luckylucifer Posted April 15, 2005 Author Share Posted April 15, 2005 Thanks Kevin for making it allot simpler to understand! Ill let you know how it all goes. (Might be a while considering) But yeah, Im sure that what I intend to do will happen with a bit of concentration and persaverance! Much appreciated once again! What an awesome forum with pretty much everything you need to know and instant replies. Link to comment Share on other sites More sharing options...
Kevin Woodman Posted April 15, 2005 Share Posted April 15, 2005 I thought of something else You can keep the NPC from disappearing untill you leave the cell. Won't matter unless you are in the same cell. If ( GetPcCell "Balmora" == 1 ) If ( CellChanged == 1 ) Just more variables and conditions to complicate things, but it'll look better. Link to comment Share on other sites More sharing options...
Kevin Woodman Posted April 15, 2005 Share Posted April 15, 2005 Darn it! you got me thinking about it, I couldn't help but attempt to piece something together. Heres a simple script format i put together that moves an Npc at different times during the day, no weekends or change of clothes added yet. This is not a working script just a script idea, it should work if all the variables are added, I haven't tested it yet. It's the best my feeble mind can muster up so far. begin outtolunch short timeofdayshort locationshort currentdayshort doonce ;timeofday day = 1 (npc is at work );timeofday lunch = 2 (npc is out to lunch?);timeofday night = 3 (npc is at home ) ;location one (work) = 0;location two (lunch)= 1;location three (home) = 2 ;check to see if actor is dead if ( "actorID"->gethealth <= 0 )returnendif ; check for day changeif ( currentday != Day )set currentday to dayset doonce to 0endif ;set timeofday variableif ( GameHour >= x ) If (gamehour <= x ) set timeofday to 1 ;daytime endifendif if ( GameHour >= x ) If (gamehour <= x ) set timeofday to 2 ;lunchtime endifendif if ( GameHour >= x ) If (gamehour <= x ) set timeofday to 1 ;daytime endifendif if ( GameHour >= x ) If (gamehour <= x ) set timeofday to 3 ;nighttime endif endif ;moving the actor If ( DoOnce == 0 ) if (timeofday == 1) If (getPccell "home" != 1 ) positioncell x, y, z, z, "work" set location to 0 set doonce to 1 endif endifendif If ( DoOnce == 1 ) if (timeofday == 2) If (getPccell "work" != 1 ) positioncell x, y, z, z, "lunch" set location to 1 set doonce to 2 endif endifendif If ( DoOnce == 2 ) if (timeofday == 3) If (getPccell "work" != 1 ) positioncell x, y, z, z, "home" set location to 2 set doonce to 3 endif endifendif ; if pc is in npc home when time changes npc will stay home untill pc leaves cell; if pc is at npc work when lunchtime npc will stay at work untill pc leaves; if pc is at npc work when closing time npc will stay at work until pc leaves. end outtolunch 2 daytimes are required one before lunch and one after, but should need only one variable setting. The variable - location- isn't being used in this, i'm not sure what i planned on using it for, maybe for change of clothes or other things. Dsposition posibly, the npc is nice at work but a jerk at home or vice versa. 8-) <- nerdy smile Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.