Advertisement
ywkls

Temporary Trigger

Oct 19th, 2019
168
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ffc script Temp_Trigger{
  2. void run(int trigger_lw,int offset, int sfx, int window){
  3. int loc = ComboAt(this->X,this->Y);
  4. int combo = Screen->ComboD[loc];
  5. bool triggered;
  6. int timer = window;
  7. while(!Screen->State[ST_SECRET]){
  8. if(!triggered){
  9. for(int i = Screen->NumLWeapons();i>0;i--){
  10. lweapon wpn = Screen->LoadLWeapon(i);
  11. if(wpn->ID==trigger_lw && WeaponCollision(this,wpn))
  12. triggered = true;
  13. }
  14. }
  15. else{
  16. Screen->ComboD[loc]+=offset;
  17. Game->PlaySound(sfx);
  18. while(timer>0){
  19. timer--;
  20. Waitframe();
  21. }
  22. timer= window;
  23. Screen->ComboD[loc]-=offset;
  24. triggered= false;
  25. }
  26. Waitframe();
  27. }
  28. }
  29. }
  30.  
  31. //D0- Combo ID of trigger
  32. //D1- Sound to be made
  33. //D2- Number of triggers in the room.
  34. //D3- Whether screen secrets are triggered.
  35. //D4- Screen->D register to store secrets in.
  36.  
  37. ffc script Combo_Change{
  38. void run(int comboid, int sfx, int numTriggers, bool secret,int perm, bool temp){
  39. bool isBlock[176];
  40. bool SoundMade[176];
  41. bool playSound=false;
  42. int numChanged;
  43. bool triggered = false;
  44. int i;
  45. for(i=0; i<176; i++){
  46. SoundMade[i] = false;
  47. if(Screen->ComboD[i]==comboid)isBlock[i]= true;
  48. }
  49. if (Screen->D[perm])triggered = true;
  50. while(!triggered){
  51. if(temp){
  52. for(i=0; i<176; i++)
  53. SoundMade[i]=false;
  54. numChanged = 0;
  55. }
  56. for(i=0; i<176; i++){
  57. if(isBlock[i] && !SoundMade[i] && Screen->ComboD[i]!=comboid){
  58. SoundMade[i]=true;
  59. if(sfx>0)playSound = true;
  60. if(secret)numChanged++;
  61. }
  62. }
  63. if(playSound){
  64. Game->PlaySound(sfx);
  65. playSound=false;
  66. }
  67. if(numChanged == numTriggers && secret)
  68. triggered = true;
  69. Waitframe();
  70. }
  71. if(secret){
  72. Screen->TriggerSecrets();
  73. Screen->State[ST_SECRET] = true;
  74. }
  75. Screen->D[perm]= 1;
  76. }
  77. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement