Jump to content

Ash Pile: find attached actor


pra

Recommended Posts

Is there a way to find which actor is attached to a specific ash pile script-wise?

 

I can think of a few ways of cludging it, since I control the moment when the ash pile gets attached, but, is there a "clean" way?

 

I tried GetRefsLinkedToMe, but it doesn't seem to work. I called it without any KWs, since I have no idea which keyword it could be.

 

 

What I actually want to do is to use RemoveAllItems(Game.getPlayer()) on the corpse. Calling it on the ash pile doesn't do anything.

Link to comment
Share on other sites

Call it on the original actor you attached the ashpile to. The ashpile is just an activator that opens the actors container.

Did you even read my post?

 

I was asking how to find that original actor, if I only have the ash pile as a starting point.

Link to comment
Share on other sites

You can try this out, though I can't guarantee it'll work as intended, since I have no way of testing it.

 

First you need the ash pile reference. Let's forget about the activation properties of it - this is not revealed in the CK. We'll only care about any dead "invisible" actors that are near the ashpile. This likely wont work though, because actors are removed from the world via SetCriticalStage..

 

Anyway, you need the keyword ActorTypeNPC.

 

You might need this: https://www.creationkit.com/fallout4/index.php?title=FindClosestReferenceOfTypeFromRef_-_Game

And will need this, if you use the above: https://www.creationkit.com/fallout4/index.php?title=GetFormFromFile_-_Game

Use this with the above function: 0009412E - that is the formid for the AshPile01 form.

 

Next you'll need to use the keyword with this: https://www.creationkit.com/fallout4/index.php?title=FindAllReferencesWithKeyword_-_ObjectReference

 

Now.. you'll need to think about the radius. It needs to be small, because the actors are usually right next to their ashpiles, but then it's best to assume this is not always the case, and instead use a slightly larger radius.

 

What I'm getting at is something this:

 

 


Actor Function FindAshpileOwner()
; attempts to find the nearest actor to this ashpile

Form kAshpile = Game.GetFormFromFile(0x009412E, "Fallout.ESM") ; ashpile01 form
ObjectReference ashPileRef = Game.FindClosestReferenceOfTypeFromRef(kAshPile, Game.GetPlayer(), 256.0)

if ashPileRef
    ; ashPile was found, now use it as the center point for finding the actor next to it.
    ObjectReference[] actorRefs = ashPileRef.FindAllReferencesWithKeyword(ActorTypeNPC, 512.0)
    
    int arrayLength = actorRefs.length
    int i

    ; find dead guys.
    while i < arrayLength
        if (actorRefs[i] as actor).isDead() == true
            ; find the one closest to it.
            if (actorRefs[i] as actor).getDistance(ashPileRef) < 512.0
                return actorRefs[i] as actor
            endif
        endif
        i += 1
    endwhile
    
    return none
endif
EndFunction

 

 

 

It is NOT tested(no means of turning something into an ashpile, and not too sure on the logic), so I don't advise using that particular function, just use the general idea behind it instead.

Edited by Rasikko
Link to comment
Share on other sites

  • Recently Browsing   0 members

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