Jump to content

[LE] dialogue when player mines ore?


Smirkyguy

Recommended Posts

If you look at the vanilla MineOreFurnitureScript they use:

 

RegisterForAnimationEvent(Game.GetPlayer(), "IdlePickaxeExit")
RegisterForAnimationEvent(Game.GetPlayer(), "IdlePickaxeFloorExit")
RegisterForAnimationEvent(Game.GetPlayer(), "IdlePickaxeTableExit")
RegisterForAnimationEvent(Game.GetPlayer(), "IdleFurnitureExit")

I tried changing Exit to Enter in all of those in my own script, and then doing :

Event OnAnimationEvent(ObjectReference akSource, String asEventName)
    Debug.Notification("Player Mining")
EndEvent

But that didn't work. If you can find the right names for the enter animation events that should get the job done.

Edited by dylbill
Link to comment
Share on other sites

This is how I would do it. Make a new Global Variable, and call it something like PlayerMining.

 

Attach this script to your quest:

 

Scriptname DetectPlayerMiningScript extends Quest  

GlobalVariable Property PlayerMining Auto 

Event OnInit()
    RegisterForAnimationEvent(Game.GetPlayer(), "IdlePickaxeExit")
    RegisterForAnimationEvent(Game.GetPlayer(), "IdlePickaxeFloorExit")
    RegisterForAnimationEvent(Game.GetPlayer(), "IdlePickaxeTableExit")
EndEvent

Event OnAnimationEvent(ObjectReference akSource, String asEventName)
    PlayerMining.SetValue(1) 
    Utility.Wait(30) ;waits 30 seconds
    PlayerMining.SetValue(0)
EndEvent

Then, in your dialogue condition put GetGlobalValue PlayerMining == 1

 

I just checked though, and those animation events don't work either. Maybe a work around can be found. I'll think about it some more and get back to ya.

Link to comment
Share on other sites

Ok I figured out a way. First make 2 new global variables named PlayerMining and PlayerCooking. Leave them set to 0. Make a new reference alias in your Quest that points at the player. Fill type: Specific Reference. Cell: Any. Ref: PlayerRef. Then attach this script to the reference alias:

 

 

 

Scriptname DetectPlayerFurnitureScript extends ReferenceAlias  

GlobalVariable Property PlayerMining Auto 
GlobalVariable Property PlayerCooking Auto 
Keyword Property CraftingCookpot Auto

Event OnSit(ObjectReference akFurniture)
    Utility.Wait(0.2)
    MineOreFurnitureScript ScriptRef = akFurniture as MineOreFurnitureScript
    ;Debug.Notification("Enter Furniture")

    If ScriptRef != None ;if furinture we are using has the MineOreFurnitureScript attached. Assume player is mining. 
        ;Debug.Notification("Player Mining")
        PlayerMining.SetValue(1) 
    Elseif akFurniture.GetBaseObject().HasKeyword(CraftingCookpot) ;if furniture is cooking pot.
        ;Debug.Notification("Player cooking")
        PlayerCooking.SetValue(1) 
    Endif
EndEvent
        
Event OnGetUp(ObjectReference akFurniture)
    PlayerMining.SetValue(0)
    PlayerCooking.SetValue(0)
    ;Debug.Notification("Exit Furniture")
EndEvent

After compiling the script, click on it, click properties and Auto Fill All. This should automatically set all of your properties.
Then in your dialogue conditions put GetGlobalValue PlayerMining == 1 and GetGlobalValue PlayerCooking == 1. Hope that helps!
Edited by dylbill
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...