Jump to content

Photo

Armos Knights Help


  • Please log in to reply
2 replies to this topic

#1 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 03 August 2011 - 12:05 PM

Here's the script.

CODE
ffc script ArmosKnight{
    void run(int enemy_id, int position){
        while(Screen->NumNPCs() == 0) Waitframe();
        npc enemy = CreateNPCAt(enemy_id, this->X, this->Y);
        int smallradius = enemy->Attributes[0];
        int largeradius = enemy->Attributes[1];
        int speed = enemy->Attributes[2];
        int wait = enemy->Attributes[3];
        int CSet2 = enemy->Attributes[4];
        int height = enemy->Attributes[5];
        int angle = 60 * position;
        int timer;
        while(enemy->isValid() && NumNPCsOf(enemy_id) > 1){
            enemy->Misc[1] = enemy->X;
            enemy->Misc[2] = enemy->Y;
            if(enemy->Misc[0] == 0) FormCircle(enemy, largeradius, angle);
            else if(enemy->Misc[0] == 1 || enemy->Misc[0] == 4 || enemy->Misc[0] == 7){
                while(enemy->isValid() && NumNPCsOf(enemy_id) > 1){
                    for(int i = 1; i <= NumNPCsOf(enemy_id); i++){
                        npc e = LoadNPCOf(enemy_id, i);
                        if(e->Misc[0] == 0 || e->Misc[0] == 3 || e->Misc[0] == 6){
                            Waitframe();
                            continue;
                        }
                    }
                    enemy->Misc[0]++;
                    break;
                }
            }
            else if(enemy->Misc[0] == 2){
                Waitframes(wait);
                timer = Rand(120,180);
                while(enemy->isValid() && NumNPCsOf(enemy_id) > 1 && timer > 0){
                    CircularMovement(enemy, largeradius, angle, speed);
                    angle %= 360;
                    angle++;
                    timer--;
                    Waitframe();
                }
                enemy->Misc[0]++;
            }
            else if(enemy->Misc[0] == 3) FormCircle(enemy, smallradius, angle);
            else if(enemy->Misc[0] == 5){
                timer = Rand(120,180);
                while(enemy->isValid() && NumNPCsOf(enemy_id) > 1 && timer > 0){
                    CircularMovement(enemy, smallradius, angle, speed);
                    angle %= 360;
                    angle++;
                    timer--;
                    Waitframe();
                }
                enemy->Misc[0]++;
            }
            else if(enemy->Misc[0] == 6) FormLine(enemy, position);
            else if(enemy->Misc[0] == 8){
                Waitframes(wait);
                LinearMovement(enemy);
            }
           Wait(frame);
        }
        if(enemy->isValid()){
            enemy->CSet = CSet2;
            Waitframes(wait);
            while(enemy->isValid()){
                Stomp(enemy, height, wait);
                Waitframes(wait);
            }
        }
        else Quit();
        npc trigger = LoadNPCOf(NPC_TRIGGER);
        trigger->HP = HP_SILENT;
    }
    void FormCircle(npc enemy, int radius, int angle){
        float pointx = 120 + radius*Cos(angle);
        float pointy = 80 + radius*Sin(angle);
        int enemy_id = enemy->ID;
        while(enemy->isValid() && NumNPCsOf(enemy_id) > 1 && (enemy->X != Round(pointx) || enemy->Y != Round(pointy))){
            enemy->Misc[1] += VectorX(enemy->Step/100, Angle(enemy->X, enemy->Y, pointx, pointy));
            enemy->Misc[2] += VectorY(enemy->Step/100, Angle(enemy->X, enemy->Y, pointx, pointy));
            enemy->X = enemy->Misc[1];
            enemy->Y = enemy->Misc[2];
            Waitframe();
        }
        enemy->Misc[0]++;
    }
    void FormLine(npc enemy, int position){
        float pointx = 32;
        float pointy = 48 + (16 * position);
        int enemy_id = enemy->ID;
        while(enemy->isValid() && NumNPCsOf(enemy_id) > 1 && (enemy->X != Round(pointx) || enemy->Y != Round(pointy))){
            enemy->Misc[1] += VectorX(enemy->Step/100, Angle(enemy->X, enemy->Y, pointx, pointy));
            enemy->Misc[2] += VectorY(enemy->Step/100, Angle(enemy->X, enemy->Y, pointx, pointy));
            enemy->X = enemy->Misc[1];
            enemy->Y = enemy->Misc[2];
            Waitframe();
        }
        enemy->Misc[0]++;
    }
    void CircularMovement(npc enemy, int radius, int angle, int speed){
        enemy->X = 120 + radius*Cos(angle*speed);
        enemy->Y = 80 + radius*Sin(angle*speed);
    }
    void LinearMovement(npc enemy){
        float pointx = 208;
        int enemy_id = enemy->ID;
        while(enemy->isValid() && NumNPCsOf(enemy_id) > 1 && (enemy->X != Round(pointx))){
            enemy->Misc[1] += enemy->Step/100;
            enemy->X = enemy->Misc[1];
            Waitframe();
        }
        enemy->Misc[0] = 0;
    }
    void Stomp(npc enemy, int height, int wait){
        float pointx = Link->X;
        float pointy = Link->Y;
        for(int i = height; i > 0; i--){
            enemy->Z++;
            Waitframe();
        }
        while(enemy->isValid() && (enemy->X != Round(pointx) || enemy->Y != Round(pointy))){
            enemy->Misc[1] += VectorX(enemy->Step/100, Angle(enemy->X, enemy->Y, pointx, pointy));
            enemy->Misc[2] += VectorY(enemy->Step/100, Angle(enemy->X, enemy->Y, pointx, pointy));
            enemy->X = enemy->Misc[1];
            enemy->Y = enemy->Misc[2];
            Waitframe();
        }
        Waitframes(wait);
        if(enemy->isValid()){
            for(int i = height; i > 0; i--){
                enemy->Z--;
                Waitframe();
            }
        }
        if(enemy->isValid()) Game->PlaySound(SFX_HAMMER);
    }
}


The bug is that they don't wait when they're suppose to which is after they reach they're destination after a FormCircle or FormLine function. They're suppose to wait until all of them "the npcs" have reached they're destination but they're not. And it's really starting to bug me. If someone could figure this out, that would be great.

#2 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 03 August 2011 - 12:55 PM

Idea. Create a bool array for the maximum number of armos possible. Then change the value each time an armos reaches its destination. Then have a for() loop that reads the array based on the number of armos on the screen, and when they're all true, have them start moving. Actually you should check if one is false instead of all of them being true. Save a few lines of code.

Just a thought icon_shrug.gif


#3 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 03 August 2011 - 01:04 PM

QUOTE(Master Maniac @ Aug 3 2011, 11:55 AM) View Post

Idea. Create a bool array for the maximum number of armos possible. Then change the value each time an armos reaches its destination. Then have a for() loop that reads the array based on the number of armos on the screen, and when they're all true, have them start moving. Actually you should check if one is false instead of all of them being true. Save a few lines of code.

Just a thought icon_shrug.gif


Won't work because each armos has it's own ffc script.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users