Jump to content

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


Recommended Posts

Ok so here goes. I want to make a mod. I've been told it can't be done by some on Discord.

 

I want to make craft-able pickaxes. Easy right? Yes. Easy to do no problem. Thing is, I want them to be craft-able using different ores, dragon bone, malachite, orichalcum, etc. STILL not a problem.

 

The problem lies in the animation. So the pre-existing mine ore animation calls upon the animobjectpickaxe. Well it's also easy to make a new animobject for each pickaxe. The issue is knowing how to get the pre-existing animation to call upon the new "animobjectmalachitepickaxe" and display it being used during the animation.

 

Any thoughts? There isn't a mod like this and I really am hoping I can make it happen with your help!

Edited by Chris20201986
Link to comment
Share on other sites

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

So a little research (ok, alot) on my end since I have been looking into this for a couple weeks: I have come to the conclusion that there is one route I can take:

 

Create a script that the game reads first to determine what animation to use based on what pick is in the players inventory. Add that script to every mine ore furniture in the game?

Link to comment
Share on other sites

Thinking outside the box here:

Create separate animations for each type of pickaxe (i.e. modify to use the correct visual)

Each pickaxe when added to the player inventory will apply a perk. The perk does not need to actually do anything, it is just needed to inform other things.

Use Dynamic Animation Replacer with its HasPerk condition and check for the various pickaxe applied perks.

Possibly use a logical operator approach to ensure that the highest available is used rather than the first to return true.

 

If this works, this would dynamically change which animation is played at the ore vein depending upon the highest pickaxe style in the inventory.

Link to comment
Share on other sites

I was thinking the same thing about the individual animations. I have just been chasing my tail for hours on how to modify said animation but I can't even get the dang thing into blender to save my life and everything else is downloaded 10 different pirated software to make it all work. smh

 

Thanks for the heads up on Dynamic Animation Replacer. I will look into it.

Link to comment
Share on other sites

Another option, if you're interested. If you look at the vanilla MineOreScript, it uses furniture to play the animation. So, you could make new furnitures that use your new animations, use a reference alias in a quest pointing to the player, then use OnObjectEquipped event to detect when the player equips a pickaxe and find nearby oreviens and replace their used furniture with your new furniture based on which axe the player has equipped. Here's an example script, which does require SKSE and Papyrus Extender.

 

 

 

Scriptname TM_ReferenceAliasScript extends ReferenceAlias 
;alias pointing to the player

formlist property mineOreToolsList auto ;vanilla formlist. Only axes in this list can be used to mine ore.

Formlist Property Pickaxes Auto 
Formlist Property PickaxeFurnitures Auto 

Event OnInit() 
    ;Add all forms in the Pickaxes list to the mineOreToolsList so they can be used for mining ore.
    Int I = Pickaxes.GetSize() 
    While I > 0 
        I -= 1 
        mineOreToolsList.AddForm(Pickaxes.GetAt(I))
    EndWhile
EndEvent

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference) 
    If Pickaxes.HasForm(akBaseObject) ;did the player just equip a pickaxe? 
        Int FurnitureIndex         = Pickaxes.Find(akBaseObject) ;find which spot in the list the equipped pickaxe is 
        Furniture PickaxeFurniture = PickaxeFurnitures.GetAt(FurnitureIndex) as Furniture ; get the furniture associeted with the equipped pickaxe
        ObjectReference[] Activators = PO3_SKSEFunctions.FindAllReferencesOfFormType(Game.GetPlayer(), 24, 10000.0) ;find all activator ObjectReference's within 10000 units of the player.    
        Int I = Activators.Length 
        While I > 0 
            I -= 1 
            If (Activators[I] as MineOreScript) ;does the current activator have the MineOreScript attached? If so, assume it's an ore vein. 
                ObjectReference CurrentFurniture = Activators[I].getLinkedRef() ;find pickaxe furniture 
                If CurrentFurniture != None ;does the furniture exist? 
                    If CurrentFurniture.GetBaseObject() != PickaxeFurniture ;is the current furniture different from the pickaxeFurniture? 
                        ObjectReference NewFurniture = CurrentFurniture.PlaceAtMe(PickaxeFurniture, 1, True) ;place new furniture at current furniture 
                        PO3_SKSEFunctions.SetLinkedRef(Activators[I], NewFurniture, None) ;Set new furniture for this ore vein, it and its animation will be used when activating. 
                        CurrentFurniture.Disable()
                        CurrentFurniture.Delete() 
                    Endif 
                Endif
            Endif 
        EndWhile 
    Endif
EndEvent

 

 

 

Be sure to attach the vanilla MineOreFurnitureScript to your new furnitures.

Link to comment
Share on other sites

Another option is to edit the MineOreScript directly to use different furnitures based on the equipped axe. Use GetFormFromFile to get the formlists so you don't have to edit the properties of every ore vein. This has the potential to conflict with other mods though.

Link to comment
Share on other sites

@dybill

Your two approaches will not work. The stock script already allows for any pickaxe in the MineOreToolsList to be used to obtain ore via the OnHit event. It is the OnActivate event and the animation event that is of concern here. There is no equipping of the pickaxe ever taking place. It is completely visually done within the animation event. This is why I suggested different animations.

 

@Chris20201986

See if you can tell a difference between the Stalhrim ore veins and base game ore veins (animations used etc). The Stalhrim requires a specific pickaxe in the un-modded game. I know there is a formlist for it that is assigned to the MineOreToolsList property (instead of auto-filling it), but if I recall correctly the animation uses the correct pickaxe for at least the Stalhrim veins.

Link to comment
Share on other sites

Yes, my script will work. The animation is handled by having the player activate an invisible furniture. This is the OnActivate event from the mineOreScript:

 

 

 

event onActivate(objectReference akActivator)
;   debug.Trace(self + " has been activated by " + akActivator)
    
    ;Actor is attempting to mine
    if akActivator as actor
        ;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()
            elseif playerHasTools() == false
                FailureMessage.Show()
            ;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())
                if getLinkedRef()
                    myFurniture = getLinkedRef() as mineOreFurnitureScript
                    myFurniture.lastActivateRef = objSelf
                    getLinkedRef().activate(akActivator)
                    AchievementsQuest.incHardworker(2)
                Else
;                   debug.Trace(self + ": error this ore does not have a linkedRef")
                endif
            endif
        Else
            if getLinkedRef()
                getLinkedRef().activate(akActivator)
            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

 

You can see there's no SendAnimation function, or play idle function. It gets an invisible furniture linked ref, then has the player activate it, which plays the animation. Specifically this line here:

getLinkedRef().activate(akActivator)

In the MineOreFurnitureScript, it simply has the player active itself again to keep the animation going if there's more ore to be mined. I was suggesting to search for ore veins when the player equips an axe (my script would be on a reference alias pointing to the player) and change the furniture linked ref for nearby ore veins, which uses a different animation depending on the axe equipped.

Link to comment
Share on other sites

But the player doesn't need to equip the axe in order to play the animations. And if they have the axe equipped, in all likelihood they are going to attack it. In which case, the animation would never play. I do not see the benefit in using OnObjectEquipped in this scenario.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...