Skip to content

Instantly share code, notes, and snippets.

@Overwatch-C-17
Last active April 24, 2021 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Overwatch-C-17/e1b2c7fa6b151ef31446e747ea06e7b6 to your computer and use it in GitHub Desktop.
Save Overwatch-C-17/e1b2c7fa6b151ef31446e747ea06e7b6 to your computer and use it in GitHub Desktop.
For and While loop
#include "zcommon.acs"
#library "main"
bool Debug = False;
int TrainingSpawnSpot = 0;
str OldSwitch[5] =
{
"SW_OL1", // Array index start from here, count as 0
"SW_OL2", // 1
"SW_OL3", // 2
"SW_OL4", // 3
"SW_OL5" // 4
};
str ElSwitch[5] =
{
"SW_EL1", // 0
"SW_EL2", // 1
"SW_EL3", // 2
"SW_EL4", // 3
"SW_EL5" // 4
};
Script <<0>> Open
{
SetLineSpecial (1, ACS_Execute, 1, 0);
SetLineSpecial (2, ACS_Execute, 2, 0);
SetLineSpecial (3, ACS_Execute, 3, 0, 3, 6, 7);
SetLineSpecial (4, ACS_Execute, 3, 0, 4, 8, 9);
SetLineSpecial (5, ACS_Execute, 3, 0, 5, 10, 11);
SetLineSpecial (6, ACS_Execute, 3, 0, 6, 12, 13);
}
Script 1 (Void)
{
ActivatorSound ("Switch1", 256);
For (int i = 1; i <= 4; i++)
{
If (Debug == True)
Print (d:i);
SetLineTexture (1, SIDE_FRONT, TEXTURE_MIDDLE, OldSwitch[i]);
Delay (4);
}
PolyObj_Move (0, 8, 64, 64);
PolyObj_Move (1, 8, 64, 64);
PolyWait (0);
PolyWait (1);
PolyObj_DoorSlide (0, 4, 128, 60, 105);
PolyObj_DoorSlide (1, 4, 0, 60, 105);
PolyWait (0);
PolyWait (1);
PolyObj_Move (0, 8, 192, 64);
PolyObj_Move (1, 8, 192, 64);
PolyWait (0);
PolyWait (1);
Delay (35);
ActivatorSound ("Switch1", 256);
int j = 4;
While (j-- > 0)
{
If (Debug == True)
Print (d:j);
SetLineTexture (1, SIDE_FRONT, TEXTURE_MIDDLE, OldSwitch[j]);
Delay (4);
}
}
Script 2 (Void)
{
ActivatorSound ("Switch1", 256);
For (int i = 3; i >= 0; i--)
{
If (Debug == True)
Print (d:i);
SetLineTexture (2, SIDE_FRONT, TEXTURE_MIDDLE, OldSwitch[i]);
Delay (4);
}
PolyObj_Move (0, 8, 64, 64);
PolyObj_Move (1, 8, 64, 64);
PolyWait (0);
PolyWait (1);
PolyObj_DoorSlide (0, 4, 128, 60, 105);
PolyObj_DoorSlide (1, 4, 0, 60, 105);
PolyWait (0);
PolyWait (1);
PolyObj_Move (0, 8, 192, 64);
PolyObj_Move (1, 8, 192, 64);
PolyWait (0);
PolyWait (1);
Delay (35);
ActivatorSound ("Switch1", 256);
int j = 0;
While (j++ < 4)
{
If (Debug == True)
Print (d:j);
SetLineTexture (2, SIDE_FRONT, TEXTURE_MIDDLE, OldSwitch[j]);
Delay (4);
}
}
Script 3 (int LineID, int ItemSpot, int WeaponSpot)
{
ActivatorSound ("Switch1", 256);
For (int i = 0; i < 4; i++)
{
SetLineTexture (LineID, SIDE_FRONT, TEXTURE_BOTTOM, ElSwitch[i + 1]);
Delay (4);
}
If (GameType() != GAME_SINGLE_PLAYER || GameType() != GAME_NET_COOPERATIVE)
{
ACS_Suspend (3, 0);
}
Delay (35*4);
If (PlayerClass (PlayerNumber()) == CLASS_FIGHTER)
{
Thing_Spawn (ItemSpot, T_MANA1, 0, 0);
Thing_Spawn (WeaponSpot, T_FIGHTERAXE, 0, 0);
Thing_Spawn (14, T_ITEMHEALTHFULL, 0, 0);
}
Else If (PlayerClass (PlayerNumber()) == CLASS_CLERIC)
{
Thing_Spawn (ItemSpot, T_MANA1, 0, 0);
Thing_Spawn (WeaponSpot, T_CLERICSTAFF, 0, 0);
Thing_Spawn (14, T_ITEMHEALTHFULL, 0, 0);
}
Else If (PlayerClass (PlayerNumber()) == CLASS_MAGE)
{
Thing_Spawn (ItemSpot, T_MANA1, 0, 0);
Thing_Spawn (WeaponSpot, T_MAGESHARDS, 0, 0);
Thing_Spawn (14, T_ITEMHEALTHFULL, 0, 0);
}
Else
{
Thing_Spawn (ItemSpot, T_MANA3, 0, 0);
Thing_Spawn (WeaponSpot, T_MANA3, 0, 0);
Thing_Spawn (14, T_ITEMSUMMON, 0, 0);
}
Delay (35*3);
TrainingSpawnSpot = 2;
While (TrainingSpawnSpot++ < 5)
{
Thing_Spawn (TrainingSpawnSpot, T_FIREGARGOYLE, 192, 666);
Delay (8);
}
Until (!ThingCount(T_FIREGARGOYLE, 666))
Delay (35);
For (int r = 4; r > 0; r--)
{
SetLineTexture (LineID, SIDE_FRONT, TEXTURE_BOTTOM, ElSwitch[r - 1]);
Delay (4);
}
}
Script 4 Lightning
{
For (int STag; STag <= 3; STag += 1)
{
Floor_Waggle (STag, 64, 64, 72, 8);
Ceiling_Waggle (STag, 64, 64, 72, 8);
Delay (12);
}
Thing_Deactivate (1);
Delay (Random (70, 105));
Thing_Activate (1);
}
Script 5 (Void)
{
Floor_RaiseByValueTimes8 (4, 4, 4);
TagWait (4);
Floor_LowerToNearest (5, 16);
}
Script 6 (Void)
{
Until (!ThingCount (T_FIREGARGOYLE, 16))
Delay (35*5);
Thing_Spawn (15, T_FIREGARGOYLE, 192, 16);
Thing_Deactivate (16);
SetThingSpecial (16, ACS_Execute, 6, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment