spligitmoose Posted June 12, 2016 Share Posted June 12, 2016 I'm at my wits end trying to make a script that passes a certain amount of in game time or even makes the player sleep/wait for that amount of time after activating an object. The Creation Kit wiki has this function: SetPCSleepHours iHours but I can't get it to compile in any variation of function usage. Here's my script atm: Scriptname SalvagingScript extends ObjectReference{Give the player an item when they activate this reference.}Form property ItemToGive Auto const{The Item to give to the player when this references is activated.}int property iNumberToGiveMin = 1 Auto const{How many of the item are given? If always the same, Min and Max should be equal. Otherwise it's a random value between min/max}int property iNumberToGiveMax = 1 Auto const{If Greater than the Min, the number given will be randomized between that value and this one.}float property fminSalvageTime = 1.0 Auto const{minmum possible salvage time}float property fmaxSalvageTime = 1.0 Auto constbool property bDisableWhenDone = FALSE auto const{Should this object disable when clicked? False by default.}Auto State InitialEvent OnActivate(ObjectReference akActionRef)bool isCombat = Game.getPlayer().IsInCombat()if isCombat==true;Cannot salvage in combat;putmessage hereGoToState("Done")endifint iNumberToGivefloat fSalvageTimeif (iNumberToGiveMin >= iNumberToGiveMax); If Min==Max or if the range is invalid, then just give the number in MiniNumberToGive = iNumberToGiveMinelse; if Min < Max, then generate a random whole number between.iNumberToGive = utility.randomInt(iNumberToGiveMin,iNumberToGiveMax)fSalvageTime = utility.randomFloat(fminSalvageTime,fmaxSalvageTime)endifakActionRef.AddItem(ItemToGive, iNumberToGive)if bDisableWhenDone; make this object go away. Generally for things which are being "taken" like a stack of noodle bowls, etcdisable()else;Makes player take time to salvage.Game.SetPCSleepHours(fSalvageTime); otherwise just block future activation.GoToState("Done")endifEndEventEndState It's supposed to check if the player is combat, add items to their inventory and then pass time after the object the script is attached to is activated. It's an edit of Bethesda's DeafultAddItemOnActivate script which worked perfectly well but now I want to add the time component. Thanks in advance for even looking this over. Link to comment Share on other sites More sharing options...
Recommended Posts