Jump to content

Is there a way to attach the object reference to the actor?


Recommended Posts

Using SetVehicle(), the actor attaches to the object reference. Conversely, is there anyway the object reference attaches to the actor?

My current goal is to attach actor B to actor A. It is important to keep up with fast-moving or flying actor A.

The only possibility shown is using SetVehicle(), where actor B can be attached to the object reference, but there is no way to attach the object reference to the target actor A.

I tried to use art objects or visual effects that automatically follow the actors, but I couldn't find a way to designate them as object references.

I'm completely stuck right now. Is there any way?

Edited by STGAMPLE
Link to comment
Share on other sites

If the object reference is an actor, it can use SetVehicle to attach itself to an actor or object reference.

If the object reference is not an actor, it cannot use SetVehicle to attach itself to an actor or object reference.

The reason for this is that SetVehicle is defined on the Actor script. This means that only those object references that are also actors can utilize this function.

I, personally, know of no way to attach a non-actor object reference to an actor or other object reference and have both move at the same time.

 

 

Link to comment
Share on other sites

Dude you are overthinking it and have lost all common sense through frustration, step one chill and relax, then do this, and filled them correctly too. You will need a clean save OK.

Actor Property TheNPC auto

ObjectReference Property PlayerRef auto

TheNPC.SetVehicle(PlayerREF)

sorry but I do not think you get the result you want, it more of havok thing.... so the objects do not repel each other and can occupy the same space, and then receive the other havok, while attached, but give it a go

Remember that clean save, it will not work on existing save referencing the object the script is attached too

Link to comment
Share on other sites

Actor is ObjectReference, plus some stuff, but they still work in any circumstance that expects an ObjectReference.

Therefore...

You can use SetVehicle, or KeepOffsetFromActor, for your Actor-on-Actor case.

Link to comment
Share on other sites

@xkkmEl yeah that and a follow package so may be ¯\_(ツ)_/¯ they are not drag along while trying to walk  the other way.. hehehehehe

EDIT

@STGAMPLE if all fails, try a monitor the distance the NPC is from the Player, and teleport them if they get too far behind, sometimes it is about compromise, they alway be by the player side when needed.

 

 

Edited by PeterMartyr
Link to comment
Share on other sites

Doable but will most likely not be very intuitive for you to use how you envision

Actor needs to have ragdoll mode added unless they are already dead before HavokBall calls will work. The nodes on the object and actor, both require the right collision type in the nif

; Forcibly adds / removes the ragdoll for a reference to the world
Function ForceAddRagdollToWorld() Native
Function ForceRemoveRagdollFromWorld() Native

; Adds a ball-and-socket constraint between two rigid bodies,identified by their ref and node names
Bool Function AddHavokBallAndSocketConstraInt(ObjectReference arRefA,String arRefANode,ObjectReference arRefB,String arRefBNode,Float afRefALocalOffsetX = 0.0,Float afRefALocalOffsetY = 0.0,Float afRefALocalOffsetZ = 0.0,Float afRefBLocalOffsetX = 0.0,Float afRefBLocalOffsetY = 0.0,Float afRefBLocalOffsetZ = 0.0) Native Global

; Removes any constraint between two rigid bodies
Bool Function RemoveHavokConstraInts(ObjectReference arFirstRef,String arFirstRefNodeName,ObjectReference arSecondRef,String arSecondRefNodeName) Native Global

Here is the Hangedmanscript in the game as an example of usage to connect a dead actor to a rope. Works on a live actor too but you need to add ragdoll first

ScriptName hangedManScript Extends ObjectReference  
{Script for noose ropes.  PoInt to an attach dummy and a corpse}

ObjectReference Property nooseDummy Auto
{PoInt to a rigidBodyDummy placed at the end of the rope.}
ObjectReference Property corpse Auto
{the hung person}
explosion Property fakeForceBallNudge Auto

Bool shotDown


EVENT onLoad()
    ; this gets the guy actually hanging when the 3D is loaded up.
    if shotDown == False
        ;Game.addHavokBallAndSocketConstraint(corpse,"NPC Neck [Neck]",nooseDummy,"AttachDummy",0,0,16)
        Game.addHavokBallAndSocketConstraint(corpse,"NPC Neck [Neck]",self,"JoIntHelper01",0,0,16)
    endif
EndEvent


EVENT onHit(ObjectReference akAggressor,Form akSource,Projectile akProjectile,Bool abPowerAttack,Bool abSneakAttack,Bool abBashAttack,Bool abHitBlocked)
;         debug.trace("Noose Rope Hit by: "+akAggressor)
;         debug.trace("Noose Rope Hit by: "+akProjectile)
;         debug.trace("Noose Rope Hit by: "+akSource)
        Game.removeHavokConstraints(corpse,"NPC Neck [Neck]",self,"JoIntHelper01")
        nooseDummy.PlaceAtMe(fakeForceBallNudge)
        shotDown == True
EndEvent

Good luck. You are in for a project if you want this

Link to comment
Share on other sites

Thank you, everyone. I tried connecting the actor and the actor directly to the set vehicle, but I was at a loss because there was no response. I'll try again on the conditions you guys told me about.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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