TyburnKetch Posted September 21, 2020 Share Posted September 21, 2020 Your 2nd elseif is asking the same thing in your or line. Should not one of them be lantern? Or is that deliberate? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 21, 2020 Share Posted September 21, 2020 TyburnKetch is correct that in your last posting the condition intended to check for the lantern checks for the torch. Sorry about the other, I forgot that those functions run on Actor and that akActionRef is ObjectReference. That's why they failed. Made sure I didn't do that on this one. It is based on your last posted script code. I corrected the aforementioned condition check and did a little adjustment to the logic. Also my intent in trying to use akActionRef was that each use of Game.GetPlayer() makes the script pause and fetch to data from the GetPlayer function on the Game script. Getting it once and storing it will help to speed things up. ObjectReference Property LitMarker Auto ObjectReference Property UnlitMarker Auto Light Property HasTorch Auto Light Property HasLantern Auto ObjectReference Property LSource Auto ObjectReference Property PlaySNDHere Auto Message Property EquipTorch Auto Message Property NeedFlame Auto Sound Property CandleSND Auto Bool Property SelfDis = True Auto Bool Property SelfDel = True Auto Actor PlayerRef Auto State Waiting Event OnActivate(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() PlayerRef == akActionRef ; player has torch or lantern equipped candle lights If PlayerRef.GetEquippedItemType(0) == 11) LitMarker.disable() UnlitMarker.enable(); optional LSource.enable() CandleSND.Play(PlaySNDHere); optional If SelfDis == True self.Disable() EndIf If SelfDel == True self.Delete() EndIf ; player does not have torch or lantern equipped Else ; player does not have a torch or lantern If (PlayerRef.GetItemCount(HasTorch) <= 0) && (PlayerRef.GetItemCount(HasLantern) <= 0) NeedFlame.show() ; player has torch or lantern but not equipped ElseIf (PlayerRef.GetItemCount(HasTorch) >= 1) || (PlayerRef.GetItemCount(HasLantern) >= 1) EquipTorch.show() EndIf EndIf EndIf EndEvent EndState Link to comment Share on other sites More sharing options...
ReDragon2013 Posted September 22, 2020 Share Posted September 22, 2020 (edited) I am sorry for breaking in to this thread. I want to give some new ideas. ; https://forums.nexusmods.com/index.php?/topic/9103193-getequippeditemtype-are-duplicates-the-same-type/page-2 Message PROPERTY EquipTorch auto Message PROPERTY NeedFlame auto ;FormList PROPERTY myLightList auto ; own created list to shrink conditions and made next 3 properties obsolete Light PROPERTY Torch01 auto ; torch type 1 Light PROPERTY Torch02 auto ; torch type 2 Light PROPERTY My_LanternCarry2m auto ; your created lantern Sound PROPERTY CandleSND auto ObjectReference PROPERTY LitMarker auto ObjectReference PROPERTY LSource auto ObjectReference PROPERTY UnlitMarker auto ; Optional ObjectReference PROPERTY PlaySNDHere auto ; Optional Bool PROPERTY SelfDis = TRUE auto ; init this Bool as TRUE, disable this object Bool PROPERTY SelfDel = TRUE auto ; init .. , mark this object for delete (remove the script instance) ; -- EVENTs -- ; https://www.creationkit.com/index.php?title=GetEquippedItemType_-_Actor ;================= Auto State Waiting ;================= EVENT OnActivate(ObjectReference akActionRef) IF (akActionRef == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - not player activated ENDIF ;--------------------- gotoState("Busy") ; ### STATE ### do not allow object activation once more IF myF_Action(akActionRef as Actor) IF ( SelfDis ) ; == True self.Disable() ENDIF IF ( SelfDel ) ; == True self.Delete() ENDIF ENDIF gotoState("Waiting") ; ### STATE ### allow activation, if object is still enabled and not marked for delete ENDEVENT ;======= endState ;========================== State Busy ;========= EVENT OnActivate(ObjectReference akActionRef) ENDEVENT ;======= endState ; -- FUNCTION -- ;------------------------------------- Bool FUNCTION myF_Action(Actor player) ;------------------------------------- IF player.GetEquippedItemType(0) == 11) ; player has torch or lantern equipped candle lights (in left hand) LitMarker.DisableNoWait() LSource.Enable() IF ( UnlitMarker ) UnlitMarker.Enable() ; optional ENDIF IF ( CandleSND ) CandleSND.Play(PlaySNDHere) ; optional ENDIF Return TRUE ; /1 ENDIF ;--------- ; player does not have any light equipped ; Keep in mind: CreationKit preplaced items (to actors or containers) will not count here !! ; IF (player.GetItemCount(myLightList) > 0) ; EquipTorch.show() ; ELSE ; NeedFlame.show() ; ENDIF IF (player.GetItemCount(Torch01) > 0) EquipTorch.show() ; player has torch01, but not equipped ELSEIF (Torch02) && (player.GetItemCount(Torch02) > 0) EquipTorch.show() ; player has torch02, but not equipped ELSEIF (player.GetItemCount(My_LanternCarry2m) > 0) ; player has my lantern, but not equipped EquipTorch.show() ELSE ;;; Debug.Notification("No light found..") NeedFlame.show() ; player has whether a torch nor the lantern ENDIF Return False ; /2 ENDFUNCTION Edited September 22, 2020 by ReDragon2013 Link to comment Share on other sites More sharing options...
antstubell Posted September 23, 2020 Author Share Posted September 23, 2020 @ Ishara - I get "You need a naked flame" message even if player has a torch and/or a lantern in inventory. Also when equipping either torch or lantern candle does not light.@ReDragon - You're always welcome in my threads. Same problem as Ishara - "You need a naked flame" message when player has either/or both but candle does light. In both scripts there was a loop error but was easily fixed parenthesis missing/not required in...IF player.GetEquippedItemType(0) == 11) - This is the line with the error. I removed the parenthesis at the end. Link to comment Share on other sites More sharing options...
Recommended Posts