Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Key animations all screwed. Why?
Key animations all screwed. Why?
2004-01-04, 4:17 AM #1
Hi!
This is just something that has been bugging me for quite sometime now.

I have made a keyframe, that makes the 09_octdoor turn a full 360° and then move down when I open it, and then go back up and turn another 360° when I close it. Problem is that when I open fine, when I close it won't come up! Why I post this here is because I suspect there is something wrong in the code.

Code:
# Door with Keyframe opening.
#
# By Edward
symbols

message		activated
message		startup

thing		door

surface		switch1
surface		switch2

surface		walls1
surface		walls2

keyframe	opened
keyframe	close
sound		opening
sound		closing
sound		closed

int		keys=-1		local
int		open=0		local

end
#
code
startup:
	ClearAdjoinFlags(walls1,0x2);
	ClearAdjoinFlags(walls2,0x2);
return;
activated:
	If(GetSenderRef()==switch1)
	{
		if(open==0)
		{
			open=2;
			StopKey(door,keys,0.1);
			keys=PlayKey(door,opened,1,0x4);
			PlaySoundThing(opening,door,1,-1,10,0xC0);
			SetWallCel(switch1,1);
			SetWallCel(switch2,1);
			sleep(GetKeyLen(opened));
			SetAdjoinFlags(walls1,0x2);
			SetAdjoinFlags(walls2,0x2);
			open=1;
		}
		else if(open==1)
		{
			open=2;
			StopKey(door,keys,0.1);
			ClearAdjoinFlags(walls1,0x2);
			ClearAdjoinFlags(walls2,0x2);
			keys=PlayKey(door,close,1,0x4);
			PlaySoundThing(closing,door,1,-1,10,0xC0);
			SetWallCel(switch1,0);
			SetWallCel(switch2,0);
			sleep(GetKeyLen(close));
			open=0;
		}
	}
	Else If(GetSenderRef()==switch2)
	{
		if(open==0)
		{
			open=2;
			StopKey(door,keys,0.1);
			keys=PlayKey(door,opened,1,0x4);
			PlaySoundThing(opening,door,1,-1,10,0xC0);
			SetWallCel(switch1,1);
			SetWallCel(switch2,1);
			sleep(GetKeyLen(opened));
			SetAdjoinFlags(walls1,0x2);
			SetAdjoinFlags(walls2,0x2);
			open=1;
		}
		else if(open==1)
		{
			open=2;
			StopKey(door,keys,0.1);
			ClearAdjoinFlags(walls1,0x2);
			ClearAdjoinFlags(walls2,0x2);
			keys=PlayKey(door,close,1,0x4);
			PlaySoundThing(closing,door,1,-1,10,0xC0);
			SetWallCel(switch1,0);
			SetWallCel(switch2,0);
			sleep(GetKeyLen(close));
			open=0;
		}
	}
	else if(GetSenderRef()==door)
	{
		PlaySoundThing(closed,door,1,1,10,0xC0);
	}
return;
end

The tempalte of the matter:
Code:
octadoor          _decor             size=.19204 movesize=.19204 model3d=09doct1.3do puppet=ra.pup collide=0

And keys: (open)
Code:
# KEYFRAME OctaClose.key created by Puppet Jedi 0.6

###############
SECTION: HEADER

FLAGS  0x0000
TYPE   0xFFFF
FRAMES 97
FPS    16
JOINTS 1


###############
SECTION: KEYFRAME NODES

NODES 1

NODE 0
MESH NAME OBJECT01
ENTRIES 5

# num:   frame:   flags:           x:           y:           z:           p:           y:           r:
#                                 dx:          dy:          dz:          dp:          dy:          dr:
   0:        0   0x0003   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000
                          0.00000000  -0.00006250   0.00000000   0.00000000   0.00000000  11.25000000
   1:       16   0x0003   0.00000000  -0.00100000   0.00000000   0.00000000   0.00000000 180.00000000
                          0.00000000   0.00006250   0.00000000   0.00000000   0.00000000  11.25000000
   2:       32   0x0000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000
                          0.00000000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000
   3:       48   0x0001   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000
                          0.00000000   0.00000000  -0.00822917   0.00000000   0.00000000   0.00000000
   4:       96   0x0001   0.00000000   0.00000000  -0.39500000   0.00000000   0.00000000   0.00000000
                          0.00000000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000

(close)
Code:
# KEYFRAME Untitled.key created by Puppet Jedi 0.6

###############
SECTION: HEADER

FLAGS  0x0000
TYPE   0xFFFF
FRAMES 49
FPS    16
JOINTS 1


###############
SECTION: KEYFRAME NODES

NODES 1

NODE 0
MESH NAME OBJECT01
ENTRIES 8

# num:   frame:   flags:           x:           y:           z:           p:           y:           r:
#                                 dx:          dy:          dz:          dp:          dy:          dr:
   0:        0   0x0001   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000
                          0.00000000   0.00000000  -0.39600000   0.00000000   0.00000000   0.00000000
   1:        1   0x0001   0.00000000   0.00000000  -0.39600000   0.00000000   0.00000000   0.00000000
                          0.00000000   0.00000000   0.02640000   0.00000000   0.00000000   0.00000000
   2:       16   0x0003   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000
                          0.00000000  -0.00012500   0.00000000   0.00000000   0.00000000  11.25000000
   3:       24   0x0003   0.00000000  -0.00100000   0.00000000   0.00000000   0.00000000  90.00000000
                          0.00000000   0.00012500   0.00000000   0.00000000   0.00000000  11.25000000
   4:       32   0x0003   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000 180.00000000
                          0.00000000   0.00012500   0.00000000   0.00000000   0.00000000  11.25000000
   5:       40   0x0003   0.00000000   0.00100000   0.00000000   0.00000000   0.00000000 270.00000000
                          0.00000000  -0.00012500   0.00000000   0.00000000   0.00000000  11.25000000
   6:       48   0x0000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000
                          0.00000000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000
   7:       56   0x0000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000
                          0.00000000   0.00000000   0.00000000   0.00000000   0.00000000   0.00000000

Please help!

/Edward
Edward's Cognative Hazards
2004-01-04, 8:04 AM #2
Are you sure it didnt move when you tried to close it? There are a hundred ways to screw up keys in JK, odds are its the keys...

------------------
The future is here, and all bets are off.
And when the moment is right, I'm gonna fly a kite.
2004-01-04, 8:11 AM #3
he, i never fixed this last time, luck i got more knolage now [http://forums.massassi.net/html/biggrin.gif]
to put it simply, play a key and stopit, play more key you may not... (learnet that on AJTD :P)

so how did i fix it on AJTD? well to put it simply, i dident.

so insted i did something very very strange...
i used frames to move it up and down, and keys to move it... i think you might be able to do the same,

if nto consider this, the outdoors pivot point is at its center. so rotateign the door about its own pivoit will rotate it perfectly... something like ...

Code:
movetoframe(wheel,1,5);
Rotate(thing, vector); 
movetoframe(wheel,0,5);


the vector is a normal vector (0/0/0) and is pitch yaw and roll, if i rember you wher erotateign them forwards (1/0/0)

------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one, "never trust a bartender with bad grammar"-kyle katarn in JO

Rule Two, "Gravity is a crule misstress" -kyle katarn in MotS, and the alternatior MK I in AJTD
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-04, 8:41 AM #4
OK... That should work nicely... Thanks!

But yet, I still need help. It has happened to a stormtrooper as well.
Code:
stormdisplay      _walkstruct             size=.130144 movesize=.130144 model3d=s4.3do puppet=s2.pup

I made him a decor simply because I... Put him an the wall... Wierd, I know. But it's for a sliding effect where you slide the camera from a level view, to an above view. The COG that plays the keys was going for a random idle key at the end of each keyframe.
Code:
# Random Keys
#
# By Edward
symbols

message		startup
message		pulse

thing		ac

keyframe	key0
keyframe	key1
keyframe	key2

int		k=-1		local
int		i		local

end
#
code
startup:
	i=rand()*2;
	k=PlayKey(ac,key0,1,0x0);
	SetPulse(GetKeyLen(key0));
return;
pulse:
	StopKey(ac,k,.1);
	sleep(0.1);
	i=rand()*2;
	k=PlayKey(ac,key0,1,0x0);
	SetPulse(GetKeyLen(key0));
return;
end

I looked at his progress and at each keyframe, he slipped through the floor/wall. And yet, his partner Officer didn't...
Code:
iodisplay         _walkstruct        size=.12365 movesize=.12365 model3d=io.3do puppet=io.pup

And I'm making a door that needs keyframes because it looks better that way! it screws up almost the same way. When I open, it works. When it closes, it jumps up .1 JKUs. I open for the second time, it jumps up another .1 JKUs.

The door is composed of 2 locking bolts, and 3 pieces. An almost replica of this door. You can see 6 bolts on the side and 3 pieces of the door moving away.

Please help! Thanks.

[edit] I tried out this Rotate() and it doesn't seem to make things rotate the other way... It doesn't seem to support negative numbers in its Vec. Anyway I can make the things rotate at (0/-180/0)?

/Edward


[This message has been edited by Edward (edited January 04, 2004).]
Edward's Cognative Hazards
2004-01-05, 5:22 AM #5
i am not entirely shure what your trying to do.. but it seems you want a _walkstrut actor to move trough a wall? like some kind of ghost or spirit.

prehaps you could use frames insted of keys?


------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-06, 5:21 AM #6
I want the Stormtroopr to stay put like the Officer!
Edward's Cognative Hazards
2004-01-09, 2:20 AM #7
helo?
Edward's Cognative Hazards
2004-01-09, 8:30 AM #8
well, i dont entirely understand so i cant do anything.

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-09, 9:19 AM #9
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Edward:
...I looked at his progress and at each keyframe, he slipped through the floor/wall. And yet, his partner Officer didn't...</font>


Does the Officer have an AI?


..And as for the door, its all a matter of how you have the key set up. hte eaisest way to do it would be to make hte who action; open, wait, and close; all in the same key. That prevents any problems of keys interacting with each other.

------------------
The future is here, and all bets are off.
And when the moment is right, I'm gonna fly a kite.
2004-01-09, 12:28 PM #10
GBK, "Does the Officer have an AI?" Read the template for iodisplay... What do you think?
"action; open, wait, and close; all in the same key." One problem with this is, how do I do so that when I press the button, it opens and waits until the button has been pressed again, in one KEYframe?

PJB, How about you take my "Door with Keyframe Opening" COG, my template, and my 2 KEYframes in my first post and try it out and see what happens. If you say that the door opens and closes normally, then... IT'S MY COMPUTER THAT IS SCREWING WITH MY KEYS!!!

/Edward


[This message has been edited by Edward (edited January 09, 2004).]
Edward's Cognative Hazards
2004-01-09, 6:31 PM #11
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Edward:
...how do I do so that when I press the button, it opens and waits until the button has been pressed again, in one KEYframe?...</font>


Ahh, thats trickey. So trickey, Ive never figured it out. My hat is off to any that has, too, because its a real pain in the ***.

------------------
The future is here, and all bets are off.
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!