Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
1337CyberdemonxX

How to use ACS?

Recommended Posts

Try this - it's a hack of the third person camera script on the ZDoom Wiki and probably overkill for what you want.

//Third person death camera simulation.
//A quick hack of solarsnowfall's script by GreyGhost

#include "zcommon.acs"

#define C_TID		1000	//Default camera tid
#define MAX_R		128	//Maximum radius (or distance from the player)
#define ADJUST_R	8	//Amount to adjust the camera by
#define VIEW_HEIGHT	41.0	//The approximate height of the player's view

bool cam_mode[8];		//Variable for turning the camera on or off.
	
Script 1 DEATH
{
	cam_mode[PlayerNumber ()] = ON;
	ACS_ExecuteAlways (2, 0, PlayerNumber ());
}

Script 2 (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);
		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 3 RESPAWN
{
	cam_mode[PlayerNumber ()] = OFF;
	Thing_Remove (C_TID + PlayerNumber ());
}
You'll also need the ChaseCam actor from that page in your DECORATE script.

ACS scripts can also be edited and compiled from within Doom Builder, should you encounter problems with XWE.

Share this post


Link to post

thanks alot but can't you just edit the player DECORATE to execute a script when you die. and the script would be this:
#include "zcommon.acs"

script int (VOID) NET
{
Consolecommand("chase");
]

script int RESPAWN
{
acs_suspend(int);
}

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×