Jump to content

Photo

almost done...


  • Please log in to reply
3 replies to this topic

#1 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 16 December 2008 - 03:36 PM

(removed to save space)

this isnt working at all.

I set up the item script on a wand, to activate the global script.

but... i have a feeling the two aren't linked properly. when i use the wand, absotively nothing happens.

cann anyone spot what im doing wrong?
(by the way this compiles and has been checked for syntax errors and such)

Edited by Master Maniac, 17 December 2008 - 09:32 PM.


#2 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 17 December 2008 - 05:37 PM

nevermind my last post. the script is linked properly.

HOWEVER

the vaccuum part of it isnt working properly.

the hole itself does kill the enemies though. ill give it that. just no vaccuum part to it for some reason >.<

here, this is the script itself for anyone who wants to test it out (bugs fixed and all. just the raw version)

(removed to save space)

Edited by Master Maniac, 17 December 2008 - 09:31 PM.


#3 Saffith

Saffith

    IPv7 user

  • Members

Posted 17 December 2008 - 05:58 PM

CODE
int SuctionSpeed = .5;        //amount of frames for the enemies to move, in pixels per second

Try turning that up to 1 or greater and see if something doesn't happen.

Enemy positions are truncated to integers, so adjusting them by half a pixel won't work. You can work around that, but it might be a bit tricky.

#4 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 17 December 2008 - 09:30 PM

I edited a few things and changed the number of frames per second to pull the enemies in... but then 2 things happened.

1- the graphic for the blackhole itself stopped appearing. i have no idea why.
2- the black hole effect still happened, but it only seemed to last a short time. shorter than the 5 seconds i told it to.

sooooooooo...

does anyone know what im doing wrong now?

here is the global part of the script. thats all i edited :
CODE
global script global1{

void run(){

while(true){

if(blackhole){

                    //variables for user edit below.

    int seconds_exist= 5;        //pretty obvious. the amount of time for the black hole to exist before disappearing, in seconds

    int SuctionSpeed = 5;        //amount of frames for the enemies to move, in pixels per second
    int SuctionRange = 48;        //the distance away from the hole for the enemies to be before they are sucked in.

    int blank_combo= 7126;        //any blank combo on the combo page.

    int blackhole_combo= 7124;    //ComboID for the sprite for the black hole.

    int cset=9;            //the cset for the black hole

                    //don't edit variables after this point.

    int frames_exist=seconds_exist*60;

    int exist;

    bool blackhole_existing;

    ffc blackhole_cast=Screen->LoadFFC(1);

    blackhole_cast->CSet==cset;

    if(!blackhole_existing){
        exist=0;
        blackhole_cast->Data=blank_combo;
    }
    else if(blackhole_existing){
        blackhole_cast->Data=blackhole_combo;
    }

    if(Link->Dir==DIR_UP){

        blackhole_cast->X=Link->X;
        blackhole_cast->Y=Link->Y-48;
        blackhole=false;
        blackhole_existing=true;
    }

    if(Link->Dir==DIR_DOWN){

        blackhole_cast->X=Link->X;
        blackhole_cast->Y=Link->Y+32;
        blackhole=false;
        blackhole_existing=true;

    }

    if(Link->Dir==DIR_LEFT){

        blackhole_cast->X=Link->X-48;
        blackhole_cast->Y=Link->Y;
        blackhole=false;
        blackhole_existing=true;

    }

    if(Link->Dir==DIR_RIGHT){

        blackhole_cast->X=Link->X+32;
        blackhole_cast->Y=Link->Y;
        blackhole=false;
        blackhole_existing=true;

    }

    while(blackhole_existing){
        exist++;

        if(exist==frames_exist){
            blackhole_existing=false;
        }
        else if(exist<frames_exist){

        for(int i=1;i<=Screen->NumNPCs();i++){
            npc e = Screen->LoadNPC(i);
            if((Distance(blackhole_cast->X,blackhole_cast->Y,e->X,e->Y) <= SuctionRange)){
                int m;

                if(blackhole_cast->X-e->X != 0) m = (blackhole_cast->Y-e->Y)/(blackhole_cast->X-e->X);

                if(blackhole_cast->X-e->X > 0) e->X += SuctionSpeed;

                else e->X = e->X - SuctionSpeed;

                int c = e->Y-m*e->X;

                e->Y = m*e->X+c;

                if(e->X>=blackhole_cast->X-8&&e->X<=blackhole_cast->X+8&&e->Y>=blackhole_cast->Y-8&&e->Y<=blackhole_cast->Y+8){

                    e->HP=0;
                }
            }
        }
    }
}
}
Waitframe();
}
}
}



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users