Difference between revisions of "Talk:GetItemHealthPercent - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Cipscis
(→‎Returns 0: Never used in vanilla scripts)
imported>Rasikko
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Obtaining the tempering level multiplier ==
These multipliers mainly effect the gold value of the object.
<source lang="papyrus">
Float Function GetTemperingLevelMultiplier(ObjectReference akRef)
    ; returns the multiplier associated with the tempering level.
    Float TemperingLevel = akRef.GetItemHealthPercent()
    if TemperingLevel <= 1.0
        return 1.0
    elseif TemperingLevel == 1.1
        return 1.166
    elseif TemperingLevel == 1.2
        return 1.333
    elseif TemperingLevel == 1.3
        return 1.499
    elseif TemperingLevel == 1.4
        return 1.666
    elseif TemperingLevel == 1.5
        return 1.833
    elseif TemperingLevel == 1.6
        return 1.999
    endif
EndFunction
</source>
[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2017-12-01T02:58:06 (EST)
==Returns 0==
==Returns 0==


I am trying to use the result on armour and weapons but it always returns 0.000000. Anyone know whether this function is working or not? Oss133 {{unsigned|Oss113|14:33, 4 March 2012 (EST)
I am trying to use the result on armour and weapons but it always returns 0.000000. Anyone know whether this function is working or not? Oss133 {{unsigned|Oss113|14:33, 4 March 2012 (EST)}}


: This function is never used in any vanilla scripts, so it's possible that it's broken. Just in case, though, could you post the script in which you've called it, in case you've done something wrong?
: This function is never used in any vanilla scripts, so it's possible that it's broken. Just in case, though, could you post the script in which you've called it, in case you've done something wrong?
Line 8: Line 34:


: -- [[User:Cipscis|Cipscis]] 16:09, 4 March 2012 (EST)
: -- [[User:Cipscis|Cipscis]] 16:09, 4 March 2012 (EST)
This is the script which I have added to the Iron Dagger
Scriptname aaHCMWARWepScript extends ObjectReference
Event OnEquipped(Actor akActor)
If akActor == Game.GetPlayer()
Debug.Notification("Item has " + GetItemHealthPercent() + " Health")
Endif
endEvent
Where do I find the Error Log?
Fixed the problem. I needed to use Self.GetItemPercent(). Also this only works on References. Not Base Objects.

Latest revision as of 11:50, 2 December 2017

Obtaining the tempering level multiplier[edit source]

These multipliers mainly effect the gold value of the object.

Float Function GetTemperingLevelMultiplier(ObjectReference akRef)
    ; returns the multiplier associated with the tempering level.
    Float TemperingLevel = akRef.GetItemHealthPercent()
	
    if TemperingLevel <= 1.0
        return 1.0
    elseif TemperingLevel == 1.1
        return 1.166
    elseif TemperingLevel == 1.2
        return 1.333
    elseif TemperingLevel == 1.3
        return 1.499
    elseif TemperingLevel == 1.4
        return 1.666
    elseif TemperingLevel == 1.5
        return 1.833
    elseif TemperingLevel == 1.6
        return 1.999
    endif
EndFunction

Rasikko (talk) 2017-12-01T02:58:06 (EST)

Returns 0[edit source]

I am trying to use the result on armour and weapons but it always returns 0.000000. Anyone know whether this function is working or not? Oss133 —The preceding unsigned comment was added by 14:33, 4 March 2012 (EST) (talkcontribs) Oss113

This function is never used in any vanilla scripts, so it's possible that it's broken. Just in case, though, could you post the script in which you've called it, in case you've done something wrong?
When it returns 0, is anything relevant put in the error log?
-- Cipscis 16:09, 4 March 2012 (EST)

This is the script which I have added to the Iron Dagger


Scriptname aaHCMWARWepScript extends ObjectReference

Event OnEquipped(Actor akActor)

If akActor == Game.GetPlayer()

Debug.Notification("Item has " + GetItemHealthPercent() + " Health")

Endif

endEvent


Where do I find the Error Log?

Fixed the problem. I needed to use Self.GetItemPercent(). Also this only works on References. Not Base Objects.