Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 2.19 KB  |  views: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import "ffcscript.zh"
  2. import "std.zh"
  3.  
  4. //For the magic, set the tiles as - UP, DOWN, LEFT, RIGHT
  5. //Constants for the sentry itself
  6. const int sentile = 892; //Combo ID for sentry. It goes up, down, left, right
  7. const int sencset = 7; //CSet for sentry
  8.  
  9. //Constants for the magic it shoots
  10. const int senweapon = 89; //Weapon ID for magic
  11. const int sendam = 4; //How much damage the magic does
  12. const int senspd = 500; //How fast the magic goes
  13. const int senmag = 8; //How much magic it uses to fire
  14.  
  15. //Other Constants
  16. const int sensound = 21; //Sound for when the sentry is created
  17. const int magsound = 32; //Sound for when the sentry fires
  18. const int senbweapon = 88; //Tile for when sentry turns into a bomb
  19.  
  20. ffc script sentry{
  21.         void run(){
  22.                
  23.                 this->X = Link->X;
  24.         this->Y = Link->Y;
  25.         this->Data = sentile;
  26.         this->CSet = sencset;
  27.         Game->PlaySound(sensound);
  28.                
  29.                 while(!Link->PressB){
  30.                        
  31.                         //Set the direction of the sentry
  32.                         if(Link->Dir == DIR_UP)        this->Data = sentile;
  33.                         else if(Link->Dir == DIR_DOWN) this->Data = sentile+1;
  34.                         else if(Link->Dir == DIR_LEFT) this->Data = sentile+2;
  35.                         else if(Link->Dir == DIR_RIGHT)this->Data = sentile+3;
  36.                        
  37.                         //If the player hits 'A', fire magic!
  38.                         if(Link->PressA == true && Link->MP>= senmag){
  39.                                 //Create the magic weapon and fire it
  40.                                 lweapon magic = Screen->CreateLWeapon(13);
  41.                                 magic->X = this->X;
  42.                                 magic->Y = this->Y;
  43.                                 magic->UseSprite(senweapon);
  44.                                 magic->Tile += Link->Dir;
  45.                                 magic->Damage = sendam;
  46.                                 magic->Step = senspd;
  47.                                 magic->Dir = Link->Dir;
  48.                                 Game->PlaySound(magsound);
  49.                                 Link->MP -= senmag;
  50.                         }
  51.                         Waitframe();
  52.                 }
  53.                
  54.                 //Set up the explosion
  55.                 lweapon explode = Screen->CreateLWeapon(6);
  56.         explode->X = this->X;
  57.         explode->Y = this->Y + 2;
  58.         explode->UseSprite(senbweapon);
  59.         explode->Damage = sendam;        
  60.                 this->X = -16;
  61.                 this->Y = -16;
  62.                
  63.                 while(explode->isValid()) Waitframe();
  64.                
  65.                 this->Data = 0;
  66.                 Quit();
  67.         }
  68. }
  69.  
  70. item script sentryitem{
  71.     void run(int scriptNum, int magic){
  72.                 if(CountFFCsRunning(scriptNum) == 0 && Link->MP >= magic){
  73.                         RunFFCScript(scriptNum,NULL);
  74.                         Link->MP -= magic;     
  75.                 }
  76.     }
  77. }
clone this paste RAW Paste Data