Blizzardream Posted December 31, 2007 Share Posted December 31, 2007 I've posted this in the main bethesda forum. It was originally a two part question and the first part was thankfully answered. Unfortunately the second part is the bigger more pressing problem. I've reposted the unanswered question. Please help, thank you. I'm making a mod that adds a city. Outside the city is a castle. The castle has multiple cells and its inhabitants (along with everyone else in the city) have complicated, tightly scheduled and highly choreographed AI packages. While play testing I noticed that when an NPC has to travel through more then one cell to reach its end destination, it can take upwards of an hour to arrive. To fix this I added hidden teleport doors behind existing "local" doors that bypass excess cells and lead directly to the street. The castle is my most complicated building so far and has people in it who need to get from one end of the castle to the other without taking hours to do so.It is my first building with interior bypassing teleport doors. The problem is since the computer tries to calculate the shortest path, it can end up going to teleport doors or local doors in close proximity to its location in a cell but out of its way in the grander scheme of its path to its destination. Making it take longer to get there. For instance a guy can be located on the right side of a room, but the teleport door to the outside world is on the far left side, far meaning further away then the door on the right side. In the room that the right side door connects to is a teleport door that leads outside. He'll go through the right door, the excess cell and through the extra door, rather then just going to the left side end of the first room. I can fix this by locking certain doors, but I need a way to add and remove keys from certain people during and after certain packages. Unfortunately I don't know how to do that. I don't know if I need a script or if there is some way of using package conditions to get the same effect. I've posted a link to a diagram of my castle if it helps. http://i152.photobucket.com/albums/s...v059help01.jpg The various greens are just used so that the lines don't get confused. Here is the second related problem. Just one quick question about the script (when and if one is provided) would I have to make a script for each individual NPC that I want to have gain or lose inventory items or is it possible to have one large script that covers each person. Like instead of: Guy A, Script A.Guy B, Script B. Is it possible to have: Start script guy Aend guy bend. It's just I don't have a lot of script experience and don't know what scripts or script effects I might need later on. So I don't really know how script effects "stack". So if guy A has script A attached to him can it be added to later on, even if whats added later on has nothing to do with adding or subtracting inventory items? Or do I need a larger over-arching script that works something like if package travel Aand if npc guy A add key A end if package travel Band if npc guy Bremove key B Does this make sense? Thank you. Link to comment Share on other sites More sharing options...
Vagrant0 Posted December 31, 2007 Share Posted December 31, 2007 For your time problem, I've found it's just easier to use a better timescale than the default. Afterall, few people use the default anyway since it moves so damn fast. You could do this with "set timescale to #", but as this can cause issues with some of the quests in the game, you might want to use http://www.tesnexus.com/downloads/file.php?id=5859 since it fixes those scripts that are based off timescale. The settings in that plugin are 15, which is half, but you could probably go down as low as 6 or 8 without making time move too slowly. You could even incorporate the changes of that mod into your own so that anyone using your mod wouldn't have any issues. This removes the necessity of dealing with teleport doors or any of that nonesense because really, you can't do a whole hell of alot to force an NPC to follow a specific path. Adding/removing keys, locking doors, setting preferred path points, none of these will really solve the issue without further complications. You'd probably accomplish more just by upping everyones speed and athletics so that they walk faster. The problem with adding/removing keys is this. If you're using individual scripts for each NPC you would need the script to have conditions to check what specific package is being used at that time. Lots of NPCs using these scripts constantly can lead to some significant performance loss. Those scripts might also fail to run reliably since most scripting grinds to a near standstill if the player isn't nearby, and if the NPCs need a key to reach a location, they may end up not reaching that location, but having their next location being called when they aren't in a room where they can open any of the doors to get there. An overarching script would probably have to be setup within a quest so that it is constantly running, and then add/remove keys on an hourly basis from NPCs which need those keys. It will probably be a bit less complicated if you know your NPCs scheduals well enough, and will probably be less resource dependant and open to problems, but it still probably won't fix your problems. Sometimes you do have to build some sort of Rube Goldberg, but often it's much more practical to just find another way. Your whole problem could be fixed just by changing the timescale, if only while near the building. Link to comment Share on other sites More sharing options...
Blizzardream Posted December 31, 2007 Author Share Posted December 31, 2007 The problem with adding/removing keys is this. If you're using individual scripts for each NPC you would need the script to have conditions to check what specific package is being used at that time. Lots of NPCs using these scripts constantly can lead to some significant performance loss. Those scripts might also fail to run reliably since most scripting grinds to a near standstill if the player isn't nearby, and if the NPCs need a key to reach a location, they may end up not reaching that location, but having their next location being called when they aren't in a room where they can open any of the doors to get there. Ugghhh crap. I kind of already know what you're talking about. Sometimes during playtesting I'll "tfc" around to watch what my npcs do without getting in the way, but they don't actually work unless my character is physically close. I tried using the set timescale to 15 thing. And that seemed to work well. Obviously though I need to tweak it and try other settings. This has worked well, and I think it is what will be implemented in my mod. (Though now I have to remove excess doors) I just have one small issue remaining. Is it possible to create a script that automatically acitvates this change? I would rather have something that works in the background then have to add instructions to my readme (which not everyone bothers with). Also I ask because I would like to adjust it in one particular cell. In the rest of the mod I would like to leave the game running at 15 (or 10 or 8 or 6 depending on what works best) but in one cell I would like the game to run at regular speed. The NPCs in that cell have very, very choreographed behavior, that at slower speed, when finished, would leave long gaps of emptiness. So what I would need (if possible) is something like begin normal gameset timescale to 15 if in cell creepyruin01 set timescale to 30 end Or something like that. (my scripting ability is somewhat wanting) Regardless this has been very helpful. Thank you. Link to comment Share on other sites More sharing options...
Vagrant0 Posted December 31, 2007 Share Posted December 31, 2007 The problem with adding/removing keys is this. If you're using individual scripts for each NPC you would need the script to have conditions to check what specific package is being used at that time. Lots of NPCs using these scripts constantly can lead to some significant performance loss. Those scripts might also fail to run reliably since most scripting grinds to a near standstill if the player isn't nearby, and if the NPCs need a key to reach a location, they may end up not reaching that location, but having their next location being called when they aren't in a room where they can open any of the doors to get there. Ugghhh crap. I kind of already know what you're talking about. Sometimes during playtesting I'll "tfc" around to watch what my npcs do without getting in the way, but they don't actually work unless my character is physically close. I tried using the set timescale to 15 thing. And that seemed to work well. Obviously though I need to tweak it and try other settings. This has worked well, and I think it is what will be implemented in my mod. (Though now I have to remove excess doors) I just have one small issue remaining. Is it possible to create a script that automatically acitvates this change? I would rather have something that works in the background then have to add instructions to my readme (which not everyone bothers with). Also I ask because I would like to adjust it in one particular cell. In the rest of the mod I would like to leave the game running at 15 (or 10 or 8 or 6 depending on what works best) but in one cell I would like the game to run at regular speed. The NPCs in that cell have very, very choreographed behavior, that at slower speed, when finished, would leave long gaps of emptiness. So what I would need (if possible) is something like begin normal gameset timescale to 15 if in cell creepyruin01 set timescale to 30 end Or something like that. (my scripting ability is somewhat wanting) Regardless this has been very helpful. Thank you.You can script a time change to any event really. Depending on how many exits that room has, you could probably have it setup to change based on when the player activated the doors into and out. But what do you mean "very choreographed behavior" exactly? Are you relying on the time scale to make it so that when an NPC completes one package, they will call the next, or what? You could always give them a standby package which they will use when they are done with whatever they were supposed to do within that cell to fill the gap. You could also script NPCs to call one package after their current one completes so that they act without any concern for time. Link to comment Share on other sites More sharing options...
Blizzardream Posted January 1, 2008 Author Share Posted January 1, 2008 You can script a time change to any event really. Depending on how many exits that room has, you could probably have it setup to change based on when the player activated the doors into and out. But what do you mean "very choreographed behavior" exactly? Are you relying on the time scale to make it so that when an NPC completes one package, they will call the next, or what? You could always give them a standby package which they will use when they are done with whatever they were supposed to do within that cell to fill the gap. You could also script NPCs to call one package after their current one completes so that they act without any concern for time. I could use a script that when the player loads up their game automatically slows down the timescale. Or maybe is attached to an object that allows the timescale to be adjusted. (Though preferably the former). But that leaves one particular cell unaffected, or updates as the player enters the room. As for why... I've made and posted a video of the cell in question. The scribes that catalog and the scribes in the meeting are why I need the timescale in that room to remain unaltered, otherwise their final gap filling, talk and paint animations dominate the behavior of the hour(s) that they work. They basically have very long strings of AI packages that are triggered one after the other, and are co-ordinated\choreographed to give the appearence of lifelike behavior. Link to comment Share on other sites More sharing options...
Vagrant0 Posted January 1, 2008 Share Posted January 1, 2008 You can script a time change to any event really. Depending on how many exits that room has, you could probably have it setup to change based on when the player activated the doors into and out. But what do you mean "very choreographed behavior" exactly? Are you relying on the time scale to make it so that when an NPC completes one package, they will call the next, or what? You could always give them a standby package which they will use when they are done with whatever they were supposed to do within that cell to fill the gap. You could also script NPCs to call one package after their current one completes so that they act without any concern for time. I could use a script that when the player loads up their game automatically slows down the timescale. Or maybe is attached to an object that allows the timescale to be adjusted. (Though preferably the former). But that leaves one particular cell unaffected, or updates as the player enters the room. As for why... I've made and posted a video of the cell in question. The scribes that catalog and the scribes in the meeting are why I need the timescale in that room to remain unaltered, otherwise their final gap filling, talk and paint animations dominate the behavior of the hour(s) that they work. They basically have very long strings of AI packages that are triggered one after the other, and are co-ordinated\choreographed to give the appearence of lifelike behavior. Alright. I get what you're talking about now. While this could still be done just by having scripting call one package after another, it would probably mean more work, and may make an already complicated scene have a bigger performance problem. You do have all packages in this room to ignore fallout behavior right? Anyway, as far as the timescale thing goes, I think I saw a way you could do this fairly easily. Are the doors to the room leading to another cell, or to somewhere within the same cell? You could use scripting on he doors to change the time scale. You could probably do this with a single script on both sides since you have known and static conditions. The script would look something like: begin onactivate if getactionref == player if timescale == 30 set timescale to 15 else set timescale to 30 endif activate else activate end You'd need the script on both the enterances and the exits to that room. Change 15 to whatever you found works best. As for setting it to that number initially when the player gets near your city, this might be a bit difficult given the size of your city and being built within the tamriel worldspace. Even setting up a series of points to trigger the change based on proximity to the player probably wouldn't work so well. You might just need to force a constant timescale onto the player (like what I did in that little fix) and just leave it at that. You're welcome to take the scripting changes in my mod and add it to your own so that players don't have any issues with those quests and your mod. As for your AI wierdness, this might be due to a number of things. When you setup path grids, did you make multiple routes through a single area and set a series of preferred points? http://cs.elderscrolls.com/constwiki/index...gory:Path_Grids Even through tight areas its usually a good idea to setup more than one path so that if NPCs are going through there at the same time they aren't walking squarely into eachother. Since NPCs will always head to the nearest linked point you can set routes though a tight area by not having one route connect to the other (or meating up with the main grid of the room)until the NPC is through that spot. You can further dictate paths by having points on one side of the route begin closer to existing nodes on one side of the room grid. NPCs on that one side of the room wll always take that route through. This can be done on the otherside to have the same effect. And how are the travel packages setup. Are you using follow? escort? travel? or what? Are you using "get distance" within the conditions of these packages? You should probably use a single follow and travel package for each destination. If you're having problems with one NPC keeping up with another, setup a temporary wait package to be triggered when one gets too far ahead of the person following them. You could do this without adding scripting just by having the conditions of the travel package check distance, and having a wander current location package setup in the same timeframe as the travel package (placed lower) so that when the conditions of the travel package become invalid, the NPC will wait up until they become valid again. This doesn't solve issues where one of them is dead, but that instance can be solved with a third package within the same timeframe that checks for a isdead condition and just as them travel to the location alone. How many NPCs do you have in the loaded area while these things are happening? The AI can get dim very quickly when you have too many NPCs around. Link to comment Share on other sites More sharing options...
Vagrant0 Posted January 2, 2008 Share Posted January 2, 2008 Hmm, dunno what the problem with that mod was... Anyway, here are the scripts that you'll need to include in your mod. Scriptname MS14RytheScript short Doonce short Doonce1 short Doonce2 short ComeHome short Duration short Talk short PackDur short Tscale float WaitTimer begin gamemode ;forcegreet player if ( GetStage MS14 >= 40 ) && ( Player.GetDistance RytheRef <= 600 ) && ( Talk == 0 ) StartConversation Player, Greeting set Talk to 1 endif end ;Triggers Rythe to come through portal Begin OnPackageEnd MS14RytheMovetoDoor if ( GetStage MS14 >= 72 ) if ( ComeHome == 0 ) set MS14.GoHomeRythe to 1 RytheRef.Evp MS14ReturnPortalDoorRef.Playsound SPLIllusionCast MS14MagicMarker.pme RALY MS14MagicMarker02.pme RALY MS14MagicMarker03.pme RALY MS14MagicMarker04.pme RALY set ComeHome to 2 endif endif end Begin OnPackageEnd MS14RythePaintsaWayHome if ( GetStage MS14 >= 72 ) && ( Doonce2 == 0 ) MS14ReturnPortalDoorRef.Playsound SPLAlterationCast MS14MagicMarker.pme RALY MS14MagicMarker02.pme RALY MS14MagicMarker03.pme RALY MS14MagicMarker04.pme RALY MS14ReturnPortalDoorRef.Enable set Doonce2 to 1 enableplayercontrols set timescale to tscale endif end begin gamemode ;Stops the UseItem for Painting if ( GetIsCurrentPackage MS14RythePaintsaWayHome == 1 ) && ( Duration == 0 ) if timescale <=5 set tscale to timescale set timescale to 5 else set tscale to timescale endif set packdur to timescale/10 if packdur < 1 set packdur to 1 endif setpackduration packdur set Duration to 1 disableplayercontrols endif ;Stage 75 if ( Doonce2 == 1 ) if ( WaitTimer < 5.0 ) set WaitTimer to ( WaitTimer + GetSecondsPassed ) else setstage MS14 75 RytheRef.Evp set Doonce2 to 2 endif endif ;starts conversation with Rythe's wife when he gets back if ( GetStage MS14 >= 80 ) && ( MS14.Talking != 4 ) startconversation TivelaLythandasRef MS14ReturnHome endif ;resumes conversation with player after done with wife if ( GetStage MS14 >= 80 ) && ( Doonce1 == 0 ) && ( MS14.Talking == 4 ) && ( MS14.DoneTalking == 1 ) startconversation Player Greeting set Doonce1 to 1 endif end Scriptname MS02VelwynScript short BenirusGreet short Doonce short Doonce1 short Doonce2 short Doonce3 short SeeDoor short Duration short Tscale float Timer float Timer2 ;Move Velwyn back to Anvil from IC at Stage 80 begin gamemode if ( GetStage MS02 >=80 ) && ( MenuMode == 0 ) && ( Doonce == 0 ) && ( Player.GetInCell ICElvenGardensTheKingandQueenTavern == 0 ) VelwynBenirusRef.MoveTo MS02VelwynReturnMarker VelwynBenirusRef.EvaluatePackage Set Doonce to 1 endif ;Deals with Velwyn getting near the secret door if ( Doonce3 == 0 ) if ( GetStage MS02 >= 87 ) && ( VelwynBenirusRef.GetDistance MS02BenirusManorOpenSecretDoor <= 400 ) set SeeDoor to 1 setstage ms02 88 VelwynBenirusRef.EvaluatePackage Set Doonce3 to 1 endif endif ;Stops the UseItem for SearchWall if ( GetIsCurrentPackage MS02VelwynUsesDoor == 1 ) && ( Duration == 0 ) set tscale to timescale/1.5 if tscale <= 1 set tscale to 1 endif setpackduration tscale set Duration to 1 disableplayercontrols endif end ;Forcegreet when Velwyn gets inside of Manor and set Velwyn to Follow begin onPackageEnd MS02VelwynManorEscort if BenirusGreet == 0 if ( GetStage MS02 <= 85 ) setstage MS02 87 VelwynBenirusRef.StartConversation player, Greeting set BenirusGreet to 1 set MS02.BenirusFollow to 1 VelwynBenirusRef.EvaluatePackage endif endif end ;Deals with the actual secret door open and Stage 90 set begin OnPackageEnd MS02VelwynOpensDoor set MS02.DoorCheck to 1 VelwynBenirusRef.EvaluatePackage end begin OnPackageEnd MS02VelwynUsesDoor set MS02.Runaway to 1 VelwynBenirusRef.EvaluatePackage setstage MS02 90 enableplayercontrols BenirusDoorRef.Activate VelwynBenirusRef set Doonce2 to 1 end These are both scripts for Vanilla quests that get broken if you use a different timescale. My changes to these scripts make them work with any timescale. As for the initial setting, make a start enabled quest script that just changes the timescale once, and then completes the quest. As far as changing it back while in that room, since you have only 1 way in and out, that bit of scripting I provided in my previous post should do the trick. You should however make a mention of these changes to the timescale since many people already have some changes active in their games, and might want to know whats happening and why. I didn't download your mods, but looked at what videos there were. The part about pathing was also about some of the other parts in your video where you had NPCs trying to walk through eachother (that woman and her dog). Link to comment Share on other sites More sharing options...
Blizzardream Posted January 3, 2008 Author Share Posted January 3, 2008 Gracias. I'll try fixing it tomorrow. This problem has coincided nicely with christmas, and I've used the break to play the living crap out of my christmas presents. Link to comment Share on other sites More sharing options...
Blizzardream Posted January 8, 2008 Author Share Posted January 8, 2008 OK I haven't even gotten to the point where I've added the scripts yet. (Though I will at some point) I've been playtesting where upon loading, I manually change the timescale. I've basically settled on 15 because at 10 the NPCs take a ridiculously long time to leave their home cells. Further playtesting has revealed a pattern of slowed behavior leaving long gaps of inactivity, that used to rely on the previous timescale to fill out. I.E. the time between 3 and 4 meant that someones actions would finish and start reasonably well choreographed, but now there is a long pause where a guy will just stand there when his 3 packages end, waiting for his 4 packages to start. Which at a regular timescale would look more like one fluid set of actions. Which means I have to add some filler here and there. (More work. Yea.) Also I've noticed that even though it is less severe then at 10, at 15 it can still take a while for the NPCs to arrive at a secondary destination (they do leave their houses at a more reasonable time though). Like I'll be waiting at the inn for someone from the church to arrive and they take quite a while to do. So again, making progress, but every problem solved sprinkles the seeds of new ones to take its place. :) Link to comment Share on other sites More sharing options...
Vagrant0 Posted January 8, 2008 Share Posted January 8, 2008 OK I haven't even gotten to the point where I've added the scripts yet. (Though I will at some point) I've been playtesting where upon loading, I manually change the timescale. I've basically settled on 15 because at 10 the NPCs take a ridiculously long time to leave their home cells. Further playtesting has revealed a pattern of slowed behavior leaving long gaps of inactivity, that used to rely on the previous timescale to fill out. I.E. the time between 3 and 4 meant that someones actions would finish and start reasonably well choreographed, but now there is a long pause where a guy will just stand there when his 3 packages end, waiting for his 4 packages to start. Which at a regular timescale would look more like one fluid set of actions. Which means I have to add some filler here and there. (More work. Yea.) Also I've noticed that even though it is less severe then at 10, at 15 it can still take a while for the NPCs to arrive at a secondary destination (they do leave their houses at a more reasonable time though). Like I'll be waiting at the inn for someone from the church to arrive and they take quite a while to do. So again, making progress, but every problem solved sprinkles the seeds of new ones to take its place. :)If you're waiting inside a cell, NPCs which are outside that cell will be slowed down or stopped once they leave the area that is currently loaded. I think you might be nitpicking with the AI a bit. Some inconsistancies will be there no matter what you do. Rather than adding another 1 hour long package, you could just start one earlier, or have a any/any wander package setup at the bottom of their package list so that when they don't have anywhere to be, they will wander the area, or perfrom some other default task (like finding ingrediants). This might make it so that your NPCs don't look quite so busy, going from one place to another right away. You might also be able to impact travel times slightly by increasing the speed or athletics of the NPC. At any rate, you'll have to realize one thing. In addition to mods which affect timescales, people also use mods which change movement calculations. So what might be a smooth transition for you might end up being an NPC just standing there for a minute for someone else, it might also be that the NPC doesn't reach their destination on time. The good news is that unless you're having the player follow the NPCs, nobody will take notice of these things. People playing the game are simply too distracted with whatever things they have to be doing to pay that close attention to things. In those rare cases where you do need a smooth fluid transition, you can use scripting on the NPC to cause packages to be called as one finishes regardless of time. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.