Jump to content

Wabbajack


KMSvalley

Recommended Posts

Hey everyone for one of my recent mods I've been trying to create the ultimate Wabbajack staff

you can see and download the mod(s) showing my current progress from the below link

 

http://www.tesnexus.com/downloads/file.php?id=40384

 

There are currently two big issues I could really use help to resolve please;

 

(1)---The PlaceAtme function, the original game script for the Wabbajack staff makes key use of

this function. I'm aware repeated use of this function can cause save game 'bloat' and was

wondering if anyone knew of a good solution/workaround to counter this while still enabling

the wabbajack mod to work.

 

(2)---Having Multiple Wabbajack targets (which can each be wabbajacked many times, no delay)

returning to their trueform on death. I came close to achieving the above in mod v1.2 but

unfortunately they would only return back to their trueform on death if the multiple wabbajack

target had reverted back to the very first wabbajack form. In v1.3-4 I removed the ability to

wabbajack multiple targets but was able to create a solution allowing the single target

which had been wabbajacked multiple times to return to their trueform on death.

 

In terms of some ideas I was playing with for problem (1) I was considering maybe moving

all wabbajack creatures on death / timeout to the dummy cell Allswell then maybe reseting the

cell to see if that could clear the persistant memory footprint of the placeAtme function,

anyone know if that could work? or have any ideas or solutions which I may have overlooked?

 

For problem (2) I would need to somehow find a way to store the targets trueform and have this

reference be stored with each creature created from the zWabbajackList for that original target.

Perhaps using OBSE and arrays it could be possible to create a history of transforms and store/

pass the array from one creature to its replacement - then on death set the trueform to the first

reference stored, problem is I can't seem to find a way to pass this trueform ref/array on.

 

Here is the scripts for 1.4 - The single target wabbajack ( Multiple Times ). This seems to be

the most stable version created so far.

 

 

 


-----------------------------------------------------------------------

type: quest

scn zWabbajackQuestScript

short spellRunning
short doOnce
ref trueform
ref target
ref replacement

begin gamemode

if ( replacement.GetDead )
trueform.kill
trueform.enable
trueform.moveto replacement
replacement.disable
set spellRunning to 2
endif

if ( spellRunning == 2 ) ; RESET
set spellRunning to 0
set doOnce to 0
set trueform to 0
set target to 0
set replacement to 0
endif

end

-----------------------------------------------------------------------

type: quest

scn zAddWabbajackStaff

Ref Item
Short doonce

begin GameMode

if doonce == 0
set Item to zStaffofSheogorath
player.additem Item 1
set doonce to 1
endif

end

--------------------------------------------

type:object

scn zWabbajackCreatureScript

short doOnce
float timer
short done

ref trueformRef
ref targetRef
ref me

begin OnLoad
if doOnce == 0 && GetSelf != 0
	set me to GetSelf
	set zWabbaCheck.replacement to me
	set targetRef to zWabbaCheck.target
	targetRef.disable
	targetRef.PositionCell 0 0 0 0 Aleswell
	pme STRP
	playsound SPLConjurationCast
	set doOnce to 1
endif
end

begin gamemode
if done == 0
	set timer to timer + getsecondspassed
	if timer > 10

		if me.GetDead == 0
		; message "Wabbajack quest script: replacement still alive, disabling and moving target back"
			targetRef.enable
			targetRef.moveto me
			set zWabbaCheck.replacement to targetRef
			if ( targetRef == zWabbaCheck.trueform )
				set zWabbaCheck.spellRunning to 2
			endif
			me.disable
		endif
		
		set done to 1
	endif
endif
end

---------------------------------------------------------------------

type:magic effect

scn zWabbajackSpellEffect

ref self

begin ScriptEffectStart
set self to GetSelf

if ( zWabbaCheck.spellRunning ) && ( self != zWabbaCheck.replacement )
	return
endif

if ( self.IsRidingHorse == 0 ) && ( self.GetDead == 0 ) && ( self != player ) && ( IsActor || IsCreature )
	
		;message "Wabbajack start"

		set zWabbaCheck.target to GetSelf

		; only one target allowed at a time
		if ( zWabbaCheck.doOnce == 0 )
			set zWabbaCheck.spellRunning to 1
			set zWabbaCheck.trueform to GetSelf
			set zWabbaCheck.doOnce to 1
		endif

		if ( self.isRefEssential == 1 )
 				self.setRefEssential 0
		endif

		; create replacement creature
		placeAtMe zWabbajackList 1

endif
end

 

 

 

Thanks in advance to anyone who can help.

Link to comment
Share on other sites

Thanks for the article link Hickory

 

From that article it seems to suggest the following solutions to the 1st problem

 

Destroying Summoned Creatures

 

 

If you employ PlaceAtMe to create a 'summoned' creature (object) then you'll have to accept that this object cannot be destroyed. If you want it to vanish (on death or after a time-out) you can only use Disable (and Kill) to make it disappear. The dead critter object will eventually be deleted like normal dead actors after ~3 game days.

 

Normally this isn't a problem. However, if you need to totally destroy the critters (e.g. because you use a pack of them) then the correct way to do this is not use the PlaceAtMe method at all. Instead you have two options:

 

1) For a single creature (or small number of creatures) use a hidden location and teleport them to the player and back again as needed. (You may also have to manage their health, etc., if they end up in combat.)

 

2) Otherwise:

 

a) copy/create the base actor model that you wish to employ and/or a persistant reference copy in a hidden room.

 

b) set critterRef to MyCritter.CreateFullActorCopy ; takes several frames

 

c) critterRef.MoveTo player 50 50 0 ; immediate but only logical position

 

d) critterRef.DeleteFullActorCopy ; when done

 

 

Note: CreateFullActorCopy creatures do not inherit any script or AI packages attached to the the base model. You can add scripts using AddSpell <ability> or via AddItem <token> 1 commands but be aware that CFAC creatures do not appear immediately and you cannot perform these command in the same frame as you created the copy.

 

You can now use the destroyref command from refstuff to delete stuff from game

 

Alittle worrying seeing all the warning flags about the article being deprecated, needing to

be updated and might contain errors -- but will have a go at trying some of the suggested ideas

 

On further investigation of the talk pages link there is mention of an OBSE function

 

DeleteReference - attempts to delete the calling object from the game and returns true if successful. In order for a reference to be deleted, it must:

 

- be disabled

- not be an actor

- not be contained in an inventory

- be dynamic (i.e. generated via PlaceAtMe or dropped from an inventory, having a mod index of 0xFF)

 

The primary aim of this function is to combat the savegame bloat resulting from generation of large numbers of dynamic references. In most cases, it is better to avoid creating such bloat in the first place. (Note: IsRefDeleted is not related to this command in any way).

(wasRefDeleted:bool) reference.DeleteReference

 

This seems like an ideal function to use - will test with this and hopefully this will solve

the savegame 'bloat' issue. Will require users to download OBSE to use the mod but I'm sure

that this is more preferable instead of having a massive save game file :laugh:

Edited by KMSvalley
Link to comment
Share on other sites

  • Recently Browsing   0 members

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