Jump to content

Need piece of advice on cloning from experimented modders


Recommended Posts

Posted

I don't know if here is the good place to post that, if it is not say me where :)

 

In SexoutSlavers 2 I decided to clone NPC I want enslave. I put the original in 0,0,0 and the clone is the slave so I can do what I want with him and if the original is necessary for a quest the player can kill the clone to make the original come back.

 

But I'm afraid of bloating the saves and the game.

 

My idea is that some NPC don't need the original to be stored (for example a goodspring farmer) but I would be sure that I can destroy a NPC without side effects, so I need your ideas on which criteria I can do my test to know if I can destroy a NPC.

 

For now I think that a NPC that is flagged has 'respawn' can be destroyed and that a scripted NPC can be destroyed. Your opinion ?

Posted

First of all, what do you call "destroyed" ?

 

You should not delete a permanent ref as such ref can be referenced from script or conditions, and the usual response from referencing a deleted ref is a CTD.

 

More importantly, it looks like the engine treats ref added from an esp as being permanent, i.e. they can be referenced (from their own NPC) so they should not be deleted as well. Though, normally such references should be cleaned during load if they no longer are defined which allows for mod removal.

 

Of course those limitation do not apply to created ref (PlaceAtMe or dropped item) which would only exists as part of the current game session (as opposed to the current save). [i haven't isolated yet why some of those end up being saved]

 

In the end, not deleting ref should not make a significant impact on save, just move the unneeded reference to some permanently loaded cell somewhere.

 

As for deleting non ref, first its a definitive no no, and second I don't think its possible.

 

Lastly, I would not TempCloneForm a ref, PlaceAtMe is the proper way to create ref due to the various hidden form members that have to be filled. If you are acting on leveled forms, running placeatme on the instance base form (getBaseForm) rather than the leveled baseForm (getBaseObject) should give you the same NPC.

Posted
 



First of all, what do you call "destroyed" ?

 

You should not delete a permanent ref as such ref can be referenced from script or conditions, and the usual response from referencing a deleted ref is a CTD.

 

More importantly, it looks like the engine treats ref added from an esp as being permanent, i.e. they can be referenced (from their own NPC) so they should not be deleted as well. Though, normally such references should be cleaned during load if they no longer are defined which allows for mod removal.

 

Of course those limitation do not apply to created ref (PlaceAtMe or dropped item) which would only exists as part of the current game session (as opposed to the current save). [i haven't isolated yet why some of those end up being saved]

 

In the end, not deleting ref should not make a significant impact on save, just move the unneeded reference to some permanently loaded cell somewhere.

 

As for deleting non ref, first its a definitive no no, and second I don't think its possible.

 

I was thinking to 'disable' + 'markfordelete' but after reading that I'll do nothing more than I did for now, disabling and moving at pos 0,0,0. It's seems too dangerous to remove them.

 

 

Lastly, I would not TempCloneForm a ref, PlaceAtMe is the proper way to create ref due to the various hidden form members that have to be filled. If you are acting on leveled forms, running placeatme on the instance base form (getBaseForm) rather than the leveled baseForm (getBaseObject) should give you the same NPC.

 

After some testing I had some problems with tmpCloneForm so I did a placeAtMe of the gbo. After that I'll replace with getBaseForm.

 

I have difficulty to remember all the functions of NVSE, mainly since v4, it must be age :P

 

Thanks.

Posted

You are far from alone :) That's why I try to mention the relevant ones when possible. Its that or writing a complete documention, which twenty five years of experience tell me I won't do.

 

Posted

Finally you seems to say that only aged people try to do mods :)

 

On an other subject, I think we lack a real thread support in this forum for NVSE 4 and NVSE Extender (or I didn't found them) cause posting on http://forums.bethsoft.com/ about sex mods may cause us some problems :D

 

For example I've a systematic CTD on removeScript in this case :

 

I make a clone of Trudy and work on the clone. If scripted, I get the ref of the script and remove it and boom ! Do I miss some syntax or is ther a problem ?

 

 

 

			set rNewTarget to player.placeAtme rTmp 1 64 1
			if isFormValid rNewtarget == 0
				debugPrint "Failed to create a clone"
				set bToRemove to 1
			endif
			if bToRemove==0
.
.
.
				debugPrint "Removing script"
				if rNewTarget.IsScripted
					set rTmp to rNewTarget.getScript
					rNewTarget.removeScript rTmp
				endif
				debugPrint "Removing factions"
.
.
.

 

 

 

The last log I have before CTD is "Removing script".

Posted

I'll check, but there nothing here you can't put on the official forum topic :)

I would put the debugPrint "Removing script" after the if though :)

 

Posted

Let's go the checking I think I missed two things :

 - I misunderstood the double method of calling some fonctions

 - I missed the doc of removeScript (it's name may be getRemovedScriptFrom )

 

But I thinks too that there are bugs in some functions or I confuse the two method of calling (I'm very bad in english language so ...)

 

As I did undestand :

 

ref.function       -> works on the base for of 'ref'

function ref       -> works on the 'ref' itself

 

Am I right ?

 

Posted

You have to check the calling convention of the function you want.

In the case of RemoveScript it is: Calling by Either Reference or Base Form so the parameter would be a base form.

 

But other functions, the ones that manipulate reference members, apply to reference. Lastly, as references and baseform both derives from TESForm, they share some members like the flags or the refID.

 

Once the function gets the parameter, it will decide wether it should convert it to a base form.

 

If you cannot find your NVSE function here : http://fose.silverlock.org/fose_command_doc.html check http://gribbleshnibit8.beastnode.net/projects/NVSEDocs/NVSECommandDocs.htm#TypeOf it is newer.

Posted

Ok, parameter concern baseform and caller concern reference

 

so for the example of removescript you say :

 

ref.removescript -> remove the script on the ref 

removescript ref -> remove the script on the base form of the ref

 

So I did the contrary so I had some problems :P

 

I'll do more tests later, for now I must advance the mod, I'll come back on this later, thanks.

 
Posted

First ref do not have a script, scripts are attached to baseForm :)

 

so ref.RemoveScript is converted to RemoveScript ref->BaseForm

 

and Calling by Either Reference or Base Form means the  parameter is expected to be a base form, not a reference.

 

The fact that you have to set a ref var to a base object to use it in scripts does'nt help explaining.

 

EDIT: sorry, I should have double checked the source before answering :)

 

Example:

  RemoveScript GSSunnySmiles remove the script from the NPC_ GSSunnySmiles

  SunnyRef.RemoveScript removes the script from the baseForm of SunnyRef which is the NPC GSSunnySmiles

 

now:

  RemoveScript SunnyRef also works, because this function verify if the parameter is a reference and in that case replace it with its base form.

 

Posted

Yes, I did remark a lot of things are not duplicated on the cloned forms and are only on baseform.

 

It seems it's the same for packages and some other things so I'll have a lot of work cause if I want to the NPC come back in it's original state when clone dead I'll must stock and retablish more things I did think. I'll come back on that later.

Posted

So there is a bug with RemoveScript when you call it on a non scripted object.

As for what you try to do, here is a sample that should not CTD:

scn npDebugRemoveScriptQuestScript

int iVersion
ref rTmp
ref rNewTarget
int bToRemove

begin gameMode
	if iVersion < 1
		set iVersion to 1
		SetDebugMode 1
		con_scof "npDebugRemoveScript.txt"
		debugPrint "Cloning"
		set rTmp to GSSunnySmiles
		set rNewTarget to player.placeAtme rTmp 1 64 1
		if isFormValid rNewtarget == 0
			debugPrint "Failed to create a clone"
			set bToRemove to 1
		endif
	elseif iVersion < 2
		set bToRemove to 1
	endif

	if bToRemove
		debugPrint "Removing"
		if rNewTarget.IsScripted
			debugPrint "Removing script"
			rNewTarget.removeScript
		endif
		debugPrint "Deleting"
		rNewTarget.MarkForDelete
		rNewTarget.Disable		
	endif
end

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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