Problems making a player statue

Post » Tue May 18, 2010 12:46 pm

I'm trying to allow the player to create a statue of themselves for a house mod I'm making. I'm using the scripts on Martin and on the statue base in Bruma as a base, and I've built a scripted activator. Here's the script on the activator:
scn HVHGTPlayerStatueScriptshort StatueCreatedshort DistanceChecklong TorchCountref MyStatueBegin OnActivate	if ( StatueCreated == 0 )		set StatueCreated to 1		HVHGTPlayerStatueMarker.enable		set MyStatue to player.CreateFullActorCopy		set TorchCount to ( MyStatue.GetItemCount torch02 )		MyStatue.removeItem torch02 TorchCount		MyStatue.addscriptpackage HVHGTStatuePose		MyStatue.moveto HVHGTPlayerStatueMarker		MyStatue.setalert 1		MyStatue.setghost 1		MyStatue.setunconscious 1		MyStatue.setdestroyed 1		; so you can't activate player		MyStatue.setscale 1.8		MyStatue.setav speed 0		; so you can't move it around		MyStatue.pms effectstone		MyStatue.pickidle		Message "Statue Created"	else		MyStatue.RemoveAllItems		Player.DuplicateAllItems MyStatue		set TorchCount to ( MyStatue.GetItemCount torch02 )		MyStatue.removeItem torch02 TorchCount		MyStatue.pickidle		Message "Statue Updated"	endifEndbegin gamemode; we need to pick idle whenever the player gets close (real problem is switching process levels, but this will have to fake it)	if distancecheck == 0		if getdistance player <= 2100			set distancecheck to 1			MyStatue.pickidle		endif	endif	if distancecheck == 1		if getdistance player > 2100			set distancecheck to 0		endif	endifend

Problems that have arisen:
-The shader effect never applies, the textures on my statue look exactly like me.
-My statue doesn't freeze. It animates subtly, as if it were a living npc standing still.
-The statue animation doesn't play. Instead, when I first create the statue, it draws it's sword and stands in the same pose that the player uses in the inventory screen. When I update the statue, it never draws it's sword, and instead stands still.

I've copied the AI package that's used on the Bruma statue, and I've set the statue animation to work for the new AI package (using OR). The script is basically a copy of the statue-related parts of Martin's script, and the script on the base of the Bruma statue, deleting only lines that are repeated on both objects.
User avatar
CRuzIta LUVz grlz
 
Posts: 3388
Joined: Fri Aug 24, 2007 11:44 am

Post » Mon May 17, 2010 9:32 pm

I've tried duplicating the statue creation scripts exactly, making two seperate activator scripts - one for the creator, one for the base. Nothing's changed. The scripts are identical, yet mine doesn't work. Is there a quest script running that I'm, missing, or something?

I've made a little bit of progress. This time, I didn't enter the cell before making the statue, and I added a tiny bit of code to shut off the ai. The statue showed the proper effect shader, and was completely frozen, but wasn't facing the right way, and didn't show the correct pose. Also, when I updated the statue, nothing happened whatsoever. I'll look into this, might it be related to how the cell resets and loads?

The statue not updating might be related to the fact that the statue's base script is run on an OnLoad block.

I'll try replacing the base's OnLoad block with OnActivate, so I can be sure that's my only problem. If it works desirably, I can put the script in a quest script and fire it when the player moves into the cell. I suspect there's other issues, though, such as playing the animation I want it to.
User avatar
Khamaji Taylor
 
Posts: 3437
Joined: Sun Jul 29, 2007 6:15 am

Post » Tue May 18, 2010 10:30 am

Check this thread: http://www.gamesas.com/index.php?/topic/1034459-brumas-statue-script/
User avatar
Dorian Cozens
 
Posts: 3398
Joined: Sat May 26, 2007 9:47 am

Post » Tue May 18, 2010 11:36 am

Yay, progress! I've got 2 scripts doing it all, now, a quest script that creates and updates the statue, and the script on the statue's base.

Quest script:
scn HVHGTStatueControlScriptfloat fQuestDelayTimeshort LeftCellshort Builtshort CreateUpdateshort iResetlong TorchCountref MyStatueBegin GameMode	set fQuestDelayTime to 0.5	if LeftCell == 0		if ( HVHGTStatueBaseRef.GetInSameCell Player == 0 )			set LeftCell to 1			PrintToConsole "left statue cell"		endif	endif	if CreateUpdate == 1		if Built == 0			set Built to 1			HVHGTPlayerStatueMarker.enable			set TorchCount to ( MyStatue.GetItemCount Torch02 )			MyStatue.removeItem torch02 TorchCount	; make sure the statue doesn't have a torch			MyStatue.setalert 1			MyStatue.setghost 1			MyStatue.setunconscious 1			MyStatue.setdestroyed 1		; so you can't activate player			MyStatue.setscale 2			MyStatue.setav speed 0		; so you can't move it around			MyStatue.moveto HVHGTPlayerStatueMarker			MyStatue.addscriptpackage HVHGTStatuePose			MyStatue.PlayMagicShaderVisuals effectstone			MyStatue.PickIdle			set iReset to 6			PrintToConsole "Statue Created"		else			if MyStatue == 0				set MyStatue to player.CreateFullActorCopy			else				MyStatue.RemoveAllItems				Player.DuplicateAllItems MyStatue			endif			MyStatue.moveto HVHGTPlayerStatueMarker			set TorchCount to ( MyStatue.GetItemCount torch02 )			MyStatue.removeItem torch02 TorchCount			MyStatue.setalert 1			MyStatue.setghost 1			MyStatue.setunconscious 1			MyStatue.setdestroyed 1		; so you can't activate player			MyStatue.setscale 2			MyStatue.setav speed 0		; so you can't move it around			MyStatue.addscriptpackage HVHGTStatuePose			MyStatue.PlayMagicShaderVisuals effectstone			MyStatue.PickIdle			set iReset to 6			PrintToConsole "Statue Updated"		endif		set CreateUpdate to 0	endif	if iReset		if MyStatue == 0			return		endif		;=== Reset all ===		if iReset == 5			MyStatue.setalert 1			MyStatue.setghost 1			MyStatue.setunconscious 1			MyStatue.setdestroyed 1			MyStatue.setscale 2				MyStatue.setav speed 0				MyStatue.PlayMagicShaderVisuals effectstone		elseif iReset == 3			MyStatue.PlayMagicShaderVisuals effectstone		elseif iReset == 1			MyStatue.PlayMagicShaderVisuals effectstone			MyStatue.addscriptpackage HVHGTStatuePose	; shouldn't be necessary but oh well			MyStatue.pickidle			PrintToConsole "Statue Complete"		endif		set iReset to iReset - 1	endifEnd
Base Script:
scn HVHGTStatueBaseScriptref MyStatueshort DoOnceshort iResetfloat PosXfloat PosYfloat PosZBegin GameMode	if DoOnce == 1		if HVHGTStatue.LeftCell == 1			set DoOnce to 0			set HVHGTStatue.LeftCell to 0		endif	endif	if GetInSameCell Player		if DoOnce == 0			if MyStatue == 0				set MyStatue to HVHGTStatue.MyStatue			endif			if MyStatue != 0				MyStatue.moveto HVHGTPlayerStatueMarker				MyStatue.addscriptpackage HVHGTStatuePose	; shouldn't be necessary but oh well				MyStatue.PlayMagicShaderVisuals effectstone				MyStatue.pickidle			endif			PrintToConsole "Entered statue cell"			set iReset to 8			set DoOnce to 1		endif	endif	if iReset 		if MyStatue == 0			return		endif		;=== Reset all ===		if iReset ==3			MyStatue.moveto HVHGTPlayerStatueMarker			set posX to HVHGTPlayerStatueMarker.getpos X			set posY to HVHGTPlayerStatueMarker.getpos Y			set posZ to HVHGTPlayerStatueMarker.getpos Z			MyStatue.setpos X posX			MyStatue.setpos Y posY			MyStatue.setpos Z posZ			MyStatue.setalert 1			MyStatue.setghost 1			MyStatue.setunconscious 1			MyStatue.setdestroyed 1			MyStatue.setscale 2			MyStatue.setav speed 0				MyStatue.PlayMagicShaderVisuals effectstone		elseif iReset == 2			MyStatue.PlayMagicShaderVisuals effectstone		elseif iReset == 1			MyStatue.PlayMagicShaderVisuals effectstone			MyStatue.addscriptpackage MQStatuePose	; shouldn't be necessary but oh well			MyStatue.pickidle		endif		set iReset to iReset - 1	endifEnd
There's only a couple of things to note. Firstly, the statue wears the player's current equipment, rather than choosing their best equipment (like the original statue). This is actually preferable, but I would still like to know why it happens so I can make sure it happens in the future. Second, when I update the statue, it updates flawlessly with one exception: The statue's weapon remains sheathed.
User avatar
Ladymorphine
 
Posts: 3441
Joined: Wed Nov 08, 2006 2:22 pm


Return to IV - Oblivion