User talk:Lisselli
Revision as of 15:01, 6 November 2016 by imported>Lisselli
Sandbox Page for when I need to post code on the forums. Because it doesn't allow indention..
Scriptname SimpleTestScript extends ObjectReference
Actor property PlayerRef auto
Message property SimpleMessage auto
Float CurrentPlayerLevel
Int iCount
Bool bLockLevel = true
Event OnRead()
Menu()
EndEvent
Function Menu(Int aiButton=0)
aiButton = SimpleMessage.Show()
; before doing anything we need to check the player's level for any level ups.
if (CurrentPlayerLevel != 0)
if CurrentPlayerLevel < PlayerRef.GetLevel()
; Unlock
bLocklevel = false
; reset iCount
iCount = 0
endif
endif
if aiButton == 0 ; Advance skill.
AdvanceSkillEx("Destruction", 450.0, 5)
elseif aiButton == 1 ; Cancel.
return
endif
EndFunction
Function AdvanceSkillEx(String asSkillName, Float afValue, Int aiClampValue=0)
if (bLockLevel == true)
; Let's say Player is level 50. This variable will store that.
CurrentPlayerLevel = PlayerRef.GetLevel()
debug.notification("CurrentPlayerLevel: " +CurrentPlayerLevel)
; Lock this level so its not updated, UNLESS the player levels up and becomes higher than this value.
else
CurrentPlayerLevel = PlayerRef.GetLevel()
bLockLevel = true
endif
;If the player is still level 50. Keep counting the times advance skill was called.
if CurrentPlayerLevel == PlayerRef.GetLevel()
if iCount != aiClampValue
Game.AdvanceSkill(asSkillName, afValue)
iCount += 1
debug.notification("iCount: " +iCount)
; Everytime advanceskill is called, iCount goes up until it reaches the clamp value.
endif
endif
EndFunction