by mathey bu » Fri May 14, 2010 3:04
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
this script make a chasecam view
[spoiler=][code]#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);
}[/code][/spoiler]
ok, but the problem is that i dont wanna view the center of player i want something like this:
[spoiler=][img]http://img59.imageshack.us/img59/8250/screenshotdoom201005110.png[/img][/spoiler]
how can i change the x offset and make the chasecam works normally, i want only to put the x = -45