Difference between revisions of "Talk:IsSneaking - Actor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Cipscis
imported>Cipscis
m (Clarified "one" -> "1")
Line 40: Line 40:
</source>
</source>


: 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
: As a side note, this function returns a bool, so why are you comparing it with 1? It's more semantically correct, but just as superfluous, to compare it with true


: -- [[User:Cipscis|Cipscis]] 23:11, 10 February 2012 (EST)
: -- [[User:Cipscis|Cipscis]] 23:11, 10 February 2012 (EST)

Revision as of 23:12, 10 February 2012

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 1? It's more semantically correct, but just as superfluous, to compare it with true
-- Cipscis 23:11, 10 February 2012 (EST)