slevin92 Posted August 9, 2020 Share Posted August 9, 2020 (edited) Hello everyone, First thing, I started to learn C++ a month ago only to update one of my mod (https://www.nexusmods.com/fallout4/mods/37794). What I want to do is replacing a function that papyrus run very to slowly for me by a custom one directly in a dll plugin. Basically, the arRef should move to the arTarget's arNodeName bone. Everything is filled in a papyrus script.This is what i've wrote so far : namespace WorkingVisibleWeapon_Functions { void WVWAttachToRefNode(StaticFunctionTag* base, TESObjectREFR* arRef, TESObjectREFR* arTarget, BSFixedString arNodeName) { if (arRef) { NiNode* NodeRef1 = arRef->GetObjectRootNode(); NiAVObject* Ref1 = NodeRef1; NiNode* NodeRef2 = arTarget->GetObjectRootNode(); NiAVObject* Ref2 = NodeRef2->GetObjectByName(&arNodeName); NiNode* ExtraRef2 = Ref2->GetAsNiNode(); float heading; float attitude; float bank; float x = Ref2->m_worldTransform.pos.x; float y = Ref2->m_worldTransform.pos.y; float z = Ref2->m_worldTransform.pos.z; Ref2->m_worldTransform.rot.GetEulerAngles(&heading, &attitude, &bank); Ref1->m_worldTransform.pos.x = x; Ref1->m_worldTransform.pos.y = y; Ref1->m_worldTransform.pos.z = z; Ref1->m_worldTransform.rot.SetEulerAngles(heading, attitude, bank); } } } I can call the function in papyrus but the game crashes when it reach this line : Ref1->m_worldTransform.pos.x = x;I really don't know how to make the Ref1 (arRef) move to the coordinate of the Ref2(arTarget). Thanks Edited August 9, 2020 by slevin92 Link to comment Share on other sites More sharing options...
Recommended Posts