Jump to content

Outfit Switching AI??


Koreno

Recommended Posts

Posted

I notice that in some situations, NPCs will change their outfits. I searched the packages and could find one.

 

*GOAL*

Make NPCs in my castle switch clothing for certain occastions. A dress for dinner, a maids outfit for dusting, nightgown for sleeping... and so on. I'm pretty sure that all outfits will need to be in the NPCs inventory and they would switch them out at the start of that package.

 

Any help would be awsome!!!

Posted
I notice that in some situations, NPCs will change their outfits. I searched the packages and could find one.

 

*GOAL*

Make NPCs in my castle switch clothing for certain occastions. A dress for dinner, a maids outfit for dusting, nightgown for sleeping... and so on. I'm pretty sure that all outfits will need to be in the NPCs inventory and they would switch them out at the start of that package.

 

Any help would be awsome!!!

 

Hmm ... I'm not sure I can be much help, but perhaps there's a way if you create an AI package? If not, you might consider making a script that adds the right clothes for at the right time .. removing their old clothes so they pretty much 'change clothes' for their occasions. Other then that .. do the NPCs you've witnessed change outfits ever change back into their original clothes? If not, perhaps it's like food .. they find clothes in a barrel and 'use' them?

 

Just a thought of another noob.

 

~b

Posted

I've seen npc's change clothes; however, NEVER back to the original wear. It would be an interesting mod. but i don't know if it would be possible.

I think what you saw is npc's upgrading to another set of wear.

Posted
I've seen npc's change clothes; however, NEVER back to the original wear. It would be an interesting mod. but i don't know if it would be possible.

I think what you saw is npc's upgrading to another set of wear.

 

That's what I thought too.

 

~b

Posted

It was one of the Dark Brotherhood females... The one that roames the town once in a while in her civilian clothes. I checked her inventory in the CS and sure enough, she has both the DB armor AND 'civies'. So I am sure her AI has her switch back and forth... Ive seen her in both.

 

I hope that its not just checking the remove armor option in the package. Cause if it is, then when the remove armor checkbox is checked, then clothing is put on (if in the inventory). Thats just my thought. If this is the case.. then it may be harder than I think.

Posted

Alright, I'm going to tell you right out that this is tricky business, but if you get it working, it should have the desired effect. An NPC will only change equipment when their package changes, and then they usually end up wearing the thing of highest value/defense. In order to get this working right, you'll need to make the NPC, and add a set of clothing to their inventory. This is what they will wear when they first come in contact with the player. Any additional clothes you'll want to add to a container somewhere. The container should be accessable and you should have an individual one for each NPC. You will also need a seperate script for each NPC you want wearing different stuff as the script will be used to assign packages to get the clothing and change clothing. There are a few main things you'll want to be familiar with involving packages. I suggest checking the wiki for their usage.

 

Onpackagedone

Addscriptpackage

setpackduration

 

You might also want to be familiar with how to use a custom faction as a condition for packages, and for controling logic functions in scripts. The only example of this that I'm aware of is my Shepherd's Ring mod, and that only covers the logic aspects. So you're going to have to just go ahead and take my word for some of this. I would start with just an empty faction. Give it a name, make 4-5 faction ranks, don't worry about icons, rank titles, or anything like that as this will never be seen. Then give that faction to all your NPCs with a starting rank of 0. Aside from time, this will control the packages of your NPCs so that once they complete a specific task that they should only do once a day, or only under a specific situation. I will call this one XXServantFaction, you may name it how you want. You may eventually need more than one of these to coordinate with eachother.

 

After reading that, you hopefully have some idea of where I'm going with this. A find item package seems to work best when a specific item is set as the target, with the container that has the item as the location. Once they remove the item, they will complete the package, and re-evaluate their equipment. Now, you could simply add that package to their AI, and set the specific time to go to that location and get the item. But this would leave what they were previously wearing still in their inventory.

 

This is where you need the scripting stuff. When they get to their container, you want them to remove everything, then take specific stuff out of the container to put on. The easiest way to accomplish this would be to put something in that container that isn't worn, wouldn't look out of place, and wouldn't attract a player to go and take it. A Quill I think works best in this situation since most clutter mods don't assign any value to it. A custom note or something could also work, maybe even suggesting to the player to put the item back. Either way, setup a find package with that container as the location, and that item as the target, name all the packages how you want, I'm going to refer to this one as XXGetQuill. Then you'll need another package, same location, this time with the specific id of the shirt, I am naming this one XXGetShirt. And another one for the id of the pants, XXGetPants. Give XXGetquill the condition "Getfactionrank XXServantFaction == 0" setting the time of the package to when you want them to change and having "must complete" checked. Make sure XXGetshirt and XXGetpants has no time constraints, and DOES NOT have a "must complete" or "must reach location" flag. Only add XXgetquill to their AI as this is the only package of this group that you want to remain all the time. Then setup a script that looks something like this:

 

scn XXServantScript

 

Ref servant

short var1

short var2

 

Begin Gamemode

 

Set servant to get self

if get gamehour <=5 ;this acts as a secondary reset, you will understand later

set Var1 to 0

set Var2 to 0

servant.setfactionrank XXservantfaction, 0

endif

end

 

Begin Onpackagedone XXgetquill

if var1 != 1

set var1 to 1

servant.removeallitems XXmycontainer 1

set var2 to 0

endif

 

if var2<= 0

addscriptpackage xxgetshirt

set pack duration 2

endif

if var2== 1

addscriptpackage xxgetpants

set pack duration 2

endif

end

 

Begin Onpackagedone xxgetshirt

set var2 to 1

end

 

Begin Onpackagedone xxgetpants

set var2 to 2

servant.setfactionrank xxservantfaction, 1

evp

end

 

Provided I didn't make any mistakes, and your names match mine where appropiate, that should make it so that when your NPC runs the quill package, they access the container, put all their items inside. Then access it again, taking out the shirt, access it a third time, take out the pants, then stand there in the new clothes.

 

Any packages you want them to do while wearing those clothes could be set on hours overlapping the change action, but with the faction rank of 1 as a condition. By this I mean that XXgetquill could be set to start at 6am, with 12 hours in the duration (ensuring that they change into their clothes no matter what). The work you want them to do could then be set at 7am for 5 hours. If they go through the process of changing clothes (you still need to make sure that the inventory of the container has those items). Once they change into those clothes, they will start working at 7am, and then stop at noon idle for the rest of the day. If, for whatever reason, they didn't change clothes yet, they will try to do so until 6PM.

 

You might want to copy the process I outlines again within the same script, but being called by different packages, to change them back into their default clothing so that everything will continue to recycle. While I have one reset inside the script, you will need another one within a "onpackagecomplete" block incase the player isn't near them durring those hours. I find this works best after a sleep package has been completed.

 

My script might have a few small errors, I didn't actually test it or anything. You should try and debug this stuff on your own as you will certainly have to do the rest of the scripting yourself. At best, I just gave you an idea of how you could get this done. You will however need seperate scripts and package sets for each of the NPCs you want to do this with as sharing containers, or packages like this could lead to problems. If you've understood anything I've said, that should be simple enough.

 

As I said, this is tricky stuff, I've ended up using most of the systems shown here in a mod I'm working on, so it should be completely possible to pull off. If you can grasp the fundimentals of what I've explained, you could do some pretty interesting stuff if you're willing to put forth the effort. Warkirby, make a note of this too as you'll probably want to do the same thing.

Posted

I am sooo sorry man... I understood some of that but most of it I did not. I have never done any scripting ever. So I wouldnt begin to know where to put this script or how to use it or anything.

 

The only part I understood was the part where you talked about setting the AI package to find the container and ob.ject inside it.

 

I guess you could call me a Pre-Novice at this modding stuff.

 

Sorry to have wasted your time. :(

Posted
I hav never noticed it b4, there is probably some sort of time script.
Posted
I am sooo sorry man... I understood some of that but most of it I did not. I have never done any scripting ever. So I wouldnt begin to know where to put this script or how to use it or anything.

 

The only part I understood was the part where you talked about setting the AI package to find the container and ob.ject inside it.

 

I guess you could call me a Pre-Novice at this modding stuff.

 

Sorry to have wasted your time. :(

 

That's alright, I'm sure someone will eventually come across this topic and find exactly what they need. You however might want to learn some of it as you will need a basic knowledge of scripting to do pretty much anything. I think I covered pretty much where you need to attach what, so you might even want to just try it in a seperate mod, and use that for learning.

 

As for your question about that DB woman, yeah, all it is is having "armor unequipped" and "weapon unequipped" as part of that package. Some of the NPCs involved in the Anvil Sirens quest also do this. It's cheap, and won't really help you in this case... Unless you make one of the outfits count as light armor, and only want them to switch between the two. Hopefully by the time you want to try doing this I could have a better example of using factions to control both packages and logic functions as this kinda requires some outside the box thinking. My NPC mod uses this heavily, and havn't had any problems with it.

 

There are ways to base scripted stuff off of time, but in this case it isn't needed since the packages already control this and are alot more reliable. Scripts are based on blocks, each block is noted by a new "Begin" statment followed by a starting condition for that block. Gamemode runs constantly, but when the player isn't around it tends to slow down greatly. Onpackagedone blocks however run the moment the NPC finishes that package, so no matter where the player is, even if they are sleeping, the code inside the Onpackagedone will get executed.

 

The script I wrote is designed to work independant from where the player is, or what they're doing (provided there is another reset after a sleep package has been done). This means that if the player enters durring the day, after a long time of being away, they will see the NPCs in proper attire and working just ste same as if they had followed those NPCs around the entire day. Using the light armor method would also accomplish this, but wouldn't have as much possibility, and would lack a certain amount of look and coolness.

Posted

Some question for you Vagrant0.... I'm trying to learn some basic concepts of scripting. I taught myself html and some other stuff, so I hope I can pick this up.

 

1- Is the block Begin Gamemode the main block and the blocks Begin Onpackagedone XXgetquill

, Begin Onpackagedone xxgetshirt, and Begin Onpackagedone xxgetpants just reside inside the the main block?

 

2- Is this line correct? The ! symbol jumps out at me as not belonging.... if var1 != 1

 

3- In the line Ref Servant, Is 'Servant' the ID of the NPC in question?

 

4- In this line (if get gamehour <=5 ;this acts as a secondary reset, you will understand later) I am confused. Do I need to remove the ; and the text after it? And what does changing the 5 to a differnet number change. Is 5 the length of one of the packages?

 

5- WHats the reason for setting this fictional faction to 0 at the beginning? Is this because the I will make a condition of the faction being 0 to perform the package?

 

6- SO the setting of the faction to 1 at the end.... Is this to satisfy the condition of the next package of the day?

 

7- If I am right on the above 2 questions..... then I am confused... YOU stated that the block Begin Gamemode means that the script will always run. If this is true, then when it starts over, wont the faction be set back to 0 and the package that replies on a faction of 1 never start?

 

You know what... I may be in way over my head... However, IF you have the time, and wouldnt mind doing it, Could you do a mod for one of the player houses? Put an NPC in it, and have them a different outfit for at least 4 occasions? Sleeping, eating, and any other 2 of youre choice. Here is what one of my NPCs will do during the day.....

 

*In Armor*

Travel to and use training dummy for 1 hour

Travel to editor location for 6 hours (Shes a Guard)

Sit at the dinning table for lunch for 1 hour

Travel to editor location for 6 hours (again, guard at her post)

 

*In Nothing*

Stand in the shower for 1 hour

 

*In Nighty*

Sit at the dinning table for dinner for 1 hour

Sit on chair by bed and read for 1 hour

Sleep for 6 hours

Sit at dinning table for breakfast for 1 hour

 

Also, I tried to use the Armor unequipped option for the sleep package. She switched to her nighty as soon as she left her post. I hoped she would do this at the bed. AND... when she got to the bed, she her armor went back on.

 

So I dunno about that option either.

 

I'll do what you suggested. I will try this on a brand new mod or maybe a copy of the one im doing this with.... BTW... the mod I am doing this with is The one I just uploaded here the other day... Korenos Hot Bod Retreat. If you load it up, you will see all the outfits in one of the cupboards in the bedroom.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...