People may remember the Subjugation mod, it's still here on the Nexus. I've decided to revisit it and update things, make it cleaner, squish a few bugs, etc. Anyway, I'll share a code snippet first. It's a UDF that gets called when the player first subjugates a victim. My plan is to, instead of controlling the original target with my scripts & so on, create a copy. I figured, get the base form, and then use PlaceAtMe to create a copy, then destroy it when the subjugate gets released.
scn SubSubjugateVictim
; reciprocal: SubReleaseVictim
ref theVictim
ref theBaseForm
ref theSubjugate
short listCount
array_var fact_list
Begin function {theVictim}
printtoconsole "[SubC - SubSubjugateVictim] Received victim: %n %i" theVictim theVictim
theVictim.RemoveItem SubjugateInitToken 1
; check to see if he's in the forbidden list (companions)
; if so, scold the player and abort
if eval (theVictim.IsInList SubjugateForbiddenList)
MessageEx "%n is a companion and cannot be subjugated." theVictim
return
endif
; get the base form
let theBaseForm := theVictim.GetBaseForm
if eval (theBaseForm == 0)
printtoconsole "[SubC] theBaseForm is empty."
return
endif
; add the victim to the form list
AddFormToFormList SubjugateVictimList theVictim
; error checking
let listCount := ListGetCount SubjugateVictimList
printtoconsole "[SubC] SubjugateVictimList contains %.0f" listCount
printc "[SubC]REF: %n (%i)%r[SubC]GBF: %n (%i)" theVictim theVictim theBaseForm theBaseForm
; create the subjugate
; NOTE: GetSelf will not work on the created form
let theSubjugate := theVictim.PlaceAtMe theBaseForm 1
.
.
.
PlaceAtMe results in a crash--I won't bother posting the remaining code (but will if people want). Can anyone shed light on why? Am I missing something important here? I should be clear, I'm aware of GetBaseObject, but GetBaseObject doesn't work well on levelled actors (as far as I understand from reading the GECK documentation).