Move your body?

Post » Sun May 01, 2011 10:39 pm

I once read a book that was very entertaining called "the chronicles of Amber". The essence of the book is not important, but there was a place in that book where physics operated more or less normally, except that once a creature or individual was killed, the body drifted upward into the sky.

I want to duplicate that effect ingame if I can, but I seem to be running into a problem I can't resolve.Everything appears to be working, but the body doesn't move.

using SV ingame, I can see that bodyposZ is increasing as intended, the timer runs fine until the point where controlvar is set to 2 and the body disappears, and then everything stops as intended.

So... I was wondering if my script is faulty or if there is something else at work here. Does the ID change when a body is placed? Does the body change from a creature to a container or something?

Any answers will be appreciated. Here's the last script I tried (there have been many changes along the way):

Begin BodyDriftScriptshort controlvarshort doOncefloat bodyposZfloat bodyTimerIf ( MenuMode == 1 )		ReturnendIfIf ( GetHealth <= 0 )	If ( doOnce == 0 )			set bodyTimer to ( bodyTimer + GetSecondsPassed )		If ( bodyTimer >= 10 )			If ( controlvar < 2 )				set bodyPosZ to ( GetPos, Z + 3 )				 set controlvar to 1			endIf		endIf			If ( controlvar == 1 )				setPos, Z, bodyposZ			If bodyTimer >= 30				set controlvar to 2				set doOnce to 1			endIf		endIf	endIfendIf	If ( controlvar == 2 )			set bodyTimer to 0		set controlvar to 0		disableendIf				end BodyDriftScript

User avatar
Javier Borjas
 
Posts: 3392
Joined: Tue Nov 13, 2007 6:34 pm

Post » Sun May 01, 2011 3:41 pm

Tried to use 'Move Z' or 'MoveWorld Z' instead of 'setPos Z'?
User avatar
Tracy Byworth
 
Posts: 3403
Joined: Sun Jul 02, 2006 10:09 pm

Post » Sun May 01, 2011 2:25 pm

Tried to use 'Move Z' or 'MoveWorld Z' instead of 'setPos Z'?


No, but I'll give it a try now that you mention it... :)
User avatar
Alisia Lisha
 
Posts: 3480
Joined: Tue Dec 05, 2006 8:52 pm

Post » Sun May 01, 2011 6:19 pm

Those commands won't work for actors (NPCs and the player). One thing I can suggest is getting rid of the commas in the line: setPos, Z, bodyposZ. Another thing that *might* work is changing this line:

set bodyPosZ to ( GetPos, Z + 3 )


to something like this:

set bodyposZ to (GetPos z)set bodyposZ to bodyposZ + 3


Also, make sure you're keeping the capitalization between variables; if you've defined it as bodyposz, use bodyposz and not bodyPosZ. That may not be what's causing the issue, but MW's scripting system is known to be finicky about little things like that.
User avatar
Solène We
 
Posts: 3470
Joined: Tue Mar 27, 2007 7:04 am

Post » Sun May 01, 2011 6:32 pm

Those commands won't work for actors (NPCs and the player). One thing I can suggest is getting rid of the commas in the line: setPos, Z, bodyposZ. Another thing that *might* work is changing this line:

set bodyPosZ to ( GetPos, Z + 3 )


to something like this:

set bodyposZ to (GetPos z)set bodyposZ to bodyposZ + 3


Also, make sure you're keeping the capitalization between variables; if you've defined it as bodyposz, use bodyposz and not bodyPosZ. That may not be what's causing the issue, but MW's scripting system is known to be finicky about little things like that.


I didn't see your post... somehow I got signed out while I was responding. Anyway, thanks for the tips, I'll give them a try. Y ou may have solved the problem in a different direction though...
User avatar
Siobhan Thompson
 
Posts: 3443
Joined: Sun Nov 12, 2006 10:40 am

Post » Sun May 01, 2011 2:34 pm

Just a thought:

Why not use a collision box (EditorMarker_Box_01 mesh assigned to your new activator) placed at the actor upon death, and use this as an elevator of sorts.

I like your concept with this. I've used effects placed at an actors death for an explosive death scene, and the set to getPos works good to this point.

Curious.
User avatar
Eve(G)
 
Posts: 3546
Joined: Tue Oct 23, 2007 11:45 am

Post » Sun May 01, 2011 2:12 pm

SetPos and GetPos do work on NPCs, I think Jac fixed your issue by making it GetPos then +3 every loop. Your method looks like it might've just set them up 3 from their starting position.

@Miles_Acraeus: Dead NPCs don't have collision, so it won't really work.
User avatar
Kelly Tomlinson
 
Posts: 3503
Joined: Sat Jul 08, 2006 11:57 pm

Post » Sun May 01, 2011 4:56 pm

Hmmm... this has become an interesting problem, for something I thought would be relatively easy before I tried it.

I changed the script to Jac's suggestion, and again everything worked, but the body did not rise. It occurred to me that perhaps there was an issue because I was using a variable, so I set setPos to a specific height... and again the body didn't move, but using sv, bodyPosZ indicated the body position was actually at the arbitrary height I set.

Anyway, here's the script:
Begin BodyDriftScriptshort controlvarshort doOncefloat bodyPosZfloat bodyTimerIf ( MenuMode == 1 )		ReturnendIfIf ( GetHealth <= 0 )	If ( doOnce == 0 )			set bodyTimer to ( bodyTimer + GetSecondsPassed )		If ( bodyTimer >= 10 )			If ( controlvar < 2 )				set bodyPosZ to ( GetPos Z  )				set bodyPosZ to bodyPosZ + 3				set controlvar to 1			endIf		endIf			If ( controlvar == 1 )				setPos Z, 13500				;Move Z, 30			If ( bodyTimer >= 40 )				set controlvar to 2				set doOnce to 1			endIf		endIf	endIfendIf	If ( controlvar == 2 )			set bodyTimer to 0		set controlvar to 0		disableendIf				end BodyDriftScript
\

EDIT:
I attached this script with 2 minor changes ( variable instead of arbitrary height and no gethealth condition) to an activator, the blue wolf statue... and it worked perfectly.

I have to presume that raising the dead really is a big deal, eh?

I was thinking that perhaps in the case of a creature rather than an NPC, perhaps I could disable the body at death, and make an activator that uses the creature's mesh with this script attached and use placeatme...
User avatar
Dalley hussain
 
Posts: 3480
Joined: Sun Jun 18, 2006 2:45 am


Return to III - Morrowind