Jump to content

I've Been Told It Cant Be Done: Pickaxe Animations


Recommended Posts

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

Actually I did have another thought. The using different furnitures method is actually more complicated, because there's more than 1 vanilla ore furniture that you would have to account for. Instead, use the other method I suggested, to make the vanilla anime object invisible, but instead of equipping a weapon axe, make your new axes, and the vanilla axe, armors that use an extra armor slot and equip those instead. This is a little bit of work cause you have to position them and weight them (I'd recommend outfit studio). Weight them to only 1 bone in the hand. I recommend the pointer finger. I did something similar with my mod Take and Equip or Use for fallout 4 with the animated eating feature. The stand up 3rd person animation actually uses a modified vanilla Use Jet animation, equips and unequips food armors.

 

To modify the vanilla script to equip axe armors, I would do something like this:

 

;
;This script handles the Ore Veins and handshakes with the mining furniture
;===================================================================

sound property DrScOreOpen auto
{sound played when Ore is acquired}

formlist property mineOreToolsList auto
{Optional: Player must have at least one item from this formlist to interact}

Message Property FailureMessage Auto  
{Message to say why you can't use this without RequiredWeapon}

Message Property DepletedMessage Auto  
{Message to say that this vein is depleted}

MiscObject Property Ore Auto  
{what you get from this Ore Vein}

LeveledItem property lItemGems10 auto
{Optional: Gems that may be mined along with ore}

int Property ResourceCount = 1 Auto
{how many resources you get per drop}

int property ResourceCountTotal = 3 auto
{how many resources this has before it is depleted}

int property ResourceCountCurrent = -1 auto Hidden
{Used to track the current remaining resources}

int property StrikesBeforeCollection = 1 Auto
{how many times this is struck before giving a resource}

int property StrikesCurrent = -1 Auto hidden
{Current number of strikes}

int property AttackStrikesBeforeCollection = 3 Auto
{how many times this is struck by attacks before giving a resource}

int property AttackStrikesCurrent = -1 Auto hidden
{Current number of attack strikes}

mineOreFurnitureScript property myFurniture auto hidden
{the furniture for this piece of ore, set in script}

objectReference property objSelf auto hidden
{objectReference to self}

AchievementsScript property AchievementsQuest auto

Location Property CidhnaMineLocation Auto

Quest Property MS02 Auto

Quest Property DialogueCidhnaMine Auto

ObjectReference Property CidhnaMinePlayerBedREF Auto

;changed==================================================
Formlist Property PickaxeArmors Auto Hidden
{Formlist of Furniture base forms}

Armor Property Slot61Armor Auto Hidden
{current armor in Slow 61}
;changed===================================================================


;===================================================================
;;EVENT BLOCK
;===================================================================

event onCellAttach()
;   debug.Trace(self + ": is running onCellAttach")
    blockActivation()
    SetNoFavorAllowed()
    objSelf = self as objectReference
    if !getLinkedRef()
;       debug.Trace(self + ": does not have a linked ref, going to depleted state")
        depleteOreDueToFailure()
    endif
    
;Changed===========================================================================
    If PickaxeArmors == None 
        PickaxeArmors = Game.GetFormFromFile(0x345678, "MyMod.Esp") as formlist ;get formlist from mod
    Endif
;Changed============================================================================
endEvent


event onActivate(objectReference akActivator)
;   debug.Trace(self + " has been activated by " + akActivator)
    
    ;Actor is attempting to mine
    if akActivator as actor
        
    ;Changed===============================
        Actor akActor = akActivator as Actor
        Form Tool = GetTool(akActor)
    ;Changed===============================
        
        ;if the actor is the player
        if akActivator == game.getPlayer()
            ;if this is not depleted and the player has the right item
            
            If ResourceCountCurrent == 0
                DepletedMessage.Show()
                
        ;Changed====================
            elseif Tool == None
                FailureMessage.Show()
        ;Changed====================
                
            ;enter the furniture
            else
                If Game.GetPlayer().GetCurrentLocation() == CidhnaMineLocation && MS02.ISRunning() == False
;                   debug.Trace(self + "Player is in Cidhna Mine, activate the bed to serve time")
                    CidhnaMinePlayerBedREF.Activate(Game.GetPlayer())
                    DialogueCidhnaMine.SetStage(45)
                    Return
                 EndIf
                 ;  debug.Trace(self + " should cause " + akActivator + " to activate " + getLinkedRef())
                 
            ;Changed======================================
                 ObjectReference OreFurniture = GetLinkedRef()
            ;Changed================================     
            
                 if OreFurniture
                    myFurniture = OreFurniture as mineOreFurnitureScript
                    myFurniture.lastActivateRef = objSelf
                    getLinkedRef().activate(akActivator)
                    AchievementsQuest.incHardworker(2)
                    
                ;Changed========================================================================================
                    akActor.EquipItem(Tool) ;player equips tool armor
                    Slot61Armor = akActor.GetEquippedArmorInSlot(61) ;save current armor equipped in slot 61 
                    
                    While OreFurniture.IsFurnitureInUse() ;wait till player is done using furniture.
                        Utility.Wait(2)
                    EndWhile
                    
                    akActor.UnEquipItem(Tool) 
                    akActor.RemoveItem(Tool)
                    If Slot61Armor 
                        akActor.EquipItem(Slot61Armor)
                    EndIf
                ;Changed========================================================================================
                    
                 Else
;                   debug.Trace(self + ": error this ore does not have a linkedRef")
                 EndIf
            endif
        Else
        ;Changed===========================================
            ObjectReference OreFurniture = GetLinkedRef()
            if OreFurniture
                Slot61Armor = akActor.GetEquippedArmorInSlot(61) ;save current armor equipped in slot 61 
                OreFurniture.activate(akActivator)
                
                If Tool != None
                    akActor.EquipItem(Tool) ;NPC equips Tool Armor
                Else 
                    Tool = PickaxeArmors.GetAt(0) ;If NPC doesn't have a required tool, equip first axe armor in list. 
                    akActor.EquipItem(Tool)
                Endif
                
                While OreFurniture.IsFurnitureInUse() ;wait till NPC is done using furniture.
                    Utility.Wait(2)
                EndWhile
                
                akActor.UnEquipItem(Tool) 
                akActor.RemoveItem(Tool)
                If Slot61Armor 
                    akActor.EquipItem(Slot61Armor)
                EndIf
        ;Changed====================================
        
            Else
;               debug.Trace(self + ": error this ore does not have a linkedRef")
            endif
        EndIf
        
    ;Furniture is telling ore it has been struck    
    ElseIf akActivator == GetLinkedRef()
;       debug.Trace(self + ": has been activated by" + akActivator)
        ProccessStrikes()
        
    ;Something unexpected has activated the ore
    Else
;       debug.Trace(self + "has been activated by: " + akActivator + " why?")
    endif
endEvent

;;;May add on hit with pickaxe here later
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
;   debug.Trace(self + ": onHit - akAgressor = " + akAggressor + "; akSource = " + akSource)
    if akAggressor == game.getPlayer()
        if mineOreToolsList.hasForm(akSource)
            
            proccessAttackStrikes()
        endif
    endif
endEvent

event onReset()
;   debug.Trace(self + ": is running onReset")
    ;THIS WASN'T WORKING RIGHT
    self.Reset()
    self.clearDestruction()
    self.setDestroyed(False)
    ; if getLinkedRef()
        resourceCountCurrent = -1
    ; else
        ; depleteOreDueToFailure()
    ; endif
endEvent

;===================================================================
;;FUNCTION BLOCK
;===================================================================

;changed =================================================
Form function GetTool(Actor akActor)
    if akActor.GetItemCount(mineOreToolsList) > 0
;       debug.Trace(self + ": playerHasTools is returning true")
        Int M = mineOreToolsList.GetSize() 
        While M > 0 
            M -= 1 
            Form Tool = mineOreToolsList.GetAt(M) 
            If akActor.GetItemCount(Tool) > 0 
                Return PickaxeArmors.GetAt(M)
            Endif 
        EndWhile 
        
        Return None
    Else
;       debug.Trace(self + ": playerHasTools is returning false")
        return None
    endIf
endFunction
;changed ===============================================================

function proccessAttackStrikes()
    if AttackStrikesCurrent <= -1
        AttackStrikesCurrent = AttackStrikesBeforeCollection
    EndIf
    AttackStrikesCurrent -= 1
    
    if AttackStrikesCurrent == 0
        AttackstrikesCurrent = AttackStrikesBeforeCollection
        giveOre()
    endIf
endFunction

function proccessStrikes()
    if StrikesCurrent <= -1
        StrikesCurrent = StrikesBeforeCollection
    EndIf
    StrikesCurrent -= 1
    
    if StrikesCurrent == 0
        strikesCurrent = StrikesBeforeCollection
        giveOre()
    endIf
endFunction

function giveOre()
    if ResourceCountCurrent == -1
        ResourceCountCurrent = ResourceCountTotal
    EndIf
    
    if ResourceCountCurrent > 0
        ResourceCountCurrent -= 1
;       debug.Trace(self + ": ResourceCountCurrent = " + ResourceCountCurrent)
        if ResourceCountCurrent == 0
            
;           debug.Trace(self + ": ResourceCountCurrent == 0 - depleted" )
            self.damageObject(50)
            getLinkedRef().activate(objSelf)
            DrScOreOpen.play(self)
            self.setDestroyed(true)
            ; if this vein has ore and/or gems defined, give them.
            if ore
                (game.getPlayer()).addItem(Ore, ResourceCount)
            endif
            if lItemGems10
                (game.getPlayer()).addItem(lItemGems10)
            endif
            DepletedMessage.Show()
        else
            DrScOreOpen.play(self)
            ; if this vein has ore and/or gems defined, give them.
            if ore
                (game.getPlayer()).addItem(Ore, ResourceCount)
            endif
            if lItemGems10
                (game.getPlayer()).addItem(lItemGems10)
            endif
        endif
    elseif ResourceCountCurrent == 0
        getLinkedRef().activate(objSelf)
        (getLinkedRef() as MineOreFurnitureScript).goToDepletedState()
        DepletedMessage.Show()
    endif

EndFunction

function depleteOreDueToFailure()
    self.damageObject(50)
    ;THIS WASN'T WORKING RIGHT
    self.setDestroyed(true)
    ResourceCountCurrent = 0
endFunction

Note that the GetEquippedArmorInSlot function requires SSE. If you wanted to do it for LE too you could use SKSE's GetWornForm function instead.
Edited by dylbill
Link to comment
Share on other sites

I actually checked. Visual Effects use Art Objects, not AnimObjects. I tried to make a new art object that uses the pickaxe animObject nif, then make a visual effect that uses said art object, but it didn't work. The pickaxe shows on the floor, not in the hand. Visual Effects can be found in the CK under World Data if you want to look into them, but using armors may be easier.

Link to comment
Share on other sites

 

Actually I did have another thought. The using different furnitures method is actually more complicated, because there's more than 1 vanilla ore furniture that you would have to account for. Instead, use the other method I suggested, to make the vanilla anime object invisible, but instead of equipping a weapon axe, make your new axes, and the vanilla axe, armors that use an extra armor slot and equip those instead. This is a little bit of work cause you have to position them and weight them (I'd recommend outfit studio). Weight them to only 1 bone in the hand. I recommend the pointer finger. I did something similar with my mod Take and Equip or Use for fallout 4 with the animated eating feature. The stand up 3rd person animation actually uses a modified vanilla Use Jet animation, equips and unequips food armors.

 

To modify the vanilla script to equip axe armors, I would do something like this:

 

;
;This script handles the Ore Veins and handshakes with the mining furniture
;===================================================================

sound property DrScOreOpen auto
{sound played when Ore is acquired}

formlist property mineOreToolsList auto
{Optional: Player must have at least one item from this formlist to interact}

Message Property FailureMessage Auto  
{Message to say why you can't use this without RequiredWeapon}

Message Property DepletedMessage Auto  
{Message to say that this vein is depleted}

MiscObject Property Ore Auto  
{what you get from this Ore Vein}

LeveledItem property lItemGems10 auto
{Optional: Gems that may be mined along with ore}

int Property ResourceCount = 1 Auto
{how many resources you get per drop}

int property ResourceCountTotal = 3 auto
{how many resources this has before it is depleted}

int property ResourceCountCurrent = -1 auto Hidden
{Used to track the current remaining resources}

int property StrikesBeforeCollection = 1 Auto
{how many times this is struck before giving a resource}

int property StrikesCurrent = -1 Auto hidden
{Current number of strikes}

int property AttackStrikesBeforeCollection = 3 Auto
{how many times this is struck by attacks before giving a resource}

int property AttackStrikesCurrent = -1 Auto hidden
{Current number of attack strikes}

mineOreFurnitureScript property myFurniture auto hidden
{the furniture for this piece of ore, set in script}

objectReference property objSelf auto hidden
{objectReference to self}

AchievementsScript property AchievementsQuest auto

Location Property CidhnaMineLocation Auto

Quest Property MS02 Auto

Quest Property DialogueCidhnaMine Auto

ObjectReference Property CidhnaMinePlayerBedREF Auto

;changed==================================================
Formlist Property PickaxeArmors Auto Hidden
{Formlist of Furniture base forms}

Armor Property Slot61Armor Auto Hidden
{current armor in Slow 61}
;changed===================================================================


;===================================================================
;;EVENT BLOCK
;===================================================================

event onCellAttach()
;   debug.Trace(self + ": is running onCellAttach")
    blockActivation()
    SetNoFavorAllowed()
    objSelf = self as objectReference
    if !getLinkedRef()
;       debug.Trace(self + ": does not have a linked ref, going to depleted state")
        depleteOreDueToFailure()
    endif
    
;Changed===========================================================================
    If PickaxeArmors == None 
        PickaxeArmors = Game.GetFormFromFile(0x345678, "MyMod.Esp") as formlist ;get formlist from mod
    Endif
;Changed============================================================================
endEvent


event onActivate(objectReference akActivator)
;   debug.Trace(self + " has been activated by " + akActivator)
    
    ;Actor is attempting to mine
    if akActivator as actor
        
    ;Changed===============================
        Actor akActor = akActivator as Actor
        Form Tool = GetTool(akActor)
    ;Changed===============================
        
        ;if the actor is the player
        if akActivator == game.getPlayer()
            ;if this is not depleted and the player has the right item
            
            If ResourceCountCurrent == 0
                DepletedMessage.Show()
                
        ;Changed====================
            elseif Tool == None
                FailureMessage.Show()
        ;Changed====================
                
            ;enter the furniture
            else
                If Game.GetPlayer().GetCurrentLocation() == CidhnaMineLocation && MS02.ISRunning() == False
;                   debug.Trace(self + "Player is in Cidhna Mine, activate the bed to serve time")
                    CidhnaMinePlayerBedREF.Activate(Game.GetPlayer())
                    DialogueCidhnaMine.SetStage(45)
                    Return
                 EndIf
                 ;  debug.Trace(self + " should cause " + akActivator + " to activate " + getLinkedRef())
                 
            ;Changed======================================
                 ObjectReference OreFurniture = GetLinkedRef()
            ;Changed================================     
            
                 if OreFurniture
                    myFurniture = OreFurniture as mineOreFurnitureScript
                    myFurniture.lastActivateRef = objSelf
                    getLinkedRef().activate(akActivator)
                    AchievementsQuest.incHardworker(2)
                    
                ;Changed========================================================================================
                    akActor.EquipItem(Tool) ;player equips tool armor
                    Slot61Armor = akActor.GetEquippedArmorInSlot(61) ;save current armor equipped in slot 61 
                    
                    While OreFurniture.IsFurnitureInUse() ;wait till player is done using furniture.
                        Utility.Wait(2)
                    EndWhile
                    
                    akActor.UnEquipItem(Tool) 
                    akActor.RemoveItem(Tool)
                    If Slot61Armor 
                        akActor.EquipItem(Slot61Armor)
                    EndIf
                ;Changed========================================================================================
                    
                 Else
;                   debug.Trace(self + ": error this ore does not have a linkedRef")
                 EndIf
            endif
        Else
        ;Changed===========================================
            ObjectReference OreFurniture = GetLinkedRef()
            if OreFurniture
                Slot61Armor = akActor.GetEquippedArmorInSlot(61) ;save current armor equipped in slot 61 
                OreFurniture.activate(akActivator)
                
                If Tool != None
                    akActor.EquipItem(Tool) ;NPC equips Tool Armor
                Else 
                    Tool = PickaxeArmors.GetAt(0) ;If NPC doesn't have a required tool, equip first axe armor in list. 
                    akActor.EquipItem(Tool)
                Endif
                
                While OreFurniture.IsFurnitureInUse() ;wait till NPC is done using furniture.
                    Utility.Wait(2)
                EndWhile
                
                akActor.UnEquipItem(Tool) 
                akActor.RemoveItem(Tool)
                If Slot61Armor 
                    akActor.EquipItem(Slot61Armor)
                EndIf
        ;Changed====================================
        
            Else
;               debug.Trace(self + ": error this ore does not have a linkedRef")
            endif
        EndIf
        
    ;Furniture is telling ore it has been struck    
    ElseIf akActivator == GetLinkedRef()
;       debug.Trace(self + ": has been activated by" + akActivator)
        ProccessStrikes()
        
    ;Something unexpected has activated the ore
    Else
;       debug.Trace(self + "has been activated by: " + akActivator + " why?")
    endif
endEvent

;;;May add on hit with pickaxe here later
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
;   debug.Trace(self + ": onHit - akAgressor = " + akAggressor + "; akSource = " + akSource)
    if akAggressor == game.getPlayer()
        if mineOreToolsList.hasForm(akSource)
            
            proccessAttackStrikes()
        endif
    endif
endEvent

event onReset()
;   debug.Trace(self + ": is running onReset")
    ;THIS WASN'T WORKING RIGHT
    self.Reset()
    self.clearDestruction()
    self.setDestroyed(False)
    ; if getLinkedRef()
        resourceCountCurrent = -1
    ; else
        ; depleteOreDueToFailure()
    ; endif
endEvent

;===================================================================
;;FUNCTION BLOCK
;===================================================================

;changed =================================================
Form function GetTool(Actor akActor)
    if akActor.GetItemCount(mineOreToolsList) > 0
;       debug.Trace(self + ": playerHasTools is returning true")
        Int M = mineOreToolsList.GetSize() 
        While M > 0 
            M -= 1 
            Form Tool = mineOreToolsList.GetAt(M) 
            If akActor.GetItemCount(Tool) > 0 
                Return PickaxeArmors.GetAt(M)
            Endif 
        EndWhile 
        
        Return None
    Else
;       debug.Trace(self + ": playerHasTools is returning false")
        return None
    endIf
endFunction
;changed ===============================================================

function proccessAttackStrikes()
    if AttackStrikesCurrent <= -1
        AttackStrikesCurrent = AttackStrikesBeforeCollection
    EndIf
    AttackStrikesCurrent -= 1
    
    if AttackStrikesCurrent == 0
        AttackstrikesCurrent = AttackStrikesBeforeCollection
        giveOre()
    endIf
endFunction

function proccessStrikes()
    if StrikesCurrent <= -1
        StrikesCurrent = StrikesBeforeCollection
    EndIf
    StrikesCurrent -= 1
    
    if StrikesCurrent == 0
        strikesCurrent = StrikesBeforeCollection
        giveOre()
    endIf
endFunction

function giveOre()
    if ResourceCountCurrent == -1
        ResourceCountCurrent = ResourceCountTotal
    EndIf
    
    if ResourceCountCurrent > 0
        ResourceCountCurrent -= 1
;       debug.Trace(self + ": ResourceCountCurrent = " + ResourceCountCurrent)
        if ResourceCountCurrent == 0
            
;           debug.Trace(self + ": ResourceCountCurrent == 0 - depleted" )
            self.damageObject(50)
            getLinkedRef().activate(objSelf)
            DrScOreOpen.play(self)
            self.setDestroyed(true)
            ; if this vein has ore and/or gems defined, give them.
            if ore
                (game.getPlayer()).addItem(Ore, ResourceCount)
            endif
            if lItemGems10
                (game.getPlayer()).addItem(lItemGems10)
            endif
            DepletedMessage.Show()
        else
            DrScOreOpen.play(self)
            ; if this vein has ore and/or gems defined, give them.
            if ore
                (game.getPlayer()).addItem(Ore, ResourceCount)
            endif
            if lItemGems10
                (game.getPlayer()).addItem(lItemGems10)
            endif
        endif
    elseif ResourceCountCurrent == 0
        getLinkedRef().activate(objSelf)
        (getLinkedRef() as MineOreFurnitureScript).goToDepletedState()
        DepletedMessage.Show()
    endif

EndFunction

function depleteOreDueToFailure()
    self.damageObject(50)
    ;THIS WASN'T WORKING RIGHT
    self.setDestroyed(true)
    ResourceCountCurrent = 0
endFunction

Note that the GetEquippedArmorInSlot function requires SSE. If you wanted to do it for LE too you could use SKSE's GetWornForm function instead.

 

If I were to attempt something like this, how do I go about it? I need to weight the axes in outfit studio, which I use regularly, to a finger in the hand. I've never done something like that. What else would be necessary?

 

@ishara meradin I can seem to figure out accessing these .hkx files. I mean I unzipped those days ago but I cant get them into blender and no program seems to work for me.

 

 

Link to comment
Share on other sites

This worked for me to convert the hkx files into xml. But I found nothing that pointed to the animated object. Perhaps you'll have better luck.

https://www.nexusmods.com/skyrimspecialedition/mods/43108

I do not use SKSE and tbh I have no idea what it's for. I assumed it was for correcting issues that older CK had with scripting. It's tough coming in late in the game because there are alot of things and tuts that are dated and trying to fish through it all is a pain. I just didn't want yet ANOTHER thing for people to rely upon so I don't use SKSE. :(

Link to comment
Share on other sites

SKSE has nothing to do with the Creation Kit. SKSE stands for Skyrim Script Extender. It adds additional papyrus functions and events. You can use SKSE for your own personal game without making mods that require SKSE. And the "mod" that I linked, just uses SKSE in order to run its stuff while the game is running. In other words, instead of the end user struggling to find all the necessary other hkx files needed to convert the one they want with a command line utility, this tool can grab all that stuff because the game already has it loaded.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...