Difference between revisions of "Talk:IsSneaking - Actor"

Jump to navigation Jump to search
1,583 bytes removed ,  14:20, 12 February 2012
no edit summary
imported>MaboroshiDaikon
imported>MaboroshiDaikon
Line 44: Line 44:
: -- [[User:Cipscis|Cipscis]] 23:11, 10 February 2012 (EST)
: -- [[User:Cipscis|Cipscis]] 23:11, 10 February 2012 (EST)


:I was originally using just as you did, but when that didn't work, I switched to the comparison with 1. 


:I was originally using just as you did, but when that didn't work, I switched to the comparison with 1.  I'm wondering if this is an issue with the ReferenceAlias type script instead of the command itself.  Here's the complete code I'm having issues with:
:I deleted a bunch of code and comments as I've figured out what the issue is.  In short, when activating a horse in sneak mode, the game takes the player out of sneak mode to mount the horse before the OnActivate block on the horse can run. Using a BlockActivation(true) on the horse ahead of time will allow you to properly check the OnSneak condition of the playerAfterwards, you can unlock the activation and activate the horse with the player actor to get the player to mount the horse if that is the desired effect.  Not sure why the same doesn't apply for IsWeaponDrawn.
 
<source lang="papyrus">Scriptname PlayerHorseScript extends ReferenceAlias 
 
 
Event OnDeath(Actor akKiller)
MySelf = GetActorReference()
EndEvent
 
Event OnUnload()
If MySelf.IsDead() == 1
; disable the dead horse if it is unloaded
MySelf.Disable()
MySelf.Delete()
; added a new horse that can be bought at the stables
Myself = StablesPosition.PlaceActorAtMe(LvlHorseSaddled)
Alias_HorseRef.ForceRefTo(MySelf)
Alias_HorseRef.GetRef().SetFactionOwner(StablesFaction)
EndIf
EndEvent
 
Event OnActivate(ObjectReference akActionRef)
If (akActionRef == Game.GetPlayer())
If Game.GetPlayer().IsSneaking()
Debug.MessageBox("Sneak Activate Horse!!")
HorseChest.Activate(Game.GetPlayer(), true)
Else
Debug.MessageBox("Normal Activate Horse!! " + HorseChest)
;HorseChest.Activate(Game.GetPlayer(), true)
EndIf
EndIf
EndEvent
 
Actor Property MySelf  Auto 
ObjectReference Property StablesPosition  Auto 
ActorBase Property LvlHorseSaddled  Auto 
ReferenceAlias Property Alias_HorseRef  Auto 
Faction Property StablesFaction  Auto 
ObjectReference Property HorseChest Auto</source>
 
Replacing IsSneaking() with IsWeaponDrawn() works.
 
:UPDATE- In case things weren't weird enough... this works just fine:  EDIT- NOT!
 
<source lang="papyrus">Scriptname PlayerHorseScript extends ReferenceAlias  
 
bool IsPlayerSneaking
 
Event OnActivate(ObjectReference akActionRef)
If Game.GetPlayer().IsSneaking()
IsPlayerSneaking = true
Else
IsPlayerSneaking = false
EndIf
If (akActionRef == Game.GetPlayer() && IsPlayerSneaking)
Debug.MessageBox("Sneak Activate Horse!!")
HorseChest.Activate(Game.GetPlayer(), true)
Else
Debug.MessageBox("Normal Activate Horse!! " + HorseChest)
;HorseChest.Activate(Game.GetPlayer(), true)
EndIf
EndEvent</source>
 
Okay, if you activate the horse just as the player's feet touch the ground (and the player had been sneaking when mounting previously), it will work.  Wait a second and no dice.  Not sure what's going on here...

Navigation menu