Jump to content

Way To Trigger NPC Unclothing In An Area


TheGreenLion

Recommended Posts

Alrighty, so it seems that there hasn't been any change between the updated script and the old one, it will still affect followers for the moment. :wallbash:

 

It compiles, and I've filled in the properties...one thing I haven't tried is adding in PlayerFollowerFaction into the mix. I will see in a few moments if that has any effect on the situation. EDIT: encountered a CTD after I did that, hrm. :unsure:

 

I wonder if perhaps there is another method to make them equip whatever is in their inventory once it gets unequipped, it's too bad they didn't make an EquipAll function to go with the UnequipAll lol. :ermm:

 

Ideally if the script could somehow keep track of what was unequipped (maybe just by name alone?), and then re-equip those exact same items then it would be precisely what I'm after. That might be pretty sticky though as far as scripting goes.

Edited by TheGreenLion
Link to comment
Share on other sites

well... bummer... I was hoping that would work for you...

 

best other thing then might be...

 

on trigger enter

unequip all

 

on trigger leave

check for X robe, if not present add it

force equip the robe

 

player can change their own gear & that of their followers

all other npcs would have been hand placed by you and so you can script in other item equips at your disposal

 

would make better sense to customize a item and make it into say a "bathrobe"

Link to comment
Share on other sites

Yeah, that's what I was thinking too. Not so much a problem for smart followers like Vilja and Ceridwen who have custom inventory stuff going on, it would just be the vanilla followers that need the extra attention. I'll look into how to get the last part working, although I'll probably end up posting my haphazard results back here...I'm bound to have a problem, lol! :biggrin:

 

Really all it needs to do is give them the robe, not add another one through continuous use and they will reset to their outfit on their own...or cruise around in their robe. They'll be comfortable barbarians I suppose. :tongue:

Link to comment
Share on other sites

Okay, so here's what I'm attempting...got it to compile but not sure what to do about the property:

 

Scriptname AATGLBathScript1 extends ObjectReference

ObjectReference Property AATGLBathRobe Auto

Function AddItem(Form AATGLBathRobe, int aiCount = 1, bool abSilent = false) native

Function EquipItem(Form AATGLBathRobe, bool abPreventRemoval = false, bool abSilent = false) native

 

Event OnTriggerEnter (objectreference triggerRef )

If triggerRef != Game.GetPlayer()

(triggerRef as actor).UnequipAll()

EndIf

EndEvent

 

Event OnTriggerLeave (objectreference triggerRef )

If triggerRef != Game.Getplayer()

(triggerRef as actor).Additem(AATGLBathRobe, 1, true) && (triggerRef as actor).EquipItem(AATGLBathRobe)

EndIf

EndEvent

 

I can't choose anything for it when editing the script properties...so I am missing something yet again.

 

EDIT: Definitely missing something, since it doesn't actually do anything, bleh. :confused:

Edited by TheGreenLion
Link to comment
Share on other sites

Scriptname AATGLBathScript1 extends ObjectReference

Armor Property AATGLBathRobe Auto
Int HasRobe

Event OnTriggerEnter (ObjectReference Someone)
 Actor NpcActor = Someone
 If NpcActor != Game.GetPlayer()
   NpcActor.UnequipAll()
 EndIf
EndEvent

Event OnTriggerLeave (ObjectReference Someone)
 Actor NpcActor = Someone
 HasRobe == NpcActor.GetItemCount(AATGLBathRobe)
 If NpcActor != Game.GetPlayer() 
   If HasRobe < 1
     NpcActor.Additem(AATGLBathRobe, 1, true)
   EndIf
   NpcActor.EquipItem(AATGLBathRobe)
 EndIf
EndEvent

So what I did here was:

Changed the property type to Armor since the robe will be worn like armor. I changed the confusing as heck triggerRef into Someone and assigned it to equal NpcActor. So instead of typing (triggerRef as Actor) everywhere you can just use NpcActor. Then I put in a check so that you won't be giving the npc a robe every time they exit but rather give them a robe if they don't have one.

Link to comment
Share on other sites

The CK seems to have a problem with the lines: Actor NpcActor = Someone in both instances.

 

It says specifically: type mismatch while assigning to a actor (cast missing or types unrelated)

 

I imagine that means it is having trouble with the Someone part of it since the rest of the script seems not to have any errors otherwise. :blink:

 

Actually I should ask, did it compile for you?

Link to comment
Share on other sites

No I didn't compile that specific script but I have done similar things before.

 

The problem is that the script is extending objectreference because it's on a trigger but you are dealing with actors. I was just hoping to save the hassle of typing "whatever as actor" all the time. Do note that you can have any word in that location triggerRef, Someone, shoot you could even use ThatCrazyNPCThatWalkedAcrossMyLine. It's just another variable name.

 

 

This one did compile. I had to go back to the "whatever as actor" tho

Scriptname AATGLBathScript1 extends ObjectReference

Armor Property AATGLBathRobe Auto
Int HasRobe

Event OnTriggerEnter(ObjectReference NpcActor)
 If NpcActor != Game.GetPlayer()
   (NpcActor as Actor).UnequipAll()
 EndIf
EndEvent

Event OnTriggerLeave(ObjectReference NpcActor)
 HasRobe == NpcActor.GetItemCount(AATGLBathRobe)
 If NpcActor != Game.GetPlayer() 
   If HasRobe < 1
     (NpcActor as Actor).Additem(AATGLBathRobe, 1, true)
   EndIf
   (NpcActor as Actor).EquipItem(AATGLBathRobe)
 EndIf
EndEvent

Link to comment
Share on other sites

Ahh okay, I wondered if I hadn't made a flub on my end, lol! :rolleyes:

 

Hooray, it works! Thank you so much Ishara, that's just too awesome! :biggrin:

 

At first I was worried because I dragged my follower through the first time and nothing happened, but it's 4 in tha morning so I ran em through again and they unclothed and then equipped the robe when they left. I call that success!

 

Thanks again for being so helpful, hopefully in the future I may be able to help you out with something. If nothing else, you'll get a spot of honor in the credits, hehe. Oh good...coffee is done. :thumbsup:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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