Open CustomPhase opened 1 year ago
TESForm::CreateDuplicateForm creates a new empty form, instead of a duplicate. TESForm::Copy doesnt copy anything. We have to manually copy every field because of this, i.e.
RE::TESForm* weaponCopy = nullptr; weaponCopy = ref.GetBaseObject()->CreateDuplicateForm(true, (void*)weaponCopy); auto source = ref.GetBaseObject()->As<RE::TESObjectWEAP>(); auto target = weaponCopy->As<RE::TESObjectWEAP>(); //target->Copy(source); Does nothing. We have to copy things manually target->weaponData = source->weaponData; target->criticalData = source->criticalData; target->criticalData.damage = 0; target->criticalData.prcntMult = 0; target->fullName = std::string("FUCKED ").append(source->fullName); target->textureName = source->textureName; target->boundData = source->boundData; target->model = source->model; target->attackSound = source->attackSound; target->equipSlot = source->equipSlot; target->equipSound = source->equipSound; target->unequipSound = source->unequipSound; target->firstPersonModelObject = source->firstPersonModelObject; target->data = source->data; target->fileOffset = source->fileOffset; target->formFlags = source->formFlags; target->impactDataSet = source->impactDataSet; target->icon = source->icon; target->keywords = source->keywords; target->attackFailSound = source->attackFailSound; target->pickupSound = source->pickupSound; target->textures = source->textures; target->addons = source->addons; target->numAddons = source->numAddons;
TESForm::CreateDuplicateForm creates a new empty form, instead of a duplicate. TESForm::Copy doesnt copy anything. We have to manually copy every field because of this, i.e.