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 → Camera Angles
Camera Angles
2001-08-14, 11:31 AM #1
If this is in the wrong forum, sorry, tell me and I will move it...

In a mod, can you add more camera angles so that when you hit F1 you can maybe have a different view? If so... how?
2001-08-14, 2:35 PM #2
Haven't been posting for a while but.

If your work is for MotS, it's pretty much possible, but JK can't.

MotS has a function to catch any action the player causes including the camera mode switching.

You can in a cog make a playeraction message and capture the camera switch action, change the view distance from the player according to the number of times the action has occured.

example:

Code:
SetActionCog(GetSelfCog(), 0xfff);
playeraction:


//Forgot what param the camerachange is, but there is a tutorial on massassi that tells about this playeraction stuff.


//eyeVec's can be a vector ie : '0 1 0.37'


   if(GetParam(0) == CameraChange)
   {
      if(pressed == 0) ParseArg(player, "eyeoffset=eyeVec0");
      else
      if(pressed == 1) ParseArg(player, "eyeoffset=eyeVec1");
      .
      .
      etc


      pressed = pressed + 1;
   }


   return;


------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited August 14, 2001).]
2001-08-14, 2:44 PM #3
Hate to prove you wrong Hideki, but I did just what he wants. It doesn't let you back into the first person view, but it works.

Code:
# New Camera Positions
#
# Created by Hell Raiser [Jon Harmon]

symbols

thing		player				local
thing		Camera=-1			local

int			CamMode=0			local

template	camera_Tpl=+ghost	local

vector		Position_Vec		local

message		startup
message		pulse

end

code

startup:

	player = GetLocalPlayerThing();
	Position_Vec = VectorSet(0.0, -0.1, 0.08);
	SetPulse(0.01);

return;

Pulse:

	if(Camera != -1) DestroyThing(Camera);

	//PrintInt(GetCurrentCamera());

	if(GetCurrentCamera()==1)
	{
		CamMode=CamMode+1;
		if(CamMode > 3) CamMode=0;

		if(CamMode==0)
		{Position_Vec = VectorSet(0.0, -0.1, 0.08);}
		else if(CamMode==1)
		{Position_Vec = VectorSet(0.0, -0.2, 0.1);}
		else if(CamMode==2)
		{Position_Vec = VectorSet(0.0, -0.3, 0.12);}
		else if(CamMode==3)
		{Position_Vec = VectorSet(0.0, -0.4, 0.14);}

		CycleCamera();
	}

    //if ((jkGetSaberCam() == 1) && (GetCurrentCamera() == 0) && (GetPrimaryFocus(0) == player))
    //CycleCamera();

	Camera = FireProjectile(player, camera_tpl, -1, -1, Position_Vec, '0 0 0', 0, 0, 0, 0);
	SetCameraFocus(0,Camera);

return;

end


4 different external views, no first person. If you know cog, it's easy to add more.

------------------
-Hell Raiser
X-Treme Cogger for DBZ: TDIR
-Hell Raiser
2001-08-14, 11:00 PM #4
Indeed HR I also have a cog just like that one , although it will do differnt things .... thank god for the currentcamera verb.
2001-08-15, 6:16 AM #5
Thanks HR, it works. I improved your cog and even added an internal view! [http://forums.massassi.net/html/smile.gif]
2001-08-15, 6:37 AM #6
I still have one question, is it possible to put yaw, roll, etc into the cog? Can I plug this vector into the cog: (-0.2 ,0.2, 0.08) yaw 225, so that the camera is at a diagonal and facing the player?
2001-08-15, 11:00 AM #7
Ya, I know how. Its the 6th part of the FireProjectile line.
2001-08-15, 1:56 PM #8
ok junkguy, btw thanks HR!
2001-08-16, 12:02 PM #9
The cog works, but sometimes the game crashes when I change the view. Its not when I change to a certain view, because it works at the beginning, but it happens after I play a while and change the view a few times. Do you know whats wrong with the cog?

Code:
flags=0x240

symbols 

thing player local
thing Camera=-1 local 
int CamMode=0 local 
template camera_tpl=+thecam local 
vector Position_Vec local 
message startup
message pulse 
end 

code 

startup: 
player = GetLocalPlayerThing();
SetPulse(0.01); 
return; 

pulse: 
if(Camera != -1) DestroyThing(Camera); 
if(GetCurrentCamera() == 1)
{
CamMode=CamMode+1;
if(CamMode > 7) CamMode=0; 
if(CamMode==0)
{
      CycleCamera();
	SetCurrentCamera(0);
	SetCameraFocus(0, player);	
	ParseArg(player, "eyeoffset=(0.0/0.0/0.037)");
}
else if(CamMode==1)
{
Position_Vec = VectorSet(0.0, -0.1, 0.08);
CycleCamera();
}
else if(CamMode==2)
{
Position_Vec = VectorSet(0.0, -0.2, 0.1);
CycleCamera();
}
else if(CamMode==3)
{
Position_Vec = VectorSet(0.0, -0.3, 0.12);
CycleCamera();
} 
else if(CamMode==4)
{
Position_Vec = VectorSet(-0.2, 0.2, 0.08);
CycleCamera();
} 
else if(CamMode==5)
{
Position_Vec = VectorSet(-0.2, 0.4, 0.1);
CycleCamera();
} 
else if(CamMode==6)
{
Position_Vec = VectorSet(0.1, 0.4, 0.1);
CycleCamera();
} 
else if(CamMode==7)
{
Position_Vec = VectorSet(0.0, -0.95, 0.45);
CycleCamera();
} 

} 

if(CamMode == 0)
{
}
else if(CamMode == 4)
{
Camera = FireProjectile(player, camera_tpl, -1, -1, Position_Vec, '0 225 0', 0, 0, 0, 0);
SetCameraFocus(0,Camera); 
}
else if(CamMode == 5)
{
Camera = FireProjectile(player, camera_tpl, -1, -1, Position_Vec, '-5 210 0', 0, 0, 0, 0);
SetCameraFocus(0,Camera); 
}
else if(CamMode == 6)
{
Camera = FireProjectile(player, camera_tpl, -1, -1, Position_Vec, '0 165 0', 0, 0, 0, 0);
SetCameraFocus(0,Camera); 
}
else
{
Camera = FireProjectile(player, camera_tpl, -1, -1, Position_Vec, '0 0 0', 0, 0, 0, 0);
SetCameraFocus(0,Camera); 
}


return; 

end
2001-08-16, 1:57 PM #10
theory 1:
1 of the element to crash JK is to set a view on something that does not exist. Somehow when you SetCameraFocus, the target thing is no longer valid.

theory 2:
Destroying an invalid thing (which will have 0 assigned and which will usually point to the player himself) will destroy the player and crash the game.

I think it's probably the second reason with DestoryThing having "camera" invalid.

I suggest you to put the
if(camera != -1) DestroyThing(camera);
before the FireProjectiles, so it always destroys the 1 before, only when creating a new one.

Also in order to avoid the first theory, if you have some kind of timer set in the camera_tpl template, you might want to get rid of it as if it gets destroyed automatically by timer, SetCameraFocus can crash JK. If you don't have it, that's ok.

comment:
Don't know why I just said, it's not possible for JK [http://forums.massassi.net/html/smile.gif] Sorry. Haven't been coding cog for months and months.
Using ParseArg may not be so dangerous as if you apply ParseArg in this code, it still works.
But if you can get around with these solutions, that should be fine too.


------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited August 16, 2001).]

↑ Up to the top!