Difference between revisions of "User talk:Lisselli"

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


Float CurrentSkillLevel
Float CurrentSkillLevel
Float PreviousSkillLevel
Int iCount
Int iCount



Revision as of 13:47, 6 November 2016

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

Actor property PlayerRef auto

Float CurrentSkillLevel
Int iCount

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
			Game.AdvanceSkill(asSkillName, afValue)
			iCount += 1
			; Everytime advanceskill  is called, iCount goes up until it reaches the clamp value.
		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
EndFunction