reaper9111 Posted October 14, 2012 Share Posted October 14, 2012 (edited) Hello guy's can't get this to work...It's a script attach to an activator, that is supposed to give the player 1 point of stamina everytime it's activated, but can only be activated once a day !Anyone can help please ? Auto State Ready Event OnBeginState() Debug.MessageBox("The bench is ready to give stamina") EndEvent Event OnActivate(ObjectReference akActionRef) int playersHealth = Game.GetPlayer().GetActorValue("Stamina") as int if akActionRef == Game.GetPlayer() Game.DisablePlayerControls(True, True, True, False, True, False, True) Utility.Wait(10) Game.GetPlayer().SetActorValue("Stamina", playersHealth +1) Debug.Notification("You fell stronger") Game.EnablePlayerControls() endif GoToState("NotReady") EndEvent EndState State NotReady Event OnBeginState() Self.RegisterForSingleUpdateGameTime(24) Debug.MessageBox("State correctly switched") EndEvent Event OnUpdateGameTime() GoToState("Ready") EndEvent EndState Edited October 14, 2012 by reaper9111 Link to comment Share on other sites More sharing options...
Ghaunadaur Posted October 15, 2012 Share Posted October 15, 2012 The script seems to work correctly except for the stamina value. GetActorValue will read the current actor value. If the player is unlucky, his current stamina is at 0 and the script will set his base stamina to 1. :P Try this: Auto State Ready Event OnBeginState() Debug.MessageBox("The bench is ready to give stamina") EndEvent Event OnActivate(ObjectReference akActionRef) Actor Player = Game.GetPlayer() if akActionRef == Player Game.DisablePlayerControls(True, True, True, False, True, False, True) Utility.Wait(10) Player.ModActorValue("Stamina", 1) Debug.Notification("You fell stronger") Game.EnablePlayerControls() endif GoToState("NotReady") EndEvent EndState State NotReady Event OnBeginState() Self.RegisterForSingleUpdateGameTime(24) Debug.MessageBox("State correctly switched") EndEvent Event OnUpdateGameTime() GoToState("Ready") EndEvent EndState Link to comment Share on other sites More sharing options...
Recommended Posts