Difference between revisions of "User talk:Lisselli"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Lisselli
imported>Lisselli
Line 2: Line 2:


<source lang="papyrus">
<source lang="papyrus">
Actor property PlayerRef auto
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


Float CurrentSkillLevel
;If the player is still level 50. Keep counting the times advance skill was called.
Int iCount
if CurrentPlayerLevel == PlayerRef.GetLevel()
 
Function AdvanceSkillEx(String asSkillName, Float afValue, Int aiClampValue=0)
; Let's say Destruction is 50. This variable will store that.
CurrentSkillLevel = PlayerRef.GetActorValue("asSKillName")
;If the skill is still 50. Keep counting the times advance skill was called.
if CurrentSkillLevel == PlayerRef.GetActorValue("asSkillName")
if iCount != aiClampValue
if iCount != aiClampValue
Game.AdvanceSkill(asSkillName, afValue)
Game.AdvanceSkill(asSkillName, afValue)
iCount += 1
iCount += 1
debug.notification("iCount: " +iCount)
; Everytime advanceskill  is called, iCount goes up until it reaches the clamp value.
; Everytime advanceskill  is called, iCount goes up until it reaches the clamp value.
endif
endif
elseif PlayerRef.GetActorValue("asSkillName") > CurrentSkillLevel
; if the skill is greater than 50, it leveled up at some point. Reset iCount.
iCount = 0
; Have the function call itself recursively.
AdvanceSkillEx(asSKillName, afValue, aiClampValue)
endif
endif
EndFunction
EndFunction
</source>
</source>

Revision as of 14:48, 6 November 2016

Sandbox Page for when I need to post code on the forums. Because it doesn't allow indention..

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