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.

ForumsJedi Knight and Mysteries of the Sith Editing Forum → cog help
cog help
2009-09-28, 11:35 PM #1
I want 3d0 to play an animation when activated. I think I'm clear on how PlayKey() is supposed to work, but how do I check to see when my 3d0 is activated?

I think I'm supposed to assign my thing to a variable which can then be used in the PlayKey brackets, but how do I do that? With GetThingSignature? (I don't understand how to check to see when my thing has been activated)
COUCHMAN IS BACK BABY
2009-09-28, 11:43 PM #2
What exactly do you mean when you say "activated". You can't "activate" 3dos, they're always there.

But yes, you are supposed to assign the thing in the PlayKey brackets. It's per thing, not 3do. In order to determine which thing you want to rotate, you have to place it in the symbols section, without the usual "local" following it. Example:

Quote:
thing mything


Then in the ZED cog window simply assign the thing you want to have animated to mything.

If that's not what you were looking for, then I'm not sure what you mean. You'll have to go into more detail.
2009-09-29, 12:02 AM #3
Ah, that's the missing step (assigning the things in ZED). I'm trying to get a droid to dance when the player walks up to him and presses spacebar.
COUCHMAN IS BACK BABY
2009-09-29, 12:50 AM #4
Ah, I see what you mean now. :D

You'll want to use the activated message in order to check when the droid is activated.
2009-09-29, 11:28 AM #5
Code:
symbols

message		activated

thing		        droid

end

code

activated: 
	PlayKey(droid,droiddance.key,1);
return;
end


I'm still missing something (or many things). I've got it all assigned in ZED but my key isn't playing.
COUCHMAN IS BACK BABY
2009-09-29, 11:56 AM #6
Should be "droiddance.key" I think
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2009-09-29, 11:56 AM #7
Also, if you run with -devmode, you can see useful information in the console window. It'll tell if about COGs that failed to parse correctly.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2009-09-29, 12:38 PM #8
The quotation marks didn't do it and I'm not getting any information from devmode. PlayKey has a fourth parameter for flags that I just left blank (I didn't know what to put there).

Is it possible my animation is getting overridden by the droid's regular idle animation or something?

Yeah something's still screwed with my code. I tested it with different key files and using different messages, but no dice.
COUCHMAN IS BACK BABY
2009-09-29, 2:28 PM #9
Originally posted by Tracer:
The quotation marks didn't do it and I'm not getting any information from devmode. PlayKey has a fourth parameter for flags that I just left blank (I didn't know what to put there).

All hail the DataMaster:

Code:
Keyframe Flags
Hex	Dec	Purpose
default		Animation loops when finished.
0x1	1	Animation pauses on its first frame.
0x2	2	Animation does not loop.
0x4	4	Animation pauses on its last frame.
0x8	8	Animation will restart if already playing.
0x10	16	External animation will finish in the time given when stopped.
0x20	32	Animation will end smoothly.


Looks like you might want 0x2, or the animation will loop forever.

IIRC, not passing a param will cause JK to not compile your cog.

Quote:
Is it possible my animation is getting overridden by the droid's regular idle animation or something?

Yes. Use a higher priority (third arg) to make sure this wont happen. 5 should work.


And remember, using the 'print' verb for cog debugging is essential...

Code:
symbols
message		activated
thing		        droid
end
code
activated:
  print("I've been activated!");
  PlayKey(droid, "droiddance.key", 5, 0x2);
return;
end


That will tell you, at the very least, that the cog compiled and is responding to the activated message.
And when the moment is right, I'm gonna fly a kite.
2009-09-29, 2:41 PM #10
Code:
symbols

message		activated

thing		droid

end

code

activated:
	Print("And now we dance!");
	PlayKey(droid,"droiddance.key",5,0x4);
return;
end


I'm getting nothing from this - no animation, no printed text. I've got my cog placed in the project directory and set up in the placed cogs window ('droid' is assigned to the correct thing). Maybe ai 3dos don't respond to spacebar activations?

edit- actually, nevermind that last thing. It's got to be something like my cog isn't compiling.
COUCHMAN IS BACK BABY
2009-09-29, 4:18 PM #11
It's all wrong.

Quote:
symbols

message activated

thing droid

keyframe droiddance

end

code

activated:
Print("And now we dance!");
PlayKey(droid,droiddance,5,0x4);
return;
end


Assign the key you want to "droiddance" in the ZED cog window.
2009-09-29, 4:39 PM #12
Originally posted by Xzero:
It's all wrong.

Crap, you're right. :carl:
And when the moment is right, I'm gonna fly a kite.
2009-09-29, 5:38 PM #13
Hmm I'm still not getting this right. I tried making a basic text writing cog, but I can't get it to do anything.

Code:
symbols

message startup

end

code

startup:

print(:"HERE IS SOME TEXT");
return;
end


I've tried it in the project directory and project/cog, but nothing.

Also, I appreciate you guys trying to help me out here.
COUCHMAN IS BACK BABY
2009-09-29, 6:08 PM #14
The colon inside the print call is killing it.
And when the moment is right, I'm gonna fly a kite.
2009-09-29, 6:20 PM #15
Hey, now it works. Sort of.

Do you have to have to actually restart ZED if you're working cogs? Because I have no idea what I did differently aside from leave the computer and come back later.
Attachment: 22772/dance.jpg (93,711 bytes)
COUCHMAN IS BACK BABY

↑ Up to the top!