Jack8623 Posted March 3, 2019 Share Posted March 3, 2019 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 More sharing options...
IsharaMeradin Posted March 3, 2019 Share Posted March 3, 2019 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" Link to comment Share on other sites More sharing options...
Jack8623 Posted March 3, 2019 Author Share Posted March 3, 2019 (edited) 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 March 3, 2019 by Jack8623 Link to comment Share on other sites More sharing options...
maxarturo Posted March 3, 2019 Share Posted March 3, 2019 Event OnTriggerEnter(ObjectReference Actor) if Actor == Game.GetPlayer() (Actor as Actor).UnequipAll() EndIf EndEvent Link to comment Share on other sites More sharing options...
Ghaunadaur Posted March 3, 2019 Share Posted March 3, 2019 'Actor' shouldn't be used for variable names, since it's already reserved for object type 'Actor'. Instead use 'akActor' or 'myActor' or something like that. Link to comment Share on other sites More sharing options...
Jack8623 Posted March 3, 2019 Author Share Posted March 3, 2019 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 More sharing options...
IsharaMeradin Posted March 3, 2019 Share Posted March 3, 2019 If you would like further assistance, please post the code you are trying to compile now along with the compiler error you are receiving. Link to comment Share on other sites More sharing options...
Jack8623 Posted March 3, 2019 Author Share Posted March 3, 2019 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 Link to comment Share on other sites More sharing options...
Jack8623 Posted March 3, 2019 Author Share Posted March 3, 2019 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 More sharing options...
foamyesque Posted March 4, 2019 Share Posted March 4, 2019 If you want this to work on actors *and* the player... why not just remove the if/endif? Link to comment Share on other sites More sharing options...
Recommended Posts