Jump to content

Photo

Phantom Hourglass Phantoms


  • Please log in to reply
34 replies to this topic

#16 King Harkinian

King Harkinian

    This site is still a thing?

  • Members
  • Real Name:THE KING
  • Location:Hyrule

Posted 10 January 2010 - 08:22 AM

Oh I explained alittle off. I ment that if you get it its line of sight the enemy spawns. I was alittle to vague on that explanation. icon_doh.gif

#17 Joe123

Joe123

    Retired

  • Members

Posted 10 January 2010 - 09:11 AM

CODE
ffc script SpawnEnemyLineOfSight{
    void run(int radius, int enemy, int spawn){
        ffc f = this;
        if(spawn != 0)  f = Screen->LoadFFC(spawn);
        while(!LineOfSight(f) || Distance(f->X,f->Y,Link->X,Link->Y) > radius || ComboFI(Link->X+8,Link->Y+8,CF_NOENEMY)) Waitframe();
        CreateNPCAt(enemy,f->X,f->Y);
        f->Data = 0;
    }
    bool LineOfSight(ffc f){
        float angle = RadianAngle(f->X,f->Y,Link->X,Link->Y);
        int dir = VelToDir(f);
        return ((Abs(angle) <= PI/4 && dir == DIR_RIGHT) || (Abs(angle) >= 3*PI/4 && dir == DIR_LEFT)
            || (angle >= PI/4 && angle <= 3*PI/4 && dir == DIR_UP) || (angle <= -PI/4 && angle >= -3*PI/4 && dir == DIR_DOWN));
    }
    bool ComboFI(int x, int y, int flag){
        int loc = ComboAt(x,y);
        return (Screen->ComboF[loc] == flag || Screen->ComboI[loc] == flag);
    }
    int VelToDir(ffc f){
        if(Abs(f->Vy) > Abs(f->Vx)){
            if(f->Vy < 0) return DIR_UP;
            else return DIR_DOWN;
        }else{
            if(f->Vx < 0) return DIR_LEFT;
            else return DIR_RIGHT;
        }
        return -1;
    }
}


#18 King Harkinian

King Harkinian

    This site is still a thing?

  • Members
  • Real Name:THE KING
  • Location:Hyrule

Posted 10 January 2010 - 11:18 AM

ERROR LINE 219 VARIABLE RADIUS IS UNDECLARED. icon_mad.gif icon_sweat.gif

Can you fix this?

Edited by theZCking, 10 January 2010 - 11:18 AM.


#19 Joe123

Joe123

    Retired

  • Members

Posted 10 January 2010 - 11:24 AM

Fixed.

#20 King Harkinian

King Harkinian

    This site is still a thing?

  • Members
  • Real Name:THE KING
  • Location:Hyrule

Posted 10 January 2010 - 11:36 AM

Thank you very much. icon_biggrin.gif I'm going to test it now.

#21 Joe123

Joe123

    Retired

  • Members

Posted 10 January 2010 - 11:45 AM

Just realised my angles were wrong, grab it again.

#22 King Harkinian

King Harkinian

    This site is still a thing?

  • Members
  • Real Name:THE KING
  • Location:Hyrule

Posted 10 January 2010 - 12:08 PM

It's working! But I have a question. Can the Phantoms see through solid combos?

#23 Joe123

Joe123

    Retired

  • Members

Posted 10 January 2010 - 12:33 PM

Yes.

#24 King Harkinian

King Harkinian

    This site is still a thing?

  • Members
  • Real Name:THE KING
  • Location:Hyrule

Posted 11 January 2010 - 04:27 PM

I have a problem. The phantoms see link when he is to the left and right of the ffc. Can you make it so you can switch which directions ( turn left and right into up and down) or write a script for these phantoms?

#25 Joe123

Joe123

    Retired

  • Members

Posted 11 January 2010 - 06:36 PM

IPB Image
The ffc is the black circle, and the big circle is it's radius of vision.
When it's facing up, it can see the blue area. Down is red, left is yellow and right is green. If the script is doing anything differently from this, it's going wrong.

#26 King Harkinian

King Harkinian

    This site is still a thing?

  • Members
  • Real Name:THE KING
  • Location:Hyrule

Posted 11 January 2010 - 07:07 PM

It's going wrong. When the ffc moves up or down, I can walk right through it without being seen (I now use this problem to skip the phantom when testing the level. I guess the phantom has terrible eyesight. icon_lol.gif)! I think there is a problem somewhere in the pixel range/ radius/ direction area. But it could be ANYWHERE in the script.

#27 Joe123

Joe123

    Retired

  • Members

Posted 12 January 2010 - 05:12 AM

Is your phantom moving?

#28 King Harkinian

King Harkinian

    This site is still a thing?

  • Members
  • Real Name:THE KING
  • Location:Hyrule

Posted 12 January 2010 - 03:48 PM

Yeah it is. It has a Y speed of 1, and then I set up some ffc changers tom change its path.

#29 Joe123

Joe123

    Retired

  • Members

Posted 12 January 2010 - 04:20 PM

Well I had up and down the wrong way round so try it again now. That doesn't sound like your issue though.

#30 Sheik

Sheik

    Deified

  • Members

Posted 12 January 2010 - 04:23 PM

QUOTE(Joe123 @ Jan 12 2010, 12:36 AM) View Post

IPB Image
The ffc is the black circle, and the big circle is it's radius of vision.
When it's facing up, it can see the blue area. Down is red, left is yellow and right is blue. If the script is doing anything differently from this, it's going wrong.

...and right is green. ...Right? Otherwise I'm confused. Not that I really understand it =p


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users