1337CyberdemonxX Posted December 25, 2011 Hi I'm making a WAD and I want a script to execute when the player dies to enable chasecam. How do I do this? 0 Share this post Link to post
GreyGhost Posted December 26, 2011 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. 0 Share this post Link to post
1337CyberdemonxX Posted December 31, 2011 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); } 0 Share this post Link to post
esselfortium Posted December 31, 2011 The XWE forum isn't really the place for general editing questions like this. It'd be more appropriate in Doom Editing. 0 Share this post Link to post
1337CyberdemonxX Posted December 31, 2011 well i just posted it here cause i was using XWE to compile it so yeah. but you're right i should of put it there 0 Share this post Link to post