Jump to content

Photo

Sentry Gun Script


  • Please log in to reply
11 replies to this topic

#1 NineLives

NineLives

    Boom. Zoom. Dakota.

  • Members
  • Location:Los Angeles, California

Posted 12 November 2007 - 01:55 PM

Can anyone make a script (gleeok icon_biggrin.gif)
that an enemy stays still, and has a line of sight, and if you enter the line of sight, the sentry fire rapidly and repeatedly.
And, you can still get hurt if your invinsable. (or however you spell it)

I also want four scripts, one facing up, down, right, and left

#2 C-Dawg

C-Dawg

    Magus

  • Members

Posted 13 November 2007 - 11:21 PM

You don't need four scripts. One will fire in all directions you wish.

This is already in Zodiac at AGN. Check the GUN script for one bullet firing. There's a rapid_fire_gun script as well that can have six bullets on the screen at once.

#3 NineLives

NineLives

    Boom. Zoom. Dakota.

  • Members
  • Location:Los Angeles, California

Posted 14 November 2007 - 06:50 PM

nono
I mean, I just want it to face ONE DIRECTION ONLY
JUST ONE DIRECTION
and thats facing east, west, north, or south.

not facing all directions at the same time, that's stupid.

#4 C-Dawg

C-Dawg

    Magus

  • Members

Posted 14 November 2007 - 07:56 PM

Huh. I guess now I remember why I usually stick to AGN.

The scripts I'm referring to will only fire in user-defined directions. That is, when you set up the FFC running the script, you can tell it to fire N, S, E, or W, or any number of them.

In other words, the scripts do exactly what you want. They will fire "in any direction you wish," as I said in my last post.

#5 NineLives

NineLives

    Boom. Zoom. Dakota.

  • Members
  • Location:Los Angeles, California

Posted 14 November 2007 - 11:32 PM

ph.
ok.
anyway.
thanks.

#6 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 17 November 2007 - 08:36 AM

Well I made a very similar script in ways...It's not exactally the same but it's pretty neat. I can easily modify it to be stationary though.

http://www.armageddo...threadid=100268

#7 NineLives

NineLives

    Boom. Zoom. Dakota.

  • Members
  • Location:Los Angeles, California

Posted 17 November 2007 - 10:56 AM

err, can you give me some specific instructions on how to set up the sentry?
I'm not really smart on how to set the D;s in the freeform combos.

Meaning, I don't know which number means what.

#8 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 18 November 2007 - 03:33 AM

Huh, which ones?

Link walks about at 1.2 speed, ffc combo number will use ffc's starting at that number, 0 = off, 1 = on. I'll have time later to mess with the script. Just say in that thread what you'd like to add to the script, and i'll get to it by monday probably.

#9 NineLives

NineLives

    Boom. Zoom. Dakota.

  • Members
  • Location:Los Angeles, California

Posted 18 November 2007 - 12:32 PM

nonono.
I mean,

// FFC SCRIPT SENTRY---------------------------------------
//D0- vertical guard set 1
//D1- horizontal guard set 1 *NOT BOTH!!!*
//D2- set 1 if can fire weapons
//D3- combo of weapon if d2
//D4- speed of weapon projectile if d2
//D5- time in tics between shots
//D6- CSet of weapon projectile
//D7- the starting ffc to use for projectiles
//---------------------------------------------------------

I don't know what numbers to put in.
And what FFC to put those numbers in.

Meaning, What number do I put for D0? D1? D2? I just don't know.

#10 ShadowTiger

ShadowTiger

    The Doctor Is In

  • Members

Posted 18 November 2007 - 10:19 PM

They look pretty self-explanatory to me at a glance. icon_shrug.gif Tell us what you think the comments to the right mean? Might help to diagnose the confusion. (I.e. "vertical guard - 1" etc.)

#11 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 19 November 2007 - 06:38 AM

Umm well, 0 = off and 1 = on. or yes and no. I probably should reword that...

Here's something more along the lines of what you wanted though:


CODE

//==================================================================================
//                FFC SCRIPT SENTRY
//
// D0 - Direction can shoot / values greater than 3 return up,down,left,right.
// D1 - combo of weapon projectile
// D2 - speed of projectile
// D3 - CSet of projectile
// D4 - First of 3 ffc's to use as projectiles
//==================================================================================

ffc script Sentry{

    void run(int shoot_dir, int weapon_combo, int speed, int cset, int ffc_to_use){

        ffc shoot;
        int ffc_cycle = ffc_to_use;
        int delay = 0;

        while(true){

            if(ffc_cycle >= ffc_to_use+3){ ffc_cycle = ffc_to_use;}
            if(delay > 0){delay--;}
            
        
            if(shoot_dir > 3 && delay == 0){

                if(Abs(Link->X-this->X)<14 && Link->Y < this->Y && canMove(this->X, this->Y-16)) // Up
                {
                    shoot = Screen->LoadFFC(ffc_cycle);
                    shoot->Data = weapon_combo;
                    shoot->Y = this->Y - 16; shoot->X = this->X;
                    shoot->Vy = -speed; shoot->Vx=0;
                    shoot->CSet = cset;
                    ffc_cycle++;
                    delay = 30;
                }
                else if(Abs(Link->X-this->X)<14 && Link->Y > this->Y && canMove(this->X, this->Y+16)) // Down
                {
                    shoot = Screen->LoadFFC(ffc_cycle);
                    shoot->Data = weapon_combo;
                    shoot->Y = this->Y + 16; shoot->X = this->X;
                    shoot->Vy = speed; shoot->Vx=0;
                    shoot->CSet = cset;
                    ffc_cycle++;
                    delay = 30;        
                }
                else if(Abs(Link->Y-this->Y)<14 && Link->X < this->X && canMove(this->X-16, this->Y)) // Left
                {
                    shoot = Screen->LoadFFC(ffc_cycle);
                    shoot->Data = weapon_combo;
                    shoot->Y = this->Y; shoot->X = this->X - 16;
                    shoot->Vx = -speed; shoot->Vy=0;
                    shoot->CSet = cset;
                    ffc_cycle++;
                    delay = 30;            
                }
                else if(Abs(Link->Y-this->Y)<14 && Link->X > this->X && canMove(this->X+16, this->Y)) // Right
                {
                    shoot = Screen->LoadFFC(ffc_cycle);
                    shoot->Data = weapon_combo;
                    shoot->Y = this->Y; shoot->X = this->X + 16;
                    shoot->Vx = speed; shoot->Vy=0;
                    shoot->CSet = cset;
                    ffc_cycle++;
                    delay = 30;
                }
            }
            else{
                if(shoot_dir==0 && delay == 0){
                    if(Abs(Link->X-this->X)<14 && Link->Y < this->Y && canMove(this->X, this->Y-16)){
                        shoot = Screen->LoadFFC(ffc_cycle);
                        shoot->Data = weapon_combo;
                        shoot->Y = this->Y - 16; shoot->X = this->X;
                        shoot->Vy = -speed; shoot->Vx=0;
                        shoot->CSet = cset;
                        ffc_cycle++;
                        delay = 30;
                    }
                }
                else if(shoot_dir==1 && delay == 0){
                    if(Abs(Link->X-this->X)<14 && Link->Y > this->Y && canMove(this->X, this->Y+16)){
                        shoot = Screen->LoadFFC(ffc_cycle);
                        shoot->Data = weapon_combo;
                        shoot->Y = this->Y + 16; shoot->X = this->X;
                        shoot->Vy = speed; shoot->Vx=0;
                        shoot->CSet = cset;
                        ffc_cycle++;
                        delay = 30;
                    }        
                }
                else if(shoot_dir==2 && delay == 0){
                    if(Abs(Link->Y-this->Y)<14 && Link->X < this->X && canMove(this->X-16, this->Y)){
                        shoot = Screen->LoadFFC(ffc_cycle);
                        shoot->Data = weapon_combo;
                        shoot->Y = this->Y; shoot->X = this->X - 16;
                        shoot->Vx = -speed; shoot->Vy=0;
                        shoot->CSet = cset;
                        ffc_cycle++;
                        delay = 30;
                    }
                }
                else if(shoot_dir==3 && delay == 0){
                    if(Abs(Link->Y-this->Y)<14 && Link->X > this->X && canMove(this->X+16, this->Y)){
                        shoot = Screen->LoadFFC(ffc_cycle);
                        shoot->Data = weapon_combo;
                        shoot->Y = this->Y; shoot->X = this->X + 16;
                        shoot->Vx = speed; shoot->Vy=0;
                        shoot->CSet = cset;
                        ffc_cycle++;
                        delay = 30;
                    }
                }
            }
        Waitframe();
        }
    }                        
    bool canMove(int x, int y)
    {
        if(x<0 || x>240 || y<0 || y>160)
            return false;
        
        return Screen->ComboS[y+(x>>4)]==0;
    }
}



I'll even auto set these for you

// D0 - 0-up, 1-down, 2- left, 3- right, 4 - shoot all
// D1 - id of combo
// D2 - 3.2
// D3 - CSet of projectile
// D4 - First of 3 ffc's to use as projectiles ..ex 10, for 2cd ffc use, 13...then 16, 19 etc....


#12 NineLives

NineLives

    Boom. Zoom. Dakota.

  • Members
  • Location:Los Angeles, California

Posted 19 November 2007 - 08:23 PM

Thanks!


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users