Jump to content

A possible script...if anyone knows how


Din2014

Recommended Posts

Ok soo ive never posted anything questionwise on these forums...(on any forums for that matter) but ive reached a point where im stuck.
​For months ive been tryin to develop a way for followers (not just one or two...several different followers male and female) to wear different swimwear upon entering an activator or a world cell. Ive looked at the auto make em naked activators and those work...but everyone will wear the same swimsuit/swimtrunks. Which is needless to say...not very immersive. So that method doesn't work. And since I don't really know the papyrus language I cant write my own script. But maybe ive thought of a possible way to do this. THey say that the wear sleepwear option was taken out of skyrim before the came was finalized. Now isn't there a script that could be written (much like the strip em naked activator) but instead target the Sleepwear slot in the creation kit? That way when they enter the activator they put on whatevers in the sleepwear slot for the duration of being within the activator...and undressing back to their normal attire when leaving? For all you pro scripters out there, if theres a way or a path, help a brotha out if you can. Id appreciate it greatly. and ud get a long times worth of bragging rights. =D (all I can offer right now lol)

Link to comment
Share on other sites

I don't know about the sleepwear thing.

 

I was thinking about the script you already have which puts all NPCs into the same outfit. If you were to use a form list of outfits instead of a specific outfit, you could increment the index as each NPC enters the trigger volume box and equip the next outfit on them. When you reach the end of the list, reset to the beginning. If you have more NPCs than outfits, you'll have some with the same outfits. But if you have less NPCs than outfits they'll all be sporting something different.

Link to comment
Share on other sites

mmmmm
​Formlist eh....now I wonder how I would go about setting that up....lemme go get the script and post it here.
​Would be able to tell if Id need to change anythin,

 

Its basically the script from this mod

http://www.nexusmods...im/mods/49878/?

 

and the script is written as follows...

 

this is the effect script

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)
akTarget.UnequipItemSlot(30)
akTarget.UnequipItemSlot(33)
akTarget.UnequipItemSlot(34)
akTarget.UnequipItemSlot(37)
endEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
akTarget.additem(JewelryRingGold,1,true)
akTarget.equipitem(JewelryRingGold,false,true)
akTarget.removeitem(jewelryringgold,1,true)

endEvent

 

 

and this is the activator script

 

 

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

 

 

if u see what needs to be changed, lemme kno so I can make the formlist n try it out

Link to comment
Share on other sites

Theoretically this should work. I've not tested for compilation or function.

You need a formlist that contains each of the outfits that you want to use.

You need a global variable (Global record in the CK's object window) to communicate the index value between the two scripts.

 

 

;the activator script
Scriptname AARiftPoolActivator extends ObjectReference

spell property AARiftPoolSpell auto
FormList Property MyList Auto
Int Index
GlobalVariable Property MyListIndex Auto

Event OnTriggerEnter(ObjectReference triggerRef) 
	Actor akactionRef = triggerRef as Actor
	if (akActionRef != game.getplayer() && !akActionRef.isincombat()) 
		If Index < MyList.GetSize() && Index >= 0
			Index += 1 ;as long as index value is between 0 and the count of entry on the formlist, increase by one
		EndIf
		If Index == MyList.GetSize()
			Index = 0 ;should index reach the count of entries on the formlist, revert to zero
		EndIf
		MyListIndex.SetValueInt(Index)
		AARiftPoolSpell.cast(akactionref,akactionref)
	endif
endEvent

Event OnTriggerLeave(ObjectReference triggerRef)
	Actor akactionRef = triggerRef as Actor
	if (akActionRef != game.getplayer()) 
		akActionRef.dispelspell(AARiftPoolSpell)
		akActionRef.removeitem(MyList,1,true) ;will remove any instance of any outfit on the list
	endif
endEvent

********************************************************************************************************
;the magic effect script
Scriptname AARiftPoolEffectscript extends activemagiceffect 

armor property JewelryRingGold auto
FormList Property MyList Auto
GlobalVariable Property MyListIndex Auto

Event OnEffectStart(Actor akTarget, Actor akCaster) 
	akTarget.unequipall()
	Int Index = MyListIndex.GetValueInt()
	Armor Entry = MyList.GetAt(Index) as Armor
	If Entry ;make sure it returns valid
		akTarget.additem(Entry,1,true)
		akTarget.equipitem(Entry,1,true)
	EndIf
	akTarget.UnequipItemSlot(30)
	akTarget.UnequipItemSlot(33)
	akTarget.UnequipItemSlot(34)
	akTarget.UnequipItemSlot(37)
endEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster) 
	akTarget.additem(JewelryRingGold,1,true)
	akTarget.equipitem(JewelryRingGold,false,true)
	akTarget.removeitem(jewelryringgold,1,true) 
endEvent 

 

You'll have to test it out. There could be a side effect where two NPCs enter close to each other and the global variable gets updated twice before the magic effect calls upon it. If that happens, they'd both have the same outfit most likely. Should such a scenario happen there are ways around it. Better tho to wait and see if what is here works as intended first.

Link to comment
Share on other sites

Ill get right on that. Thanks a lot. Ill let you know the results!

 

 

 

 

Ok, Results report!

 

Everything compiled with no probs and i made the global as well as the formlist. Set the global variable to float and left the default value at 1.0 (did not check the constant box) they walk in and are still stripped naked. No outfits at all. Am I missin somethin or will this need more.

Edited by Din2014
Link to comment
Share on other sites

The first question to ask: Did you assign the data to the new properties?

 

If you did, it could be hanging up where its getting the items from the form list. Try adjusting the OnEffectStart event on the magic effect to the following:

 

 

Event OnEffectStart(Actor akTarget, Actor akCaster) 
	akTarget.unequipall()
	Debug.Trace(akTarget+" - I unequipped all my items")
	Int Index = MyListIndex.GetValueInt()
	Form Entry = MyList.GetAt(Index)
	Debug.Trace(akTarget+" - I want to equip "+Entry+" at index "+index+" in the formlist")
	If Entry ;make sure it returns valid
		Debug.Trace(akTarget+" - "+Entry+" is a valid item. Trying to equip it.")
		akTarget.additem(Entry,1,true)
		akTarget.equipitem(Entry,1,true)
	EndIf
	akTarget.UnequipItemSlot(30)
	akTarget.UnequipItemSlot(33)
	akTarget.UnequipItemSlot(34)
	akTarget.UnequipItemSlot(37)
endEvent 

 

I did two things here. Since AddItem and EquipItem can work with forms, I removed the cast to Armor and left it as Form. Also added several Trace statements that can let you know what is going on provided you have papyrus logging turned on. You can change Trace to Notification if you wish to see it in-game rather than look afterwards at the log.

Link to comment
Share on other sites

Yup I assigned the data in the properties for both scripts. Ill give this new script a try right now. Get back to you in a matter of minutes

 

 

 

 

Ok anaylasis.

 

Still a no go. Changed the script source and compiled successfully. still no success though. imma try to post an image of it so you can see everythign i got goin on. GImme a sec to figure out what image hosting site works with this place

 

Ok so there was a slight mess up on my end with the activator box itself. I had duplicate and didn't know it. So the old script works.

I am grateful and happy to see this finally coming to fruition...but theres one more variable that if possible would make this perfect.

 

Is there a way to make it so that they will put on their own perspective bikini that's assigned to them. Their body types are all mixed now which looks weird lol. If that's not possible then nvm. I'm just glad to see it get this far! In fact I have a few bikini's in their inventory. So is there a way to make it so that they equip the one that's in their inventory instead of just random =D

Edited by Din2014
Link to comment
Share on other sites

The picture link you sent me in private message... For that size of a picture, Nexus won't expand it enough for me to actually read anything. Just putting that out there.

 

So some of the NPCs already have an outfit that you want worn when they pass into the trigger... Hmm...

 

Try this. Added a second formlist for pre-added outfits. Added a second global variable to pass along the index of the first recognized pre-added outfit. Added a third global variable to act as an on/off bool so that the magic effect script knows whether to use a pre-added outfit or the next one in the cycle of default outfits. Again, not tested for compilation or function.

 

 

Scriptname AARiftPoolActivator extends ObjectReference
;the activator script

spell property AARiftPoolSpell auto
FormList Property MyList Auto
Int Index
GlobalVariable Property MyListIndex Auto
FormList Property PreAddedOutfitsList Auto
GlobalVariable Property PAOListIndex Auto
GlobalVariable Property ToggleVar Auto ; 0.0 = use random list  1.0 = use pre-added list

Event OnTriggerEnter(ObjectReference triggerRef) 
	Actor akactionRef = triggerRef as Actor
	if (akActionRef != game.getplayer() && !akActionRef.isincombat()) 
		;check to see if the actor already has a pre-added outfit
		If akActionRef.GetItemCount(PreAddedOutfitsList) > 0
			Int ix = 0
			Int ls = PreAddedOutfitsList.GetSize()
			While ix < ls
				Armor le = PreAddedOutfitsList.GetAt(ix)
				If akActionRef.GetItemCount(le) > 0
					PAOListIndex.SetValueInt(ix)
					ToggleVar.SetValue(1.0)
					ix = ls ;got a match get out of loop
				EndIf
				ix += 1
			EndWhile
		;if no recognized pre-added outfit, assign next one in the cycle of default outfits	
		Else
			If Index < MyList.GetSize() && Index >= 0
				Index += 1 ;as long as index value is between 0 and the count of entry on the formlist, increase by one
			EndIf
			If Index == MyList.GetSize()
				Index = 0 ;should index reach the count of entries on the formlist, revert to zero
			EndIf
			MyListIndex.SetValueInt(Index)
			ToggleVar.SetValue(0.0)
		EndIf
		AARiftPoolSpell.cast(akactionref,akactionref)
	endif
endEvent

Event OnTriggerLeave(ObjectReference triggerRef)
	Actor akactionRef = triggerRef as Actor
	if (akActionRef != game.getplayer()) 
		akActionRef.dispelspell(AARiftPoolSpell)
		akActionRef.removeitem(MyList,1,true) ;will remove any instance of any outfit on the list
	endif
endEvent

********************************************************************************************************
Scriptname AARiftPoolEffectscript extends activemagiceffect 
;the magic effect script

armor property JewelryRingGold auto
FormList Property MyList Auto
GlobalVariable Property MyListIndex Auto
FormList Property PreAddedOutfitsList Auto
GlobalVariable Property PAOListIndex Auto
GlobalVariable Property ToggleVar Auto ; 0.0 = use random list  1.0 = use pre-added list
Armor Entry
Int Index

Event OnEffectStart(Actor akTarget, Actor akCaster) 
	akTarget.unequipall()
	If ToggleVar.GetValue() = 1.0
		Index = PAOListIndex.GetValueInt()
		Entry = PreAddedOutfitsList.GetAt(Index) as Armor
	Else
		Index = MyListIndex.GetValueInt()
		Entry = MyList.GetAt(Index) as Armor
	EndIf
	If Entry ;make sure it is valid
		;add item if it does not already exist in inventory - needed to prevent doubling of pre-added items
		If akTarget.GetItemCount(Entry) <= 0
			akTarget.additem(Entry,1,true)
		EndIf
		akTarget.equipitem(Entry,1,true)
	EndIf
	akTarget.UnequipItemSlot(30)
	akTarget.UnequipItemSlot(33)
	akTarget.UnequipItemSlot(34)
	akTarget.UnequipItemSlot(37)
endEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster) 
	akTarget.additem(JewelryRingGold,1,true)
	akTarget.equipitem(JewelryRingGold,false,true)
	akTarget.removeitem(jewelryringgold,1,true) 
endEvent  

 

 

 

Link to comment
Share on other sites

lol
​ok gonna get right on the testing. be back atcha in a matter of minutes

 

ok theres a fail somewhere in there. Tryin to see if i messed up anything...not seeing it.

Its the activator script. Workin on compiling the active effect one now.

Ok both the activator and the magic effect failed to compile....im checking them both really carefully. to make sure I got everything in the exact order of you posting it.

Edited by Din2014
Link to comment
Share on other sites

  • Recently Browsing   0 members

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