Jump to content

[LE] Player Unequip Script for Trigger


Recommended Posts

Hello everyone! Am running into some issues creating a script to work on a trigger enter and maybe someone here can help me out? Have looked all around the forums but information I find is confusing and there seems to be some information missing. 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.

I have been able to create a function with a script on a trigger that allows any NPC to take off their clothes when entering a bath area, I am currently working on a castle house that I plan to release in the future. Here is the script that I was able to get working for NPCs:

Scriptname GVBath extends ObjectReference  

ObjectReference Property BathTime  Auto  

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

But now the issue I am having is getting this to work on the actual player... I have tried to create a script many times but it isn't compiling... this is what I try to compile that fails:

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

I am goofing something up somewhere for sure, I am fairly new to scripting but surely not new to the CK... Anyways, if some expert here could lend some guidance it would be greatly appreciated! :happy:

Link to comment
Share on other sites

If you want it to work for the player, you need to use Actor == Game.GetPlayer() instead of Actor != Game.GetPlayer(). != means "not equal" while == means "equal"

 

Wow, thanks for such a quick response and also for sharing the knowledge. Was unaware of that equal part...

 

I have tried to use the following but it still is failing when I try to compile...

Scriptname GVBathPlayer extends ObjectReference

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

Not sure why it isn't compiling. I add the newly created script, close the properties then save and reopen it and edit the source... :confused:

 

Kudos to you! :happy:

Edited by Jack8623
Link to comment
Share on other sites

Thanks to everyone for their input here! For some reason everything I try I still can't get it to compile... :huh:

Will spend more time on it and do some more studying. When I get it working I will post it back here for others. Cheers! :happy:

Link to comment
Share on other sites

If you would like further assistance, please post the code you are trying to compile now along with the compiler error you are receiving.

 

Sure thing! :happy:

 

Here is the code I'm trying to use:

Scriptname GVPlayerBath extends ObjectReference  

Actor Property PlayerBath  Auto  
{Bath Time for Player}


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

The following works great on the trigger for any NPC that enters...

Scriptname GVBath extends ObjectReference  

ObjectReference Property BathTime  Auto  

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

QTKmxS8.jpg

Link to comment
Share on other sites

I had just got the following to compile. Will test! :happy:

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
Link to comment
Share on other sites

  • Recently Browsing   0 members

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