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 → Would someone make me a quick camera cog?
Would someone make me a quick camera cog?
2004-07-08, 1:06 PM #1
Here's an idea I just considered for my JKA (Jedi Knight Arena) level:

Would it be possible to have a cog where a spectator walks up to a console, activates it, and then can see through a camera which is constantly hovering behind one of the players in the ring. Kind of like the "follow bot camera" featured in JO/JA when you're a spectator.

That would really rock, because spectators could be in the midst of the action, even if the actual player wasn't in view from a lookout position. A cog doing just this would be extrememly appreciated. Thankyou.


[EDIT: Additional information/preferences - 1) I would like it if the camera stayed "on" until the spectator hits "activate" again, as opposed to a timer. 2) I would also like to be able to have eight consoles (one for each of the two players, and then four sets of these, one for each of the four quarters of the spectator area. Is it possible to have multiple people looking from the smae ghost/camera at once?

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

[This message has been edited by Daft_Vader (edited July 08, 2004).]
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2004-07-08, 3:56 PM #2
Look at Rbots, there's a hotkey that sets the camera to one of the bots in the map, that cog should be a lot of help.

------------------
*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
2004-07-09, 8:08 AM #3
I usually only do weapon/item/force power cogs, so not sure how well this'll work.

I saw the JKA level you're working on and it looks great so I'm happily trying to contribute.

It'll be an unsynced client cog that you assign a surface to. When you activate it, it'll disable the player and have him spectate a player, pressing activate again will toggle you through the different players and when you run out of players will set you back to the correct view. Crouching will also kick you out of spectator mode.

Code:
# Jedi Knight Cog Script
#
# qm_spectator.cog
#
# Let's a player spectate other players by activating a switch.
#
# [QM]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


flags=0x240


symbols


surface     spectate_button


thing       player=-1                        local
thing       victim=-1                        local
thing       camera=-1                        local
template    camera_tpl=ghost                 local
int         pcount=-1                        local
int         camera_sig=-1                    local
vector      player_dir                       local
vector      player_loc                       local


message     activated
message     pulse
message     removed


end


# ========================================================================================


code


activated:
   player = GetSourceRef();
   player_dir = GetThingLVec(player);
   player_loc = GetThingPos(player);
   ClearActorFlags(player, 0x1);
   SetActorFlags(player, 0x840000);
   pcount = pcount + 1;
   if(pcount >= GetNumPlayers())
   {
      pcount = -1;
      call stop_cam;
      Return;
   }
   if(GetPlayerThing(pcount) == player)
   {
      call activated;
      Return;
   }
   if(camera == -1)
   {
      camera = CreateThing(camera_tpl, player);
      camera_sig = GetThingSignature(camera);
      CaptureThing(camera);
   }
   else
   {
      DetachThing(camera);
   }
   victim = GetPlayerThing(pcount);
   TeleportThing(camera, victim);
   AttachThingToThingEx(camera, victim, 0x8);
   SetCameraFocus(1, camera);
   SetPulse(0.01);
   Return;


# ........................................................................................


pulse:
   if(IsThingCrouching(player))
   {
      call stop_cam;
      Return;
   }
   if(!(VectorDist(GetThingPos(player), player_loc) == 0))
   {
      call stop_cam;
      Return;
   }
   if(!(VectorDist(GetThingLVec(player), player_dir) == 0))
      SetThingLook(player, player_dir);
   SetCurrentCamera(1);
   Return;


# ........................................................................................


removed:
   if(GetSenderRef() != camera) Return;
   SetCameraFocus(1, player);
   Return;


# ........................................................................................


stop_cam:
   SetPulse(0);
   SetActorFlags(player, 0x1);
   ClearActorFlags(player, 0x840000);
   SetCameraFocus(1, player);
   if(GetThingSignature(camera) == camera_sig) DestroyThing(camera);
   camera = -1;
   CycleCamera();
   CycleCamera();
   Return;


end


Untested and I just used notpad, so there's no syntax checking or any of that junk. Let me know if it works at all, works but doesn't do what you wanted, etc.

Quib Mask

P.S. - I use a camera rather than just setting the camera to focus on the other player so if they leave the game while you're spectating them you won't crash.

P.P.S. - Edited it because I thought of another fail-safe to add.

P.P.P.S. - After I know if this is what you want, I can spruce it up with sounds and make it print on the screen who you're spectating and all that jazz.

[This message has been edited by Quib Mask (edited July 09, 2004).]
2004-07-09, 1:18 PM #4
Sweet! Thanks Quib Mask, I'll give it a whirl and see how it works. Only prob is, with JK Arena, you need at least three players in order to have a spectator (not sure if it will work out with just one or two - myself and my sister). Either way, I'll be sure to report back with my discoveries though. [http://forums.massassi.net/html/smile.gif]

------------------
~ Vader's Corner ~
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2004-07-09, 1:28 PM #5
Nope, won't work. Do you and one or two of your buddies want to have a pre-beta test? That would be awesome, plus it would give me a feel for whether or not this thing* works gameplay wise.

* by that I mean both cog and level.

------------------
~ Vader's Corner ~
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2004-07-09, 3:38 PM #6
I just loaded it into canyon oasis and tested with 3 computers and it worked great. There must be a JKA cog that's interfering with the spectator camera. Do you have any other custom cogs or are you just using the basic JKA cogs? Gonna start looking through them and see what I find; I suspect one of them screws with the camera (not much else could cause this spectate camera to fail). The other possibility is you don't have the "ghost" template.

Quib Mask

P.S. - I have 4 computers, so I could potentially connect 4 clients to you for testing purposes... kinda hard for me to play 4 at once though.

P.P.S. - Did you test it alone or with 2 people? Alone, activating the switch would do nothing.

[This message has been edited by Quib Mask (edited July 09, 2004).]
2004-07-09, 3:52 PM #7
Alone, so that would explain.

------------------
~ Vader's Corner ~
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2004-07-09, 4:40 PM #8
I sent you an Email, so we can work it all out tomorrow - thanks for your time and efforts. I'm going to bed. Good Night.

------------------
~ Vader's Corner ~
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2004-07-10, 3:40 AM #9
-{Spectator View}-

Hold down blinding to cycle through all the players and release it when the player's name comes up.

It will turn off if you die or if you select another force power.

Passes C/S, if it even matters.

Code:

symbols

thing player local
thing victim local
thing potential local

flex mana local
flex cost=000.0 local
int rank local
int count local
int retval=0 local
int dummy local

flex dot local
flex maxDot local

sound MaJiKSoUnD=ForceBlind01.WAV local
template MaJiK=+force_blind local

int active=0 local
model small=remo.3do local
model bomber=tieb.3do local
template glue=manaboost local
template test=ghost local

message startup
message activated
message deactivated
message pulse
message timer
message newplayer
message killed
message deselected
message selected

end

# ========================================================================================

code

startup:
player = GetlocalPlayerThing();
Return;

if(active) Return;
mana = GetInv(player, 14);
rank = GetInv(player, 27);
if(mana >= cost)
{
victim = -1;
active = 1;
SetInvActivated(player, 27, 1);
SetPulse(0.33);
}
Return;
victim = -1;
maxDot = 0;
potential = FirstThingInView(player, 30 + 15 * rank, 8, 0x404);
while(potential != -1)
{
if(
HasLOS(player, potential) &&
(potential != player) &&
(VectorDist(GetThingPos(player), GetThingPos(potential)) <= (1 + rank)) &&
!(GetThingFlags(potential) & 0x200) &&
!(GetActorFlags(potential) & 0x100) &&
!((jkGetFlags(potential) & 0x20) && !IsInvActivated(player, 23))
)
{
dot = ThingViewDot(player, potential);
if(dot > maxDot)
{
victim = potential;
maxDot = dot;
}
}
potential = NextThingInView();
}
# ........................................................................................

activated:
if(GetNumPlayers() > 1)
{
none = 0;
id = 0;
SetInvActivated(player, 27, 1);
SetPulse(1.0);
pulse:
max = GetNumPlayers();
id = id + 1;
if(id == max)
{
id = 0;
}
victim = GetPlayerThing(id);
jkStringClear();
jkStringConcatAsciiString("<< << Player To Spectate: ");
jkStringConcatPlayerName(victim);
jkStringConcatAsciiString(" >> >>");
jkStringOutput(player, -3);
Return;
}
none = 1;
Return;
deactivated:
if(!none && player != victim)
{
SetCameraFocus(0, victim);
jkStringClear();
jkStringConcatAsciiString("Spectator View is on: ");
jkStringConcatPlayerName(victim);
jkStringConcatAsciiString("!!!");
jkStringOutput(player, -3);
}
SetInvActivated(player, 27, 0);
SetPulse(0);
Return;
selected:
Print("Spectator View");
Return;
killed:
newplayer:
deselected:
SetCameraFocus(0, player);
Print("Spectator View OFF");
Return;
x, x, x, x, x, x, X, x;
x = '0.994 0.1109 0.0';
x(x, x, x);
X = x(x, x);
X(x, x), x(x, x);
x(X, x, X, x);
x(x, x);
x(x, x);
if(x(X(x), X(X)) > x)
{
x = x;
x(X);
x;
}
Return;
0, EAH;
if((x == x) || (x() <= x(x()))) {}
else {}
if(x())
if(x && (x()))
{
if(!(x() & x)) '0.0 0.0 0.4'();
else
{
if(x & x) x();
}}

Return;
if(x()) Return;
stop_power:
Return;
//end of screwed section

end

# EAH_XxLuNaTiKxX

- Don't Remove my Name

[This message has been edited by LuNa (edited July 10, 2004).]
2004-07-10, 9:03 AM #10
EAH_XxLuNaTiKxX, I completely HATE all that 'x' junk [http://forums.massassi.net/html/tongue.gif] Got to admit though, it is an ingenious way to pass checksum. I hate it since it just makes the cog look REALLY confusing. I take it that you have to replace blinding with this cog since you didn't make a button you could activate?

------------------
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"

[This message has been edited by SG-fan (edited July 10, 2004).]
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2004-07-10, 9:48 AM #11
This is how I woulda broken down his "left-over-scraps" section:
Code:
   if(0)
   {
      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1;
      '0', '0';
      if(0);
      if(0);
      if(0) { }
      if(0) { }
      if(0) { }
      if(0) { }
      if(0) { }
      if(0) { }
   }
   Return;


It SHOULD pass checksum, but I didn't bother testing. Just showing a different way to organize left-overs.

I try to always put my scraps within a if(0) so there's no chance of the junk being processed.

Quib Mask
2004-07-10, 10:15 AM #12
EAH put a return; before his 'x' junk, it wouldn't process anyway. Both ways work, I actually like Quib's better since it looks more pleasing to the eye [http://forums.massassi.net/html/wink.gif]

------------------
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"

↑ Up to the top!