Jump to content

Photo

Basic (and terrible) Chain Knight Enemy


  • Please log in to reply
4 replies to this topic

#1 ThunderSpeed

ThunderSpeed

    Initiate

  • Members
  • Real Name:Katelynn
  • Location:Scottsville, NY (Rochester area)

Posted 20 February 2008 - 09:40 PM

Those who've looked at my quest topic have seen this guy in a screenshot. However, he is rather terrible, as I don't know how to make enemies. I'll release what I've got on him so others can continue my work and improve him.

CODE

ffc script BallChainKnight {
  void run(int ThisFFC, int SynthX, int SynthY) {
    ffc Ball;
    float X = SynthX; float Y = SynthY;
    int LinkX; int LinkY;
    int action = 0;
    int radius = 24; int ballx = X; int bally = Y; float balldir = 0;
    npc BallKnight = Screen->CreateNPC(184);
    Ball = Screen->LoadFFC(ThisFFC+1);
    npc ChainBall = Screen->CreateNPC(185);

    while(BallKnight->isValid()) {  // While the Ball Knight is still alive
      ballx = X+RadianCos(balldir)*radius;
      bally = Y-RadianSin(balldir)*radius;
      balldir+=0.15;  // this and the 2 lines above do the trig work needed to make this move in a circle. increase this to increase speed.
      Ball->X=ballx;
      Ball->Y=bally;
      ChainBall->X=ballx;
      ChainBall->Y=bally;
      Ball->Data=895;
      this->Data=893;
      this->X=X;
      this->Y=Y;
      

      //check actions
      if (X > Link->X+64 && action==1) {
        action=0;
      }
      if (X < Link->X-64 && action==1) {
        action=0;
      }
      if (Y > Link->Y+64 && action==1) {
        action=0;
      }
      if (Y < Link->Y-64 && action==1) {
        action=0;
      }

      if (X > Link->X+64 && action!=1) {
        X-=0.5;
    if (X > Link->X+64) {
      action = 0;
    }
    else {
      action = 1;
    }
      }
      if (X < Link->X-64 && action!=1) {
        X+=0.5;
    if (X < Link->X-64) {
      action = 0;
    }
    else {
      action = 1;
    }
      }
      if (Y > Link->Y+64 && action!=1) {
        Y-=0.5;
    if (Y > Link->Y+64) {
      action = 0;
    }
    else {
      action = 1;
    }
      }
      if (Y < Link->Y-64 && action!=1) {
        X+=0.5;
    if (Y < Link->Y-64) {
      action = 0;
    }
    else {
      action = 1;
    }
      }
      if (action==1 && radius<=64) {
        radius+=1;
      }
      if (action==0 && radius>=24) {
        radius-=1;
      }
      
      BallKnight->X=X;
      BallKnight->Y=Y;
      Waitframe();
    }
  }
}


I should probably go through and try to comment a bit of it, but I can't be bothered. I'm too busy with other stuff to do that. Those who know how to script should be able to pick this apart though.

http://thunderspeed....nKnightDemo.zip

Edited by ThunderSpeed, 20 February 2008 - 10:04 PM.


#2 LostInHyru1e

LostInHyru1e

    Can you take me as far as PureZC?

  • Members
  • Real Name:Lost
  • Location:Refer to Screename

Posted 20 February 2008 - 09:56 PM

Could we see a video of him in action?

#3 ThunderSpeed

ThunderSpeed

    Initiate

  • Members
  • Real Name:Katelynn
  • Location:Scottsville, NY (Rochester area)

Posted 20 February 2008 - 10:03 PM

Oh, right, I forgot, I made a demo for this awhile back.

http://thunderspeed....nKnightDemo.zip

There you go.

#4 Joe123

Joe123

    Retired

  • Members

Posted 21 February 2008 - 02:44 AM

If it's of any use, _L_ made this a while back:
CODE
//
// "Ball and Chain Trooper"
// Attach this to the Ball FFC.
// Flags:
// * Changer (so that it is invisible when the screen scrolls in).
//
// d0: ID of the enemy to create.
// d1: speed of rotation.
// d2: x radius of ellipse.
// d3: y radius of ellipse.
//
ffc script BallChainTrooper1
{
  void run(int enemynum, int speed, int xradius, int yradius) {
    this->Flags[FFCF_CHANGER] = false; // Make visible
    int clk = 0;
    npc trooper = Screen->CreateNPC(enemynum);
    trooper->X = this->X;
    trooper->Y = this->Y;
    while(trooper->isValid()) {
      clk++;
      //
      this->X = trooper->X + Cos(clk*speed) * xradius;
      this->Y = trooper->Y - Sin(clk*speed) * yradius;
      // Replace the 17 in the next line with the desired colour number for your quest.
      Screen->Line(3, this->X+8, this->Y+8, trooper->X+8,trooper->Y+8,17,1,0,0,0,128);
      Waitframe();
    }
    this->Data = 0;
  }
}


Although it's probably not, because it looks more simplistic than yours.

#5 C-Dawg

C-Dawg

    Magus

  • Members

Posted 24 February 2008 - 02:47 PM

Everyone keeps forgetting what I'm doing over at AGN.

The Zodiac quest I'm making is unpassworded and chock full of custom enemy scripts. They all follow the same format and should fairly easy to modify if you look at them closely.

I wonder if I should post a guide to the handy-dandy custom enemy script so you folks understand how to modify it...?


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users