Page 1 of 1
adjusting the x offset of chasecam script
Posted: Fri May 14, 2010 3:04
by mathey bu
this script make a chasecam view
Spoiler:
Code: Select all
#include "zcommon.acs"
#define C_TID 1000 //Default camera tid
#define MAX_R 64 //Maximum radius (or distance from the player)
#define ADJUST_R 8 //Amount to adjust the camera by
#define VIEW_HEIGHT 80.0 //The approximate hight of the player's view
bool cam_mode[8]; //Variable for turning the camera on or off.
Script 1 ENTER
{
cam_mode[PlayerNumber ()] = ON;
ACS_ExecuteAlways (3, 0, PlayerNumber ());
}
Script 2 RESPAWN
{
cam_mode[PlayerNumber ()] = ON;
ACS_ExecuteAlways (3, 0, PlayerNumber ());
}
Script 3 (int p_num)
{
int r = MAX_R;
while (cam_mode[p_num] == ON)
{
int a = GetActorAngle (0);
int p = GetActorPitch (0);
int x = GetActorX (0) - 0.5;
int y = GetActorY (0);
int z = GetActorZ (0) + VIEW_HEIGHT;
int xyr = r * cos (p) >> 16;
if (!ThingCountName ("ChaseCam", C_TID+p_num))
{
while (!Spawn ("ChaseCam", x-cos(a)*xyr, y-sin(a)*xyr, z+sin(p)*r, C_TID+p_num, a >> 8) && r > 0)
{
r -= ADJUST_R;
xyr = cos (p) * r >> 16;
}
if (ThingCountName ("ChaseCam", C_TID + p_num))
ChangeCamera (C_TID + p_num, 0, 0);
else
{
cam_mode[p_num] = OFF;
print (s:"Camera script failed to initialize.");
}
}
else
{
while (!SetActorPosition (C_TID+p_num, x-cos(a)*xyr, y-sin(a)*xyr, z+sin(p)*r, 0) && r > 0)
{
r -= ADJUST_R;
xyr = cos (p) * r >> 16;
}
SetActorAngle (C_TID + p_num, a);
SetActorPitch (C_TID + p_num, p);
if (r < MAX_R)
r += ADJUST_R;
}
delay (1);
}
}
Script 4 DEATH
{
cam_mode[PlayerNumber ()] = OFF;
Thing_Remove (C_TID + PlayerNumber ());
}
Script 5 (int p_num) DISCONNECT
{
cam_mode[p_num] = OFF;
Thing_Remove (C_TID + p_num);
}
ok, but the problem is that i dont wanna view the center of player i want something like this:
Spoiler:
how can i change the x offset and make the chasecam works normally, i want only to put the x = -45
Re: adjusting the x offset of chasecam script
Posted: Fri May 14, 2010 13:27
by Firebrand
You can add values to these lines:
Code: Select all
int x = GetActorX (0) - 0.5;
int y = GetActorY (0);
Something like this:
Code: Select all
int x = (GetActorX (0) - 0.5) - 45;
int y = GetActorY (0) - 45;
Obviously a bit of trial and error might be needed until you get the values that you want, hope this helps you out

.
Re: adjusting the x offset of chasecam script
Posted: Tue May 18, 2010 19:20
by mathey bu
have i put the ()?