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 → Simple
Simple
2004-04-21, 3:49 PM #1
Hi all, would anyone happen to feel in a good enough mood to write me (what seems to me to be) a very simple cog? It's similar to Grismath's adventure camera cog, and it goes like this:

A cog runs from startup that sets the players' view point (this is multiplayer) to a predefined ghost position (with yaw, rol, etc. defined by me) looking down on the players. It IS NOT a cutscene however - the players (only two will be allowed in this mp level at one time) will be able to fight and run around, but the camera will remain stationary. Thanks, hopefully this is possible in Jedi Knight (NOT MotS)!

<nonessential but great if it is>
If someone could make it really cool and complicated, you could make it so that the camera followed the two players slightly in that it would:

1)pan out so that both of the two players were always in view of the camera.

2)zoom in the closer the players got to each other

3) follow the players short distances

</nonessential but great if it is>


Just to make it easier for people to realize what I'm talking about, I'll go ahead and state I'm envisioning some kind of Street Fighter/Tekken/Mortal Kombat type JK levels/mod.

[http://forums.massassi.net/html/biggrin.gif]

------------------
~ Vader's Corner ~
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2004-04-22, 5:43 AM #2
I'd imagine that if you were able to keep it 2D, you could make the camera pan and such. Just put ghosts every X incriment and move the camera to another incriment based on the position and distance between the player. Positioning the camera so that it is appropriet for jumping and you've got it set. DBZtDiR had a camera EXACTLY how you're invisioning it, and it worked in all 3 Dimensions. It's highly laggy, too. Ask them to help you out, as I'm sure HR would be willing to rip it appart and hand it to you on a silver platter.

JediKirby

------------------
"I was driving along listening to the radio, when Judas Priest comes on. It was 'You've got another thing coming.' All of a sudden, I enter 'VICE CITY RAMAGE MODE' and nearly ran some guy over"
- ]-[ellequin
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ
2004-04-23, 9:55 AM #3
Would someone please provide a cog! Thankyou.

------------------
~ Vader's Corner ~
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2004-04-23, 3:55 PM #4
If I get some time, I'll look into it. It'll likely involve a lot of vector stuff and vector midpoints and junk for the advanced stuff.

I am not guaranteeing that I can turn anything up, however.

------------------
Bond, Power, CA, The Force, Saber, IC, Epic, Oily Mexican Food, BG, /\ |> /\ /\/\, Sentences.
Now you know where I've been.

[This message has been edited by Darth Slaw (edited April 23, 2004).]
May the mass times acceleration be with you.
2004-04-25, 6:45 AM #5
Thanks Slaw.

And Kirby, I haven't heard back from you on any of this stuff. Would you please tell me, by means of either the forums or Email, how to fix the DragonBall Z tDiR problem with messing up JK. Thanks, 'cuz I'd really like to be able to actually play the game again and get some editing done.

Also, I couldn't find the cog you mentioned. I ripped apart the various DBZ cogs, but couldn't find anything much to do with cameras (at least not in the title) and I'm quite frustrated. But since I can't edit or play JK at the moment anyway, it doesn't really make much difference. -_-
Sorry, not trying to rant, just a bit irritated and I'd apprecaite some help. Thankyou.

------------------
~ Vader's Corner ~
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2004-04-25, 8:04 AM #6
Some suggestions:
1. Reinstall TDir and uninstall it in disabled mode. Uninstall/reinstall JK afterwards.
2. Search your system for all files TDir related and delete them. Search your registry for all keys TDir related and delete them. Uninstall/Reinstall JK afterwards.
3. Backup your important data and kill your system. Use dark necromancy to revive it afterwards.

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)

[This message has been edited by zagibu (edited April 25, 2004).]
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-04-25, 9:16 AM #7
Zigabu's #1 is probably going to work the best.

Else you need to find a certain file *cjoku_g1h.c[/b]odugh* and delete it. It tricks JK, and is usually the problem.

Else you need to do Zig's idea.

Oh, and the cog is something like "ChallangeSetup.cog" or whatnot. It's probably got the camera cog in it, but I mentioned it simply because it's exactly what you're looking for. If you can manage to get DBZtDiR to work, I'd suggest you test it out. And really: Send Hell_Raiser an e-mail. He's a great guy, and would probably be willing to fix it up for your needs.

JediKirby

------------------
"I was driving along listening to the radio, when Judas Priest comes on. It was 'You've got another thing coming.' All of a sudden, I enter 'VICE CITY RAMAGE MODE' and nearly ran some guy over"
- ]-[ellequin
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ
2004-04-26, 11:04 AM #8
Okay. Good news... I got a basic camera going! It currently focuses on the midpoint between two players but without zoom in for close-up action.

I'll try to get that and the other stuff in there too. But you at least have the minimum (I think) now. [http://forums.massassi.net/html/smile.gif]

[This message has been edited by Darth Slaw (edited April 26, 2004).]
May the mass times acceleration be with you.
2004-04-26, 12:57 PM #9
Excellent, Slaw! Thanks! [http://forums.massassi.net/html/smile.gif]

No hurry, btw, I'm still trying to get JK up and running again. Thanks Kirby, Zagibu!

------------------
~ Vader's Corner ~

[This message has been edited by Daft_Vader (edited April 26, 2004).]
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2004-04-26, 4:14 PM #10
Okay, I'm having trouble getting the zoom in/out code to work correctly. If anyone else wants to take a crack at it go right ahead.

Here's the basic version. To work it, place a ghost at the position you want and set its pyr. Oh, forget the sector entering stuff; it will start the camera stuff on startup. Just define your playerthings and your ghostcam and you'll be ready to go. The view does follow the players, but the cam will stay stationary (as I haven't gotten it to zoom in/out correctly yet).

Code:
# Jedi Knight Cog Script
#
# actioncam.cog
#
# This cog will require a ghost template for the camera.
# Dest0 and Dest1 are  the sectors which the players enter to be assigned
#  to the camera.
# 
#
# [Darth Slaw] - darthslaw@cox.net
# 4/26/04
# =======================================================================
symbols

message   startup
message   pulse
#message   entered

#sector    dest0=-1
#sector    dest1=-1

flex      refreshrate=0.01

thing     camdroid=-1
thing     player0=-1
thing     player1=-1

vector    camerapos         local
vector    camerapyr         local
vector    vec               local
vector    vec2              local

end
# =======================================================================
code
# .......................................................................
startup:
	Sleep(1);
	camerapos = GetThingPos(camdroid);
	camerapyr = GetThingLVec(camdroid);
	if(player0 != -1 && player1 != -1) SetPulse(refreshrate);

Return;
# .......................................................................
entered:
	if(GetThingType(GetSourceRef()) != 10) Return;
	if(GetSenderRef() == dest0 && GetSourceRef() != player1)
	{
		player0 = GetSourceRef();
	}
	if(GetSenderRef() == dest1 && GetSourceRef() != player0)
	{
		player1 = GetSourceRef();
	}
	if(player0 != -1 && player1 != -1) SetPulse(refreshrate);

Return;
# .......................................................................
pulse:
	if(player0 == -1 || player1 == -1 || GetThingHealth(player0) <= 0 || GetThingHealth(player1) <= 0)
	{
		SetPulse(0);
		SetCameraFocus(0, GetLocalPlayerThing());
		Return;
	}
	vec = VectorAdd(GetThingPos(player0), GetThingPos(player1));
	vec2 = VectorScale(vec, 0.5);                           //get midpoint for focus
	SetThingPos(camdroid, camerapos);                       //keep camera at original position
	SetThingLook(camdroid, VectorSub(vec2, camerapos));     //focus camera
	SetCameraFocus(0, camdroid);
	SetCurrentCamera(0);

Return;
# .......................................................................
end


And here's what I've got on the advanced version (this one still uses actors for testing).
Code:
# Jedi Knight Cog Script
#
# actioncam.cog
#
# This cog will require a robotsentry template for the camera, and a
#  sector for each playerthing's teleport destination.
#
# [Darth Slaw] - darthslaw@cox.net
# 4/26/04
# =======================================================================
symbols

message   startup
message   timer
message   pulse
message   entered

sector    dest0=-1
sector    dest1=-1
sector    camsector=-1

flex      refreshrate=0.01
flex scale=1 local
vector camline local

template  ghosttemp=ghost   local

thing     camdroid=-1       #local
thing     player0=-1        #local
thing     player1=-1        #local

vector    camerapos         local
vector    camerapyr         local
vector    vec               local
vector    vec2              local

end
# =======================================================================
code
# .......................................................................
startup:
	Sleep(1);
	Print("This is a test of the action cam cog.");
//	camdroid = CreateThingAtPos(ghosttemp, camsector, camerapos, camerapyr);
	camerapos = GetThingPos(camdroid);
	camerapyr = GetThingLVec(camdroid);
	if(player0 != -1 && player1 != -1) SetPulse(refreshrate);

Return;
# .......................................................................
entered:
	if(GetThingType(GetSourceRef()) != 2 && GetThingType(GetSourceRef()) != 10) Return;
	if(GetSenderRef() == dest0 && GetSourceRef() != player1)
	{
		print("destination 0 entered");
		player0 = GetSourceRef();
	}
	if(GetSenderRef() == dest1 && GetSourceRef() != player0)
	{
		print("destination 1 entered");
		player1 = GetSourceRef();
	}
	if(player0 != -1 && player1 != -1) SetPulse(refreshrate);

Return;
# .......................................................................
timer:

Return;
# .......................................................................
pulse:
	print("pulse on");
	if(player0 == -1 || player1 == -1 || GetThingHealth(player0) <= 0 || GetThingHealth(player1) <= 0)
	{
		SetPulse(0);
		SetCameraFocus(0, GetLocalPlayerThing());
		Return;
	}
	vec = VectorAdd(GetThingPos(player0), GetThingPos(player1));
	vec2 = VectorScale(vec, 0.5);                           //get midpoint for focus
	//vec = VectorScale(VectorSub(vec2,camerapos), VectorLen(VectorSub(GetThingPos(player0),GetThingPos(player1))) * 0.7); //get cam position -- zoom for action
	camline = VectorSub(camerapos, VectorSub(GetThingPos(player0), GetThingPos(player1)));
	scale = VectorLen( VectorSub(GetThingPos(player0), GetThingPos(player1)) ); // * 0.7;
	vec = VectorScale(camline, -scale);
	SetThingPos(camdroid, vec);                       //keep camera at original position
	SetThingLook(camdroid, VectorSub(vec2, vec));     //focus camera
	SetCameraFocus(0, camdroid);
	SetCurrentCamera(0);

Return;
# .......................................................................
end


I will still attempt to figure this out, but any help would be perfect.

As promised, here are some levels to work with (only the first one loads thru JK -- I must've done something wrong in the Episode Editor [http://forums.massassi.net/html/rolleyes.gif] ; I haven't tried using debug to access the second level yet). The Jed files are included in the gob. Get it here. (If that link doesn't work, tell me and try here instead; please try the other link first though -- I want to see if it works for anything at all. Thanks).

------------------
Bond, Power, CA, The Force, Saber, IC, Epic, Oily Mexican Food, BG, /\ |> /\ /\/\, Sentences.
Now you know where I've been.

[This message has been edited by Darth Slaw (edited April 26, 2004).]
May the mass times acceleration be with you.
2004-04-27, 10:04 AM #11
Rishka made an INCREDIBLE version of this cog back in the day for the Showdown fighting TC. Talk to Lt_Greywolf for a copy.

...that is, if you can find him.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-04-27, 11:40 AM #12
here's one you can try if you want.
i think it works the way you asked for.
Code:
##########################################################
# Jedi Knight Cog Script  (JK)
#---------------------------------------------------------
# FIGHTCAM01.COG
# -Used to give the players a constant veiw of each other.
# -Only TWO players can play with this cog.
# -List the two WALKPLAYER things that are in the level as
#  the PLAYER1 and PLAYER2.
# -The camera can be a normal GHOST thing.
# -The cog needs to have a ghost template with a timer
#  listed as the GHOST_TPL.
#-----------------------------------
# GHOST TEMPLATE EXAMPLE:
# temp_ghost     ghost     timer=0.1
#---------------------------------------------------------
# Written By DSLS_DeathSythe
# This COG is NOT supported by LucasArts Entertainment Co.
##########################################################
flags=0x240
symbols
#---------------------------------------------------------
message     startup
message     killed
message     newplayer
message     pulse
#--------------------#
thing       player1=-1
thing       player2=-1
thing       camera_thng=-1
template    ghost_tpl
flex        minX_zoom=0.3
flex        minZ_zoom=0.0
#--------------------#
thing       temp_ghost=-1                                 local
thing       temp_ghost2=-1                                local
thing       temp_ghost3=-1                                local

vector      camera_offset                                 local
flex        zoom_dist=0.0                                 local
flex        zoom_dist2=0.0                                local

vector      temp_vec                                      local
vector      temp_vec2                                     local
vector      look_vec                                      local
#---------------------------------------------------------
end
#=========================================================
code
#---------------------------------------------------------
startup:
	CaptureThing(player1);
	CaptureThing(player2);
	Sleep(1.0);
	SetCameraFocus(0, camera_thng);
	SetCameraFocus(1, camera_thng);
	SetPulse(0.01);
return;
#---------------------------------------------------------
killed:
newplayer:
	SetCameraFocus(0, camera_thng);
	SetCameraFocus(1, camera_thng);
return;
#---------------------------------------------------------
pulse:
	//-Find the vector in the middle of the players
	temp_vec = VectorAdd(GetThingPos(player1), GetThingPos(player2));
	temp_vec = VectorScale(temp_vec, 0.5);

	if(IsServer())
		{
		temp_ghost = CreateThingAtPos(ghost_tpl, GetThingSector(player1), GetThingPos(player1), '0 0 0');
		SetThingLook(temp_ghost, VectorSub(GetThingPos(player1), GetThingPos(player2)));
		temp_vec2 = VectorSet(0.0, (VectorDist(GetThingPos(player1), temp_vec) * -1), 0.0);
		}
	else
		{
		temp_ghost = CreateThingAtPos(ghost_tpl, GetThingSector(player2), GetThingPos(player2), '0 0 0');
		SetThingLook(temp_ghost, VectorSub(GetThingPos(player2), GetThingPos(player1)));
		temp_vec2 = VectorSet(0.0, (VectorDist(GetThingPos(player2), temp_vec) * -1), 0.0);
		}
	SetLifeLeft(temp_ghost, 0.025);

	temp_ghost2 = FireProjectile(temp_ghost, ghost_tpl, -1, -1, temp_vec2, '0 0 0', 1.0, 0x0, 0.0, 0.0);
	SetLifeLeft(temp_ghost2, 0.025);

	//-Set the zoom of the camera
	zoom_dist = VectorDist(GetThingPos(player1), GetThingPos(player2));
	zoom_dist = zoom_dist / 2;
	zoom_dist2 = VectorDist(GetThingPos(player1), GetThingPos(player2));
	zoom_dist2 = zoom_dist2 / 4;
	if(zoom_dist < minX_zoom)
		zoom_dist = minX_zoom;
	if(zoom_dist2 < minZ_zoom)
		zoom_dist2 = minZ_zoom;
	camera_offset = VectorSet(zoom_dist, 0.0, zoom_dist2);

	temp_ghost3 = FireProjectile(temp_ghost2, ghost_tpl, -1, -1, camera_offset, '0 0 0', 1.0, 0x0, 0.0, 0.0);
	SetLifeLeft(temp_ghost3, 0.025);
	TeleportThing(camera_thng, temp_ghost3);

	//-Set the camera look
	look_vec = VectorSub(temp_vec, GetThingPos(camera_thng));
	SetThingLook(camera_thng, look_vec);
return;
##########################################################
end

it does zoom in and out as the players move together or apart.
to test it you can list the player1 thing as a walkplayer and player2 as something else.
if you want to try it with two players list both walkplayers as the player1 and player2.
until the second player joins the camera will be looking at the player1 person.
try it and see what you think.

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited April 27, 2004).]
Famous last words - "It seemed like a good idea at the time."
2004-04-27, 6:48 PM #13
haven't tried it, but it sounds like it beats the hell outta mine.
And the zoom code looks simpler than I was making it [http://forums.massassi.net/html/frown.gif]. *slams self with a trout*

But what's up with that lonely "killed" message? [http://forums.massassi.net/html/confused.gif]

------------------
Bond, Power, CA, The Force, Saber, IC, Epic, Oily Mexican Food, BG, /\ |> /\ /\/\, Sentences.
Now you know where I've been.
May the mass times acceleration be with you.
2004-04-27, 10:37 PM #14
That "lonely" killed message instructs JK to continue the scripting ("program") flow into the "newplayer" message block, because there's no "return" statement.

The upshot of it all is that by this way of doing things, you can force the "newplayer" message block to be executed when the "killed" message is called [http://forums.massassi.net/html/smile.gif]

Hope this helps [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

PS: Sorry to be concise - I've got to shoot off to sort a networking problem at work [http://forums.massassi.net/html/rolleyes.gif] [http://forums.massassi.net/html/biggrin.gif]

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-04-27, 11:51 PM #15
Yeah, that's a smart trick. LEC does this in a few of it's cogs, too.

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)

↑ Up to the top!