Jump to content

[LE] Player Unequip Script for Trigger


Recommended Posts

If you want this to work on actors *and* the player... why not just remove the if/endif?

 

 

I am no scripting expert so maybe that is why the answer I seek isn't apparent for I am missing some basic knowledge of some functions.

 

Thanks for the if and endif info! Will try with that and see if I can get it working. The most recent that I was able to compile for the Player, it didn't work.

Link to comment
Share on other sites

I'll try the following and see if this will work.

Scriptname GVPlayerBath extends ObjectReference  

Actor Property PlayerBath  Auto  
{Bath Time for Player}

Event OnTriggerEnter(ObjectReference akActor)
  akActor != Game.GetPlayer()
    (akActor as Actor).UnequipAll()
EndEvent
Link to comment
Share on other sites

 

I'll try the following and see if this will work.

Scriptname GVPlayerBath extends ObjectReference  

Actor Property PlayerBath  Auto  
{Bath Time for Player}

Event OnTriggerEnter(ObjectReference akActor)
  akActor != Game.GetPlayer()
    (akActor as Actor).UnequipAll()
EndEvent

If this is for the player, it will fail. Why? You are saying "if the reference that entered the trigger is not the player then un-equip all equipped items from that reference." In other words, you need to change the operator from != to ==

 

If it is for NPCs, it will work just fine.

Link to comment
Share on other sites

 

 

I'll try the following and see if this will work.

Scriptname GVPlayerBath extends ObjectReference  

Actor Property PlayerBath  Auto  
{Bath Time for Player}

Event OnTriggerEnter(ObjectReference akActor)
  akActor != Game.GetPlayer()
    (akActor as Actor).UnequipAll()
EndEvent

If this is for the player, it will fail. Why? You are saying "if the reference that entered the trigger is not the player then un-equip all equipped items from that reference." In other words, you need to change the operator from != to ==

 

If it is for NPCs, it will work just fine.

 

 

No sorry, that is not what I currently have, I copied the wrong one from my txt document here. This is what I currently have that isn't working.

Scriptname GVPlayerBath extends ObjectReference  

Actor Property PlayerBath  Auto  
{Bath Time for Player}

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

From the last posts though is it so that I don't even need the If and EndIf, like so?

Scriptname GVPlayerBath extends ObjectReference  

Actor Property PlayerBath  Auto  
{Bath Time for Player}

Event OnTriggerEnter(ObjectReference akActor)
  akActor == Game.GetPlayer()
    (akActor as Actor).UnequipAll()
EndEvent

I have a lot of learning to do here in regards to scripting, Thanks for your patience and help! :happy:

Link to comment
Share on other sites

I would be very interested to know what the final working result is here. I've been trying to find this for a long time. Also, from my understanding, while NPCs will reequip once leaving the trigger, the player won't so that needs to be done manually every time the gamer want to re-dress.

Edited by NexBeth
Link to comment
Share on other sites

I am happy to report that I now have the script working for both NPCs and now the Player!

 

Here is the working script for NPCs that you can add to a trigger, upon entry to the trigger all equipped items will be unequipped:

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

And here is the script that works for the Player. Upon entry to the trigger all equipped items will be unequipped:

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

Thank you everyone for your assistance! Hope this helps others in the future!

Link to comment
Share on other sites

I would be very interested to know what the final working result is here. I've been trying to find this for a long time. Also, from my understanding, while NPCs will reequip once leaving the trigger, the player won't so that needs to be done manually every time the gamer want to re-dress.

 

Dynamic NPC outfit management is a huge pain in the ass, since some of the tools that would make it much easier -- being able to add parts to a given outfit, or get what an NPC's outfit currently is -- do not exist. If you unequip every part of an NPC's outfit, it will re-equip itself (including readding items, if necessary) under certain conditions, including reloading the NPC (for example, by going through a load door and returning) and certain inventory changes. The easiest way around this is to use SetOutfit(), except that SetOutfit() will remove all of the *old* outfit's items from the NPC, regardless of if they are equipped or not. The only way around that is to dump them to another container before calling SetOutfit().

 

There's more, too. It's annoying.

Link to comment
Share on other sites

I am happy to report that I now have the script working for both NPCs and now the Player!

 

Here is the working script for NPCs that you can add to a trigger, upon entry to the trigger all equipped items will be unequipped:

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

And here is the script that works for the Player. Upon entry to the trigger all equipped items will be unequipped:

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

Thank you everyone for your assistance! Hope this helps others in the future!

That is a lot simpler than the one I am using and I don't have the player unequipped. Do NPC re-equip once they leave the trigger?

 

Thanks for sharing!

Link to comment
Share on other sites

 

That is a lot simpler than the one I am using and I don't have the player unequipped. Do NPC re-equip once they leave the trigger?

Thanks for sharing!

 

 

 

You're welcome! And thanks to everyone's help!

 

Currently there is no kind of re-equip in the script,that is my next task to create a re-equip script for the player. It would involve attaching the script to a different trigger. A little above my skill right now; I think it involves some things regarding slots so I haven't worked on it yet, surely it can be done though for the player. In regards to NPCs maybe a follower management mod like foamyesque had mentioned would work automatically for NPCs to automatically re-equip when leaving the trigger? Not sure, I currently don't use any follower management mods. When I get a re-equip script working for the player I'll post it here!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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