Guest User

Untitled

a guest
May 20th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. ffc script HoleLava{
  2. void run(int lava, int warpto, int damage){
  3.  
  4. this->Misc[0] = WSP_FALLING; this->Misc[1] = SFX_FALLING; //Set up correct graphic and sound effect
  5. if(lava){
  6. this->Misc[0] = WSP_LAVA;
  7. this->Misc[1] = SFX_LAVA;
  8. }
  9. //Find return point when falling in lava. (this->X,this->Y) used if ffc is not at (0,0)
  10. if((this->X == 0 && this->Y == 0) || this->Flags[FFCF_CHANGER]){
  11. Waitframes(5);
  12. this->X = Link->X; this->Y = Link->Y;
  13. }
  14. this->Misc[2] = warpto;
  15. if(damage) this->Misc[3] = damage;
  16. else this->Misc[3] = 8;
  17.  
  18. while(true){
  19. while(!OnPitCombo()) Waitframe(); //Idle while not on pit
  20. int pitclk = 0;
  21. while(OnPitCombo() && pitclk++ < 4) Waitframe(); //Wait for four frames whilst on pit
  22. if(pitclk >= 5) Fall(this); //Fall
  23. }
  24. }
  25. void Fall(ffc Info){
  26. Screen->ClearSprites(SL_LWPNS);
  27. Game->PlaySound(Info->Misc[1]);
  28. int wait = CreateGraphic(Info->Misc[0]);
  29.  
  30. Link->Invisible = true; Link->CollDetection = false;
  31. for(int i=0;i<wait+30;i++) WaitNoAction();
  32. Link->Invisible = false; Link->CollDetection = true;
  33.  
  34. if(Info->Misc[2]) Warp(Info);
  35.  
  36. Link->X = Info->X; Link->Y = Info->Y;
  37. Link->HP -= Info->Misc[3];
  38. Game->PlaySound(SFX_OUCH);
  39. }
  40. void Warp(ffc Warp){
  41. int orig = Warp->Data;
  42. Warp->Data = CMB_AUTOWARP;
  43. Warp->Flags[FFCF_CARRYOVER] = true;
  44. Waitframe();
  45. Warp->Data = orig;
  46. Warp->Flags[FFCF_CARRYOVER] = false;
  47. Link->Z = Link->Y;
  48. Quit();
  49. }
  50. bool OnPitCombo(){
  51. return (Screen->ComboT[ComboAt(Link->X+8,Link->Y+8)] == CT_HOLELAVA && Link->Z <= 0 && Link->Action != LA_FROZEN);
  52. }
  53. int CreateGraphic(int sprite){
  54. lweapon l = Screen->CreateLWeapon(LW_SCRIPT1);
  55. l->HitXOffset = 500;
  56. l->UseSprite(sprite);
  57. l->DeadState = l->NumFrames*l->ASpeed;
  58. l->X = Link->X; l->Y = Link->Y;
  59. return l->DeadState;
  60. }
  61. }
Add Comment
Please, Sign In to add comment