Copy of an object instead of a reference. Possible?

Post » Sat Nov 17, 2012 10:41 am

Hey all! I want to keep an actor's data stored for future use. Is there a way of creating a copy of the actor instead of just a reference, so I don't have to create a bunch of variables to store all the data?

Thanks!
User avatar
Cameron Garrod
 
Posts: 3427
Joined: Sat Jun 30, 2007 7:46 am

Post » Sat Nov 17, 2012 1:54 am

Right click on the object in the object window, then click on "duplicate". It makes a copy of the original object underneath with "COPY001" added to the name

- Hypno
User avatar
SWagg KId
 
Posts: 3488
Joined: Sat Nov 17, 2007 8:26 am

Post » Sat Nov 17, 2012 5:10 am

Right click on the object in the object window, then click on "duplicate". It makes a copy of the original object underneath with "COPY001" added to the name

- Hypno

Sorry, should have been more explicit. I want a copy of an actor at run-time, to be processed in a papyrus script, instead of a pointer to an actor.

In general OOP, this would be a deep-copy of an object.
User avatar
Cccurly
 
Posts: 3381
Joined: Mon Apr 09, 2007 8:18 pm

Post » Sat Nov 17, 2012 12:53 am

Check out:
QF_MG04MonkSceneQuest_00076F39.psc

However, I think the clone done by the (commented out) code in the file above is not a deep copy. So I guess the answer is no... You can clone an NPC or the PC, but you will have to do it the hard way: PlaceAtMe(ActorFormID), Transfer the items to a intermediary container which has events on it to add incoming items to both the original actor and the clone actor. And then hard code a bunch a standard variable checks to ensure the two clones have the same stats... and then synch up the factions. Probably create/inject a huge FormList of all factions and perform an IsInFaction check against all items in the list to ensure the factions are the same. A lot of work... probably wouldn't do it myself.
User avatar
Nitol Ahmed
 
Posts: 3321
Joined: Thu May 03, 2007 7:35 am

Post » Sat Nov 17, 2012 7:44 am

Check out:
QF_MG04MonkSceneQuest_00076F39.psc

However, I think the clone done by the (commented out) code in the file above is not a deep copy. So I guess the answer is no... You can clone an NPC or the PC, but you will have to do it the hard way: PlaceAtMe(ActorFormID), Transfer the items to a intermediary container which has events on it to add incoming items to both the original actor and the clone actor. And then hard code a bunch a standard variable checks to ensure the two clones have the same stats... and then synch up the factions. Probably create/inject a huge FormList of all factions and perform an IsInFaction check against all items in the list to ensure the factions are the same. A lot of work... probably wouldn't do it myself.

Yea it would seem so. What a bummer :/.
User avatar
Dalton Greynolds
 
Posts: 3476
Joined: Thu Oct 18, 2007 5:12 pm


Return to V - Skyrim