tonycubed2 Posted May 28, 2012 Share Posted May 28, 2012 Hi, As part of my mod Sands of Time I am adding trapped chests that can be disarmed. But i need the IsSneaking() code to compile na dit won't no matter what. I tried Import Actor and extending actor but no dice. Here is the script, any ideas? The script was compiling and working fine until I added the sneaking part. And to go for broke, is there any way to keep the chest from displaying its contents when you select open? I guess lock it it, but I do not want it to say "locked". The main issue though is the IsSneaking() comand not compiling though. Scriptname fireTrap extends ObjectReference int Property PushForce Auto int playersHealth Int iButton import Actor Explosion Property bomb Auto Import Utility ObjectReference Property PlayerRef Auto Event OnOpen(ObjectReference akActionRef) PlayerRef = Game.GetPlayer() if !PlayerRef.IsSneaking() ;not in sneak mode - kaboom! Else iButton = copper.Show() ; Shows your menu. iButton == -1 until input playersHealth = Game.GetPlayer().GetActorValue("health") as int If (iButton != -1) ; Wait for input Game.GetPlayer().RemoveItem(copper, 1, True) ; Silently remove token If (iButton == 0) ; leave chest alone Debug.Notification("Leaving Chest Alone") Wait(2) ElseIf (iButton == 1) ; disarm Debug.Notification("Trying to Disarm Chest") Wait(2) ElseIf (iButton == 2) ; force Debug.Notification("Forcing Chest Opened") Wait(2) EndIf EndIf Self.placeatme(bomb) explodeme.play(self) Game.GetPlayer().DamageAV("Health", Utility.RandomInt(10, playersHealth)+10) PushActorAway(Game.GetPlayer(), 60) self.Disable() self.delete() EndIf EndEvent Sound Property explodeme Auto Message Property Copper Auto Link to comment Share on other sites More sharing options...
rpgjaguar Posted May 28, 2012 Share Posted May 28, 2012 This may sound like a minor thing but should the "Import Utility" start with an i instead of an I like in "import Actor"? Link to comment Share on other sites More sharing options...
tonycubed2 Posted May 29, 2012 Author Share Posted May 29, 2012 tried it both ways, no joy :-( Link to comment Share on other sites More sharing options...
rpgjaguar Posted May 29, 2012 Share Posted May 29, 2012 Does an error come up? what is it? perhaps your not using ".IsSneaking()" properly? Link to comment Share on other sites More sharing options...
tonycubed2 Posted May 29, 2012 Author Share Posted May 29, 2012 It says no such function Link to comment Share on other sites More sharing options...
rpgjaguar Posted May 29, 2012 Share Posted May 29, 2012 (edited) did you try ak ActorRef instead of playerref? or somthing like that? I think that playerref might be to specific in that context since technichly ANYthing can open a chest. EDIT: what about Game.GetPlayer() instead of Playerref? well i'm tired so g'night, goodluck Edited May 29, 2012 by rpgjaguar Link to comment Share on other sites More sharing options...
tonycubed2 Posted May 29, 2012 Author Share Posted May 29, 2012 Tiried that, I figured it was part of the functuion. No difference. But I found something!!! google showed me another creationkit page and it had DIFFERENT information. Lesson here is that not every crationkit.com page is correct! The following did work, notice the extra brackets: Scriptname CodeTestScript extends Quest Event OnInit() RegisterForUpdate(3) EndEvent Event OnUpdate() if (Game.GetPlayer().IsSneaking()) Debug.Notification("Player is sneaking") else Debug.Notification("Player is not sneaking") endif EndEvent Link to comment Share on other sites More sharing options...
rpgjaguar Posted May 29, 2012 Share Posted May 29, 2012 So I was right, you wern't using it correctly, well either way gratz, I know how frustrating it can be when something doesn't work when you think it should. Link to comment Share on other sites More sharing options...
Recommended Posts