Talk:IsSneaking - Actor

Revision as of 23:11, 10 February 2012 by imported>Cipscis (→‎Syntax)

Syntax

I can get the following to work as expected:

If (Game.GetPlayer().IsWeaponDrawn() == 1)
	;Do Something
EndIf

But the following does not:

If (Game.GetPlayer().IsSneaking() == 1)
	;Do Something
EndIf

Tried the following syntax and still no luck:

If (Game.GetPlayer().IsSneaking())
	;Do Something
EndIf


This script worked exactly as I expected:
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
As a side note, this function returns a bool, so why are you comparing it with one? It's more semantically correct, but just as superfluous, to compare it with true
-- Cipscis 23:11, 10 February 2012 (EST)
Return to "IsSneaking - Actor" page.