Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import "ffcscript.zh"
- import "std.zh"
- //For the magic, set the tiles as - UP, DOWN, LEFT, RIGHT
- //Constants for the sentry itself
- const int sentile = 892; //Combo ID for sentry. It goes up, down, left, right
- const int sencset = 7; //CSet for sentry
- //Constants for the magic it shoots
- const int senweapon = 89; //Weapon ID for magic
- const int sendam = 4; //How much damage the magic does
- const int senspd = 500; //How fast the magic goes
- const int senmag = 8; //How much magic it uses to fire
- //Other Constants
- const int sensound = 21; //Sound for when the sentry is created
- const int magsound = 32; //Sound for when the sentry fires
- const int senbweapon = 88; //Tile for when sentry turns into a bomb
- ffc script sentry{
- void run(){
- this->X = Link->X;
- this->Y = Link->Y;
- this->Data = sentile;
- this->CSet = sencset;
- Game->PlaySound(sensound);
- while(!Link->PressB){
- //Set the direction of the sentry
- if(Link->Dir == DIR_UP) this->Data = sentile;
- else if(Link->Dir == DIR_DOWN) this->Data = sentile+1;
- else if(Link->Dir == DIR_LEFT) this->Data = sentile+2;
- else if(Link->Dir == DIR_RIGHT)this->Data = sentile+3;
- //If the player hits 'A', fire magic!
- if(Link->PressA == true && Link->MP>= senmag){
- //Create the magic weapon and fire it
- lweapon magic = Screen->CreateLWeapon(13);
- magic->X = this->X;
- magic->Y = this->Y;
- magic->UseSprite(senweapon);
- magic->Tile += Link->Dir;
- magic->Damage = sendam;
- magic->Step = senspd;
- magic->Dir = Link->Dir;
- Game->PlaySound(magsound);
- Link->MP -= senmag;
- }
- Waitframe();
- }
- //Set up the explosion
- lweapon explode = Screen->CreateLWeapon(6);
- explode->X = this->X;
- explode->Y = this->Y + 2;
- explode->UseSprite(senbweapon);
- explode->Damage = sendam;
- this->X = -16;
- this->Y = -16;
- while(explode->isValid()) Waitframe();
- this->Data = 0;
- Quit();
- }
- }
- item script sentryitem{
- void run(int scriptNum, int magic){
- if(CountFFCsRunning(scriptNum) == 0 && Link->MP >= magic){
- RunFFCScript(scriptNum,NULL);
- Link->MP -= magic;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement