|
Post by jet4571 on Jan 12, 2014 9:02:29 GMT
Hello Hello everyone, hate to ask but I seriously need some help with some scripting. I just spent for probably the fifth time 5 hours trying to learn this myself but the CK tutorial scripting section really doesnt help someone who has no clue on scripting beyond a little basic HTML from 10 years ago. Every example the script creates a message box. Not a clue what to put there so it does what I want. What I want is a script that changes an NPC's clothes when they enter a trigger box in an indoor pool from what they are wearing to a selection of swimsuits. What I get from the sample script to attach to the trigger box is:
ScriptName ExampleTrigger Extends ObjectReference Actor Property PlayerREF Auto ; Least 'costly' way to refer to the player Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == PlayerREF ; This condition ensures that only the player will trigger this code Debug.MessageBox("Yippee!") EndIf EndEvent
They did mention to change the == to != so it affects NPC's and not the player, Fine OK I can change that in seconds. BUT what about the mesage box part, what do I replace it with? I found a bit of code for unequip which I assume the NPC should do that first, BUT it is this: Game.GetPlayer().UnequipAll() Now that is saying getplayer and I assume that affects the player and not NPC's. How to modify that for NPC's and not the player? Then theres the whole equip part, then the strip and reequip what they were wearing before entering the pool when they sandbox out of it. Do i make an outfit using a level list for the swimsuits and swap outfits then have it swap back after? a form list of all the swimsuits? A container with them in it? Not a clue but outfit swapping sounds the simplest way since they should be sandboxing when entering the pool so would be using the default outfit, I see Prisoner.SetOutfit(RagsOutfit) as a sample of changing outfits but that doesnt help to swap it back after.
Getting the original outfit is another script I have little Idea what to do with when working with everything else and this one is requesting Actorbase as well.
Outfit Property SleeperOutfit Auto ActorBase pActorBase = Game.GetPlayer().GetActorBase() if pActorBase.GetOutfit(true) == SleeperOutfit ; ... endif
Anyone have a clue on how to do this? because the more I try to figure out how the less I do figure out and it is getting frustrating with the lack of simple documentation for beginners to any kind of scripting.
|
|
|
Post by Wolf on Jan 12, 2014 14:01:44 GMT
Hello Hello everyone, hate to ask but I seriously need some help with some scripting. I just spent for probably the fifth time 5 hours trying to learn this myself but the CK tutorial scripting section really doesnt help someone who has no clue on scripting beyond a little basic HTML from 10 years ago. Every example the script creates a message box. Not a clue what to put there so it does what I want. What I want is a script that changes an NPC's clothes when they enter a trigger box in an indoor pool from what they are wearing to a selection of swimsuits. What I get from the sample script to attach to the trigger box is: ScriptName ExampleTrigger Extends ObjectReference Actor Property PlayerREF Auto ; Least 'costly' way to refer to the player Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == PlayerREF ; This condition ensures that only the player will trigger this code Debug.MessageBox("Yippee!") EndIf EndEvent They did mention to change the == to != so it affects NPC's and not the player, Fine OK I can change that in seconds. BUT what about the mesage box part, what do I replace it with? I found a bit of code for unequip which I assume the NPC should do that first, BUT it is this: Game.GetPlayer().UnequipAll() Now that is saying getplayer and I assume that affects the player and not NPC's. How to modify that for NPC's and not the player? Then theres the whole equip part, then the strip and reequip what they were wearing before entering the pool when they sandbox out of it. Do i make an outfit using a level list for the swimsuits and swap outfits then have it swap back after? a form list of all the swimsuits? A container with them in it? Not a clue but outfit swapping sounds the simplest way since they should be sandboxing when entering the pool so would be using the default outfit, I see Prisoner.SetOutfit(RagsOutfit) as a sample of changing outfits but that doesnt help to swap it back after. Getting the original outfit is another script I have little Idea what to do with when working with everything else and this one is requesting Actorbase as well. Outfit Property SleeperOutfit Auto ActorBase pActorBase = Game.GetPlayer().GetActorBase() if pActorBase.GetOutfit(true) == SleeperOutfit ; ... endif Anyone have a clue on how to do this? because the more I try to figure out how the less I do figure out and it is getting frustrating with the lack of simple documentation for beginners to any kind of scripting. Jet, try this as an easy example. You already were on the right track. Just create an outfit in Outfit (branch of the object window)and script your trigger like this: ScriptName ExampleTrigger Extends ObjectReference
Event OnTriggerEnter(ObjectReference akActionRef)
If akActionRef != Game.GetPlayer() ; This condition ensures that everyone else but the player will trigger this code akActionRef.SetOutfit(YourPreferredSwimmingSuit) ;lets the ActionRef that triggers the trigger equip the Outfit EndIf
EndEvent
You must define "YourPreferredSwimmingSuit" as an Outfit property That's the "easy" way. But the problems will start now because I guess you also want to remove the bikini with Event OnTriggerLeave again... and there is no command for it. You can only change outfits. Now what was it again what the NPC who enters your bathtub has been wearing before??? And now the whole lot of scripting, generating formlist and filling containers starts. Ask Amgepo. He needed two years to accomplish his wardrobe system for Vilja. So with your little Trigger Script it's best to move the entire inventory of akActionRef to a save place, a container outside the game. Then instead of using the outfit command you must force equip your desired clothing items on akActionRef. A short period of nakedness may occur. OnLeave of the trigger you must unequip the bathing clothing and then transfer the inventory of the container back to akActionRef and hope that it will be equipped properly.
|
|
|
Post by jet4571 on Jan 12, 2014 23:22:49 GMT
So removing "Actor Property PlayerREF Auto ; Least 'costly' way to refer to the player" is a good idea because player doesnt need to be defined. Thats good to know. As for the outfit that will be easy. create a new outfit and a new level list. drop all the swimsuits into the level list and drop the level list into the outfit. Same as i do for random outfits for NPC's. Could it be possible to have a trigger box outside the pool that requires the use of the pool to trigger and have that return the state of the NPC? If pool trigger then swap back outfits? If they dont go into the pool they will ignore the script Is a trick I learned from making maps for Novalogic games where an NPC enters an area trigger they will change the way they act but there was no way to revert them so i had an area trigger at the entry and exit that changed them back that required them to have been in the first area trigger.
Maybe asign a sandbox package with the swimsuit, the sandbox package would have the eat flag set to false so no crumbs in the pool and the exit trigger is if they have that AI pack.Second trigger removes the AI pack and swaps the outfits back but does nothing if the AI pack isnt being used. I dont see a need for containers to store gear in, the NPC's will be wearing default outfits so when swapping back they should in theory just put the clothes back on.
I am thinking it also needs to use the potential follower faction and a custom one for the non follower bards I have in one house. That would remove special voiced followers like Vilja. Anyway i need to restart my computer because the new mouse middle button stops working with the CK since I installed its software.
|
|
|
Post by jet4571 on Jan 13, 2014 2:17:03 GMT
Tested and the test NPC that wanders about didnt change outfits. dismissed a generic follower inside the cell to sandbox.. never swapped outfits. So it is the property for the outfit thats missing but I am lost on how to add the property once the script compiled. Script name AARiftPoolSuit outfit named AARiftPoolOutfit. Now in the script there is nothing about properties and when adding a new property after the script compiled it fails. Ok so in the example script from the tutorial it has a propert on top but that was for the player. Actor Property PlayerREF Auto. Read the property on top but modified to "Outfit Property AARiftPoolOutfit Auto" I changed the "YourPreferredSwimmingSuit" in the brackets to the outfit name but that didnt do squat. ScriptName AARiftPoolSuit Extends ObjectReference Outfit Property AARiftPoolOutfit Auto Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef != Game.GetPlayer() ; This condition ensures that everyone else but the player will trigger this code akActionRef.SetOutfit(AARiftPoolOutfit) ;lets the ActionRef that triggers the trigger equip the Outfit EndIf EndEvent Above script compiled but I couldnt change the property that doesnt do squat and cant add a new one so back at stage 1 of frustrated trying to decipher what the tutorial is saying about adding properties since not a single example they give is anything remoptely close to what i am trying to do. Yay for tutorials made for experianced people. Thought, hey Luxury suite has a pool that completely strips.. maybe I can look to see how the scripts are written to maybe explain a bit by example but no PSC no looking at the scripts. But found a tutorial to completely strip them when they enter the pool: forums.nexusmods.com/index.php?/topic/1081510-tutorial-by-subtanker-on-how-to-make-npcs-go-skinny-dipping/ so maybe instead of the ring use a swimsuit? *Edit, Ok did that tutorial but cannot fill properties again. It says to auto fill them but the button is greyed out. "Make sure you auto-fill it's properties as well. " Yup OK just as soon as it allows me to do so. **Edit SetOutfit seems to bugger up the compile, says its not a function or does not exist www.creationkit.com/SetOutfit_-_Actor Not a clue.
|
|
|
Post by jet4571 on Jan 13, 2014 9:27:56 GMT
Yay some success! I got them to put on a bathing suit and then go back to normal clothes by modifying a nude swimming tutorials scripts. Amature hour all the way but did work. Tutorial: forums.nexusmods.com/index.php?/topic/1081510-tutorial-by-subtanker-on-how-to-make-npcs-go-skinny-dipping/My scripts Spell effect: Scriptname AARiftPoolEffectscript extends activemagiceffect
armor property AABathingSuit01 auto armor property JewelryRingGold auto
Event OnEffectStart(Actor akTarget, Actor akCaster) akTarget.unequipall() akTarget.additem(AABathingSuit01,1,true) akTarget.equipitem(AABathingSuit01,1,true) endEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster) akTarget.additem(JewelryRingGold,1,true) akTarget.equipitem(JewelryRingGold,false,true) akTarget.removeitem(jewelryringgold,1,true) endEvent Activator: Scriptname AARiftPoolActivator extends ObjectReference
spell property AARiftPoolSpell auto armor property AABathingSuit01 auto
Event OnTriggerEnter(ObjectReference triggerRef) Actor akactionRef = triggerRef as Actor if (akActionRef != game.getplayer() && !akActionRef.isincombat()) AARiftPoolSpell.cast(akactionref,akactionref) endif endEvent
Event OnTriggerLeave(ObjectReference triggerRef) Actor akactionRef = triggerRef as Actor if (akActionRef != game.getplayer()) akActionRef.dispelspell(AARiftPoolSpell) akActionRef.removeitem(AABathingSuit01,1,true) endif endEvent Remove item for the bathing suit was not working in the spell script but that could be beacuse I forgot to load a save before the script was introduced. But still no bathing suit in inventory after as that could add up. Odd thing is the NPC that did it multiple time had a neck gap after, The NPC is low for weight but after the clothes worn and body below was high weight. I cant see anything there that changes the weight on dispell or removal of the bathing suit. Not excatly what I wanted, i wanted a random bathing suit so it is not everyone wearing the same item but it is a bathing suit and not nude. If i want nude i can take Vilja swimming. Now how to get it to not work on Vilja mod characters....
|
|
|
Post by jet4571 on Jan 14, 2014 0:44:15 GMT
Well turned out the neck gap body size change was completely unrelated. I added Calientes Vanilla clothing files the day before and just happens the _0 was actaualy an _1 of that particular dress. So ofcourse the head wont fit the body. Anyway tested it and it works good and decided to share it with everyone. I made it a small ESP that contains everything required along with the resources and can be ported to an exhisting mod with tes5edit or just start a new mod with it. 2 esp files, one has a working sample in a cell and the other with just the required items for porting. Would be good for other uses like making a bartender that works for 8 hours and goes home after. have him wear merchant clothes while behind the bar and farm clothes elsewhere. www.nexusmods.com/skyrim/mods/49878
|
|