Jump to content

making chests that are trapped can't get issneaking() to compile&#


tonycubed2

Recommended Posts

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

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

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

  • Recently Browsing   0 members

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