Code: Select all
#include "zcommon.acs"
int LVL_YPOS = 96.0; // Force all actors along this plane
bool YSuspend[32]; // Suspend Y-axis forcing array for players
bool Pogo[32]; // Is pogo active?
bool PogoFirst[32]; // Is this the first pogo use? (animation related)
int DownBuffer[32]; // Camera looking buffer for pressing down
int DownFirst[32]; // checks against buffer
int UpBuffer[32]; // Camera looking buffer for pressing up
int UpFirst[32]; // checks against buffer
int ModY[32]; // Camera distance Y
int ModZ[32]; // Camera height
int Angle[32]; // Player facing direction
// Called by DECORATE to check if a player is pressing jump
Script 2 (VOID)
{
int IsJumping = GetPlayerInput(-1, INPUT_BUTTONS);
if(IsJumping & BT_JUMP)
SetResultValue(60);
else
SetResultValue(36);
}
Script 1 ENTER
{
Spawn("GameCamera", 0, 0, 0, 100+PlayerNumber(), 64);
Thing_ChangeTid(0, 500+PlayerNumber());
ChangeCamera(100+PlayerNumber(), 0, 0);
ACS_Execute(3, 0, PlayerNumber());
}
// This forcibly respawns monsters when the player dies, instead of having the map reload.
Script 998 RESPAWN
{
Thing_Remove(1801);
SetActorState(1800, "Respawn");
Thing_Remove(100+PlayerNumber());
Spawn("GameCamera", 0, 0, 0, 100+PlayerNumber(), 64);
Thing_ChangeTid(0, 500+PlayerNumber());
ChangeCamera(100+PlayerNumber(), 0, 0);
ACS_Execute(3, 0, PlayerNumber());
SetActorState(1800, "Respawn");
}
SCRIPT 997 DEATH
{
Thing_ChangeTid(0, 0);
}
// This script allows the player to look up and down with the camera by holding the respective controls,
// which increases the Up/DownBuffer array.
Script 3 (int PlayNum)
{
SetActivator(500+PlayNum);
while(GetActorProperty(0, APROP_HEALTH) > 0)
{
int x = GetActorX(0);
int z = GetActorZ(0);
int vx = GetActorVelX(0);
int vz = GetActorVelZ(0);
int cx = GetActorX(100+PlayerNumber());
int cz = GetActorZ(100+PlayerNumber());
ModY[PlayerNumber()] = -256.0;
int Input = GetPlayerInput(0, INPUT_BUTTONS);
if(Input & BT_MOVELEFT)
{ Angle[PlayerNumber()] = 0.5; ModZ[PlayerNumber()] = 32.0;
DownFirst[PlayerNumber()] = False;
UpFirst[PlayerNumber()] = False;
DownBuffer[PlayerNumber()] = 0;
UpBuffer[PlayerNumber()] = 0; }
else if(Input & BT_MOVERIGHT)
{ Angle[PlayerNumber()] = 1.0; ModZ[PlayerNumber()] = 32.0;
DownFirst[PlayerNumber()] = False;
UpFirst[PlayerNumber()] = False;
DownBuffer[PlayerNumber()] = 0;
UpBuffer[PlayerNumber()] = 0; }
if(GetActorY(0) != LVL_YPOS && YSuspend[PlayerNumber()] == False)
SetActorPosition(0, GetActorX(500+PlayerNumber()),
LVL_YPOS, GetActorZ(500+PlayerNumber()), 0);
SetActorAngle(0, Angle[PlayerNumber()]);
if(Input & BT_LOOKUP && Pogo[PlayerNumber()] == False
&& GetActorProperty(0, APROP_HEALTH) > 0)
UpBuffer[PlayerNumber()]++;
if(Input & BT_LOOKDOWN && Pogo[PlayerNumber()] == False
&& GetActorProperty(0, APROP_HEALTH) > 0)
DownBuffer[PlayerNumber()]++;
if(DownBuffer[PlayerNumber()] > 55)
{
if(DownFirst[PlayerNumber()] == False)
{
SetActorState(0, "LookDown", 0);
DownFirst[PlayerNumber()] = True;
ModZ[PlayerNumber()] = 0;
}
if(ModZ[PlayerNumber()] > -96.0)
ModZ[PlayerNumber()] -= 4.0;
}
if(UpBuffer[PlayerNumber()] > 55)
{
if(UpFirst[PlayerNumber()] == False)
{
SetActorState(0, "LookUp", 0);
UpFirst[PlayerNumber()] = True;
ModZ[PlayerNumber()] = 0;
}
if(ModZ[PlayerNumber()] < 96.0)
ModZ[PlayerNumber()] += 4.0;
}
SetActorPosition(100+PlayerNumber(), x, LVL_YPOS+ModY[PlayerNumber()], z+32.0+ModZ[PlayerNumber()], 0);
Spawn("Shadow", 0, 0, 0, 900+PlayerNumber(), 0);
SetActorPosition(900+PlayerNumber(), x, LVL_YPOS, GetActorFloorZ(0), 0);
delay(1);
}
}
// Pogo!
Script 5 (VOID) {
If(Pogo[PlayerNumber()] == False && GetActorProperty(0, APROP_HEALTH) > 0)
{ SetActorState(0, "Pogo"); Pogo[PlayerNumber()] = True; PogoFirst[PlayerNumber()] = True; Delay(8);
PogoFirst[PlayerNumber()] = False; }
else if (GetActorProperty(0, APROP_HEALTH) > 0)
{ if(GetActorVelZ(0) < 0)
SetActorState(0, "JumpFall");
else SetActorState(0, "Spawn"); Pogo[PlayerNumber()] = False; }}
// Player movement/aiming script
Script 6 (void)
{
int Button = GetPlayerInput(-1, INPUT_BUTTONS);
if(Pogo[PlayerNumber()] == False)
{
DownFirst[PlayerNumber()] = False;
UpFirst[PlayerNumber()] = False;
DownBuffer[PlayerNumber()] = 0;
UpBuffer[PlayerNumber()] = 0;
if(GetActorZ(0) - GetActorFloorZ(0) == 0 &&
Button & BT_LOOKUP)
{
SetActorState(0, "ShootUp");
if(CheckInventory("NeuralAmmo") > 0)
{
SetActorPosition(0, getactorx(0), LVL_YPOS, getactorz(0)+16.0, 0);
SpawnProjectile(0, "NeuralStun", GetActorAngle(0), 0, 60, 0, 0);
SetActorPosition(0, getactorx(0), LVL_YPOS, getactorz(0)-16.0 ,0);
TakeInventory("NeuralAmmo", 1);
}
else
AmbientSound("stunner/empty", 127);
}
else if(GetActorZ(0) - GetActorFloorZ(0) != 0 &&
Button & BT_LOOKUP)
{
SetActorState(0, "ShootJumpUp");
if(CheckInventory("NeuralAmmo") > 0)
{
SetActorPosition(0, getactorx(0), LVL_YPOS, getactorz(0)+16.0, 0);
SpawnProjectile(0, "NeuralStun", GetActorAngle(0), 0, 60, 0, 0);
SetActorPosition(0, getactorx(0), LVL_YPOS, getactorz(0)-16.0 ,0);
TakeInventory("NeuralAmmo", 1);
}
else
{
AmbientSound("stunner/empty", 127);
delay(20);
}
}
else if(GetActorZ(0) - GetActorFloorZ(0) != 0 &&
Button & BT_LOOKDOWN)
{
SetActorState(0, "ShootJumpDown");
if(CheckInventory("NeuralAmmo") > 0)
{
SetActorPosition(0, getactorx(0), LVL_YPOS, getactorz(0)+16.0, 0);
SpawnProjectile(0, "NeuralStun", GetActorAngle(0), 0, -60, 0, 0);
SetActorPosition(0, getactorx(0), LVL_YPOS, getactorz(0)-16.0 ,0);
TakeInventory("NeuralAmmo", 1);
}
else
{
AmbientSound("stunner/empty", 127);
delay(20);
}
}
else if(GetActorZ(0) - GetActorFloorZ(0) != 0)
{
SetActorState(0, "ShootJump");
if(CheckInventory("NeuralAmmo") > 0)
{
SetActorPosition(0, getactorx(0), LVL_YPOS, getactorz(0)+16.0, 0);
SpawnProjectile(0, "NeuralStun", GetActorAngle(0)>>8, 60, 0, 0, 0);
SetActorPosition(0, getactorx(0), LVL_YPOS, getactorz(0)-16.0 ,0);
TakeInventory("NeuralAmmo", 1);
}
else
{
AmbientSound("stunner/empty", 127);
delay(20);
}
}
else
{
SetActorState(0, "Shoot");
if(CheckInventory("NeuralAmmo") > 0)
{
SetActorPosition(0, getactorx(0), LVL_YPOS, getactorz(0)+16.0, 0);
SpawnProjectile(0, "NeuralStun", GetActorAngle(0)>>8, 60, 0, 0, 0);
SetActorPosition(0, getactorx(0), LVL_YPOS, getactorz(0)-16.0 ,0);
TakeInventory("NeuralAmmo", 1);
}
else
{
AmbientSound("stunner/empty", 127);
delay(20);
}
}
}
Pogo[PlayerNumber()] = False;
}
// Run randomly by certain monsters - in lieu of using A_Chase they are using thrustthing methods.
Script 8 (VOID)
{
if(Random(1, 2) == 1)
SetActorAngle(0, 0.5);
else
SetActorAngle(0, 1.0);
}
Script 100 (VOID)
{
int x = GetActorX(0);
int z = GetActorZ(0);
int vx = GetActorVelX(0);
int vz = GetActorVelZ(0);
Spawn("Daze", x, LVL_YPOS, Z+24.0, 1801, 0);
SetActorPosition(1801, x, LVL_YPOS, z+24.0, 0);
While(vx != 0 || vz != 0)
{
vx = GetActorVelX(0);
vz = GetActorVelZ(0);
x = GetActorX(0);
z = GetActorZ(0);
SetActorPosition(1801, x, LVL_YPOS, z+24.0, 0);
Delay(1);
}
}
// This allows the player to travel between tagged doorways - this works by the player's aim up key being
// also bound to the USE function. Place a 'player uses sector' actor to run this script and define the
// mapspot to teleport to through the doorway
Script 99 (int MapSpot)
{
if(Pogo[PlayerNumber()] == False &&
GetActorZ(0) - GetActorFloorZ(0) == 0 &&
GetActorProperty(0, APROP_HEALTH) > 0)
{
SetPlayerProperty(0, ON, PROP_TOTALLYFROZEN);
YSuspend[PlayerNumber()] = True;
SetActorState(0, "Enter", 0);
for(int Mloop = 35; Mloop > 0; MLoop--)
{
int x = GetActorX(0);
int y = GetActorY(0);
int z = GetActorZ(0);
SetActorPosition(0, x, y+2.0, z, 0);
delay(1);
}
SetActorPosition(0, GetActorX(MapSpot), GetActorY(MapSpot), GetActorZ(MapSpot), 0);
SetActorState(0, "Exit", 0);
While(GetActorY(0) > LVL_YPOS)
{
x = GetActorX(0);
y = GetActorY(0);
z = GetActorZ(0);
SetActorPosition(0, x, y-2.0, z, 0);
delay(1);
}
SetActorPosition(0, x, LVL_YPOS, z, 0);
SetActorState(0, "Spawn");
SetPlayerProperty(0, OFF, PROP_TOTALLYFROZEN);
YSuspend[PlayerNumber()] = False;
}
}
// This is for ledge grabbing which I haven't implemented
Script 101 (VOID)
{
int TID;
for(int Iterate = 100; Iterate > 0; Iterate--)
if(ThingCount(T_NONE, Iterate+900) == 0)
TID = Iterate+900;
if(GetActorAngle(0) == 1.0)
Spawn("WallCheck", GetActorX(0)+20.0, GetActorY(0), GetActorZ(0)+100.0, TID);
else
Spawn("WallCheck", GetActorX(0)-20.0, GetActorY(0), GetActorZ(0)+100.0, TID);
if(GetActorFloorZ(TID) != GetActorFloorZ(0)) SetResultValue(1);
else SetResultValue(0);
Thing_Remove(TID);
}