Jump to content

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


Recommended Posts

 

 

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?

 

 

 

 

 

For this method, to make an axe an armor, import the axe into outfit studio. Also import the vanilla MaleHands0 nif. Right click on the malehands0 nif under Meshes on the top right of the screen and select Set Reference. Position the axe so that it's in the right hand. After positioning, right click it under Meshes on the top right and select Copy Bone Weights. This will copy the bones weights of the male hands to the axe. Then, on the top right of the screen, select bones. Right click and delete all of the bones except for 1 from the axe. You only want 1 bone because the axe is a static rigid object. If you had more than 1 bone weight it will stretch with the hand during animation like regular armors do. Then, delete the male hands. Select File Export to Nif, and now you have a nif ready for the axe to be an armor.

 

Open the nif in nifskope to change it's slot. Click on Ninode > BSTriShape > BSDismemberSkinInstance. Under Block Details, click on Partitions. Double click the Body Part and change to an extra armor slot. I'd recommend 61.

 

Then in the ck create a new armor that uses the nif. I'd start by duplicating a vanilla armor such as a ring. This way the additional races are already set. First duplicate the ArmorAddon, change the Biped Model to your nif, and the Biped Object to 61. Then duplicate the a ring Armor, delete its model, (the armor addon) right click and select new to add the armoraddon you just made. Now you have an armor that is the axe mesh.

 

For the edited script I posted above, you would put your Axe Armors in a new formlist called PickaxeArmors, put your Pickaxe Weapons in the vanilla mineOreToolsList, and make sure the indexes match. So if an ebony pickaxe armor was in position 2 of the PickaxeArmors formlist, the ebony pickaxe weapon should be in position 2 of the mineOreToolsList.

 

Then in the edited script I posted above you would only need to change this:

 

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
Change GetFormFromFile where 0x345678 is to the PickaxeArmors Id. Replace the first two characters of the ID with 0x. The "MyMod.Esp" change to the name of your mod.
Oh and you also need to make the vanilla pickaxe AnimObject invisible. In the CK under miscellaneous > AnimObject double click the AnimObjectPickAxeWall. For the model click Edit. Then under Alternate Textures, double click AnimObjectPickaxe0 and choose NullTextureSet. This will make the pickaxe invisible.
Link to comment
Share on other sites

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

I also found this file: idlepickaxewall It is a text file that reads:

 

 

V3
2
IdlePickaxeEnter
IdlePickaxeEnterInstant
0
0
3
3064642194
1639224739
7891816
3064642194
2096811913
7891816
3064642194
2874650000
7891816

That's got to be the file read to tell what's what.
Thanks for all that info! That's sooooo helpful
Link to comment
Share on other sites

OK so everything was going good. right clicked hands and set reference. Positioned the axe in the right hand. Right clicked axe and copied bone weights. deleted all bones from project except for right hand index finger. during all this the hands were still highlighted green in the tree. deleted hands and the axe lost its bone. what did i do wrong?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...