Jump to content

Script Help Needed


Kasdar

Recommended Posts

Ok I figured out my problem, however if anyone can tell me how to get a perk script to recognise and change variables I would be interested in knowing how. Edited by Kasdar
Link to comment
Share on other sites

Short Rand100
Short UnlockChance

If Player.GetItemCount Lockpick ==0
ShowMessage KasdarsNoLockpickMsg
EndIf

If Player.GetItemCount Lockpick >= 1
Set Rand100 to (1 + GetRandomPercent)

Set UnlockChance to (50 - (LockLevel) + (Player.GetAV Lockpick) + (2 * (Player.GetAV Luck)))

If UnlockChance > 95
	Set UnlockChance to 95
Endif

If UnlockChance >= Rand100
	unlock
	activate player
Else
	Player.RemoveItem Lockpick 1
	ShowMessage KasdarsLockpickMsg
EndIf
EndIf


 

This is the code that doesnt work. it always succeeds I even attepted to replace my formula and set UnlockChance to 0 to force a failure but it still succeeded/ thats when I went with the next code, eliminating the varriables.

I manually set the lock level for each difficulty.

 


If Player.GetItemCount Lockpick ==0
ShowMessage KasdarsNoLockpickMsg
EndIf

If Player.GetItemCount Lockpick >= 1
If (50 -(LockLevel) +  (Player.GetAV Lockpick) + (2 * (Player.GetAV Luck))) >= (1+ GetRandomPercent)
	unlock
	activate player
Else
	Player.RemoveItem Lockpick 1
	ShowMessage KasdarsLockpickMsg
EndIf
EndIf

 

This is the only way I could get it to work.

Link to comment
Share on other sites

You have to define the variables in a quest script. You can't define variables in a result script. So just create a dummy quest with a script on it and reference the variables that way. The quest doesn't even need to be running.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...