User Tag List

Results 1 to 5 of 5

Thread: Changing the FFC's Combo in a Script

  1. #1
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.93%

    Changing the FFC's Combo in a Script

    How is this accomplished? I've tried loading values into this->Data, such as:

    this->Data = this->Data + 1;

    And it compiles, but has no effect on changing the combo associated with the FFC.

  2. #2
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,433
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.1%

    Re: Changing the FFC's Combo in a Script

    It doesn't? It should. You're doing it right. Are you sure the statement's being executed?

  3. #3
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.93%

    Re: Changing the FFC's Combo in a Script

    Well, here's the script:

    // ================================================== ====================
    // Charging_Bull: The FFC will move horizontally back and forth until it is lined up with Link.
    // Once it's lined up, it will charge towards Link until it hits a solid combo. It will then
    // be stunned and pause for a moment before reviving and resuming the same movement.
    // ================================================== ====================

    ffc script charging_bull {

    void run() {

    // CONSTANTS (use to change FFC behavior without modifying code)
    int charge_sound = 13; // The sound played when the FFC charges
    int slam_sound = 13; // The sound played when the FFC hits a solid combo
    int stun_tics = 60; // The number of tics for which the FFC will be stunned.
    int patrol_speed = 1; // The speed at which the FFC moves horizontally back and forth.

    // VARIABLES (used by the code; do not change)
    int stun_counter = 0; // The countdown to when the FFC will move again.
    int accel = 0; // The FFC's current accelleration
    int state = 0; // Determines the state of the FFC.
    // 0 = Moving horizontally to the right
    // 1 = Moving horizontally to the left
    // 2 = Charging north
    // 3 = Charging south
    // 4 = Stunned

    int combo = this->Data; // combo used by the charging_bull

    while (true){

    // Moving horizontally to the right.

    if (state == 0) {

    if (Link->Y > this->Y){
    this->Data = combo;
    }
    else{
    this->Data = combo + 3;
    }

    // Check to see if FFC is lined up with Link. If so,
    // switch behavior to charge in the appropriate direction.

    if (Abs(Link->X - this->X)<16){

    Game->PlaySound(charge_sound);
    if (Link->Y < this->Y) { this->Vx = 0; state = 2; }
    else {this->Vx = 0; state = 3;}

    }

    // If not lined up with Link, move right.

    else{this->Vx = patrol_speed;}

    // If the FFC can't move to the right anymore, switch state
    // and move to the left.

    if (!canMove(this->X + 16, this->Y)){state = 1;}
    }

    if (state == 1) {


    if (Link->Y > this->Y){
    this->Data = combo;
    }
    else{
    this->Data = combo + 3;
    }

    // Check to see if FFC is lined up with Link. If so,
    // switch behavior to charge in the appropriate direction.

    if (Abs(Link->X - this->X)<16){

    Game->PlaySound(charge_sound);
    if (Link->Y < this->Y) { this->Vx = 0; state = 2; }
    else {this->Vx = 0; state = 3;}
    }

    // If not lined up with Link, move left.

    else{this->Vx = -patrol_speed;}

    // If the FFC can't move to the right anymore, switch state
    // and move to the left.

    if (!canMove(this->X - 16, this->Y)){state = 0;}

    }

    if (state == 2) {

    // Charging NORTH

    this->Data = combo + 4;

    // Accelerate up to 1.5px/sec, then jump to 2px/sec.
    // Easy way to keep the trap centered on tiles.

    if(accel<1.5){

    accel=accel+0.1;
    this->Y=this->Y-accel;
    }
    else {accel=2;}

    // Once at maximum speed, every time the trap's
    // centered on a tile, check whether it can
    // continue moving. If not, then stop.

    if(this->Y%16==0){

    if(!canMove(this->X, this->Y-16)){

    Game->PlaySound(slam_sound);
    this->Data = combo + 8;
    state = 4;
    accel = 0;
    stun_counter = stun_tics;

    }
    else{
    this->Y=this->Y-accel;
    }
    }
    else{
    this->Y=this->Y-accel;
    }
    }

    if (state == 3) {

    // Charging SOUTH

    this->Data = combo + 2;

    // Accelerate up to 1.5px/sec, then jump to 2px/sec.
    // Easy way to keep the trap centered on tiles.

    if(accel<1.5){

    accel=accel+0.1;
    this->Y=this->Y+accel;
    }
    else {accel=2;}

    // Once at maximum speed, every time the trap's
    // centered on a tile, check whether it can
    // continue moving. If not, then stop.

    if(this->Y%16==0){

    if(!canMove(this->X, this->Y+16)){

    Game->PlaySound(slam_sound);
    this->Data = combo +5;
    state = 4;
    stun_counter = stun_tics;
    accel = 0;
    }

    else{
    this->Y=this->Y+accel;
    }
    }
    else{
    this->Y=this->Y+accel;
    }
    }

    if (state == 4) {

    // Waiting while stunned
    if (stun_counter == 0){ state = 0; }
    else {stun_counter = stun_counter - 1;}
    }

    Waitframe();

    } // End of While loop

    } // End of void run()

    // Collision detection function
    bool canMove(int x, int y){

    if(x<0 || x>240 || y<0 || y>160)

    return false;

    return Screen->ComboS[y+(x>>4)]==0;
    }

    } // End of FFC Script

    As you can see, it's supposed to switch combos when it's charging and based on it's position relative to Link. It's a miniboss, and the damage counter is taken care of by screen flags. So all this needs to do is switch between combos appropriately.

  4. #4
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,433
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.1%

    Re: Changing the FFC's Combo in a Script

    I don't know. It seems to be working just fine for me.
    Is there anything else you can think of that could possibly be interfering?

  5. #5
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.93%

    Re: Changing the FFC's Combo in a Script

    Not that I can see. There are no other combos on the screen. The damn combo just won't change. Hmm...

    EDIT - Okay, now, without changing anything, it works... sorta. The way I have it set up, when the FFC is stunned, it is a combo with a STRIKE flag attached. When you hit him at the right time, you score a hit and the secrets trigger once, reducing his health. In game, when I successfully strike the FFC at the right time, the game just freezes up. Midi continues playing, but the game crashes.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social