Jump to content

KJA1258

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by KJA1258

  1. Thanks a lot for the input. It was actually triggering correctly, I just renamed the file and script before and that kinda messed Skyrim up.

    I will clean it up, however, my example here is by now legacy code.

    Thanks for the logical operators, I couldn't find them anywhere. Interestingly, they are the same as Objective-C, my native language.

     

    As a side question, is it better to call

    Actor PlayerRef = Game.GetPlayer()
    

    instead of Game.GetPlayer() directly where I need it?

  2. Hello everyone.

    The topic title suggest a very unusual problem (if you can call it that way) I've stumbled upon while writing a Papyrus script. Although I'm new to Papyrus, I'm no complete beginner to programming.

    Concerning the error/problem, it appears as if Papyrus simply ignores the if condition.

     

    Here is the code:

    Scriptname AutoCombatCamPlayerScript extends Quest  
    {Forces Player into FP Cam on Combat Initiation and when Bow or XBow is drawn}
    
    GlobalVariable Property myKey Auto
    
    int camState
    int hotkey = 76
    int enabled
    
    Event OnInit()
    	Debug.Notification("Started AutoCombatCam")
    	RegisterForSingleUpdate(1)
    EndEvent
    
    Event OnKeyDown(Int KeyCode)
    	If  Input.IsKeyPressed(hotkey) ; Only run code when the status changes
    		Debug.Notification("Hotkey Pressed")
    		If enabled == 1
    			Debug.Notification("Turned On")
    			RegisterForUpdate(1)
    			Debug.Notification("Started")
    			enabled = 0
    		Else ; If enabled == False
    			Debug.Notification("Turned Off")
    			UnregisterForUpdate()
    			Debug.Notification("Killed")
    			enabled = 1
    		EndIf
    	EndIf
    EndEvent
    
    Event OnUpdate()
    	Debug.Notification("EXEC")
    	RegisterForKey(hotkey)
    
    	hotkey = myKey.getValueInt()
    	If enabled == 0
    		If (Game.GetPlayer()).IsInCombat()
    				Game.ForceFirstPerson()
    		Else
    			;Not in combat, switch to FP on Bow and XBow draw
    			If (Game.GetPlayer()).IsWeaponDrawn()
    				If (Game.GetPlayer()).GetEquippedItemType(0) == 7
    					Game.ForceFirstPerson()
    				ElseIf (Game.GetPlayer()).GetEquippedItemType(0) == 12
    					Game.ForceFirstPerson()
    				EndIf
    			EndIf
    		 EndIf
    	EndIf
    	RegisterForSingleUpdate(1)
    EndEvent
    

    I would be pleased if anyone could figure this out, since I'm, though knowing Obj-C, too inexperienced to know why this is caused or to resolve it.

     

    EDIT: I should have mentioned which IF statement it actually is. The affected statement is the

    if enabled == 0
    

    in the onUpdate() event.

    Kilian

×
×
  • Create New...