Alright so, progress! I've set up a perk that comes into effect whenever a locked container or door is activated. The next step (I think?!) is to create a script that runs whenever this occurs. Unfortunately I can't get it compile :sad:
Scriptname LazyLocks extends ReferenceAlias
{Attached script **should** work out if the force-lock attempt is successful or not.}
ActorValue Property Perception Auto Const
ActorValue Property Luck Auto Const
int P = Game.GetPlayer().ActorValue Function GetPerceptionAV()
; Returns players perception skill as an integer value
int L = Game.GetPlayer().ActorValue Function GetLuckAV()
; Returns players luck skill as an integer value
Int Function GetLockLevel() native
;Returns lock level of target lock as an integer
Event OnActivate(ObjectReference akActionRef)
If locklevel == 25
Int RI = Utility.RandomInt(0, 25)
elseif locklevel == 50
Int RI = Utility.RandomInt(0, 50)
elseif locklevel == 75
Int RI = Utility.RandomInt(0, 75)
elseif locklevel == 100
Int RI = Utility.RandomInt(0, 100)
else Debug.Notification(This lock cannot be forced.)
end if
;Generates random number, with the available range based on lock-level.
End event
int PlayerSkill = L*P
;Defines playerSKill as the product of a players luck and perception.
Event OnActivate(ObjectReference akActionRef)
If PlayerSKill > RI
akTargetRef.Unlock()
Else
Debug.Notification(You fail to force the lock...)
end if
End eventThe following errors were produced: C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\LAZYLOCKS.psc(7, :cool:: no viable alternative at input 'Game' C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\LAZYLOCKS.psc(7,12): required (...)+ loop did not match anything at input '.' C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\LAZYLOCKS.psc(7,4): Unknown user flag game I'm guessing this is to do with not declaring something correctly, no?