Jump to content

Photo

Phantom Hourglass Phantoms


  • Please log in to reply
34 replies to this topic

#1 King Harkinian

King Harkinian

    This site is still a thing?

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

Posted 01 January 2010 - 11:20 AM

I need a script that might be too hard for me to figure out myself. I need a script that makes an enemy follow a path, and if link stands too close the enemy will chase link (high homing rate). I also want that if link gets hit, he spawns where he first walked onto the screen and has lost a 1/2 of a heart. I also don't need them to teleport, or have phantom eyes call them. icon_biggrin.gif But I DO want them to only take damage from the level 4 sword (customizable?).

#2 King Harkinian

King Harkinian

    This site is still a thing?

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

Posted 04 January 2010 - 05:10 PM

I REALLY need this script! I don't need them to teleport. I just need to have an enemy follow a ffc, and if link stands in a certain range of pixels, it plays a SFX and lets the enemy attack link. I just need guards.

#3 Joe123

Joe123

    Retired

  • Members

Posted 04 January 2010 - 06:01 PM

CODE
ffc script SpawnEnemyArea{
    void run(int radius, int enemy, int spawn){
        if(spawn == 0) spawn = this;
        while(Distance(spawn->X,spawn->Y,Link->X,Link->Y) > radius) Waitframe();
        CreateNPCAt(enemy,spawn->X,spawn->Y);
        spawn->Data = 0;
    }
}


While Link is further than D0 pixels away from the ffc, nothing happens. When he enters that area, an npc with ID D1 is spawned and the ffc is removed.
If you want the effect to apply to a different ffc than the one with the script attached, set D2 to the ffc you want to use (otherwise leave it as 0).
You will have to sort out your own movement routine.

#4 King Harkinian

King Harkinian

    This site is still a thing?

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

Posted 06 January 2010 - 08:18 PM

So the enemy follows the ffc (ffc changers for path) and when links in a certain pixel range the enemy is released? If this isn't the case, what does it do (posted before testing script).

BTW, thanks for writing the script. icon_smile.gif

#5 Joe123

Joe123

    Retired

  • Members

Posted 07 January 2010 - 04:20 AM

Well, yes and no. There isn't actually an enemy until Link enters the radius of the ffc, and then one is spawned when he does - so you'd give the ffc the graphics of the enemy before Link walks into its path.
I can add in a line so that the ffc's graphic is removed when the enemy spawns if you like?

#6 King Harkinian

King Harkinian

    This site is still a thing?

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

Posted 07 January 2010 - 07:39 PM

That will be perfect! It would actually look like its leaving its post or path. Can you also make the enemy spawn where the ffc is? And make it so the ffc stops when the enemy spawns. I want it to go back to its path if it doesn't see link in a certain amount of time. BTW, So how would you set it up (If these things all get included)?

#7 Joe123

Joe123

    Retired

  • Members

Posted 08 January 2010 - 06:10 AM

The enemy already does spawn where the ffc was.
Making the enemy go back to its path would require a completely different much more complicated script.
I explained in the post with the script how to set it up.

#8 King Harkinian

King Harkinian

    This site is still a thing?

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

Posted 08 January 2010 - 05:51 PM

D1 is the spawned enemy? if not, how do you choose which enemy is spawned. I also have other questions. How long does the enemy have to not see link to go back to the ffc? Also, is there a way to make a tile that link can walk on, but enemies can't ? If is only possible by scripting I also want it that phantoms can't find link while he is on this tile. Can you please do this to? I'm so sorry if i'm asking to much. icon_frown.gif

#9 Joe123

Joe123

    Retired

  • Members

Posted 09 January 2010 - 10:33 AM

Yeah D1 is the spawned enemy.
QUOTE
Making the enemy go back to its path would require a completely different much more complicated script
(which I'm not writing).

There's a flag, 'No Enemies'. It's at the bottom of the flag list, think it might be 96.

CODE
ffc script SpawnEnemyArea{
    void run(int radius, int enemy, int spawn){
        ffc f = this;
        if(spawn != 0)  f = Screen->LoadFFC(spawn);
        while(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 ComboFI(int x, int y, int flag){
        int loc = ComboAt(x,y);
        return (Screen->ComboF[loc] == flag || Screen->ComboI[loc] == flag);
    }
}

It now won't spawn an enemy if he's on that flag.

#10 King Harkinian

King Harkinian

    This site is still a thing?

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

Posted 09 January 2010 - 05:32 PM

Wait, D1 is the enemy's ID, or its number on the screen. So once the enemy spawned it wont disapeer, or will it disapeer and the ffc will start from its original spot?

#11 Joe123

Joe123

    Retired

  • Members

Posted 09 January 2010 - 05:35 PM

It's the enemy's ID number, and once spawned the enemy is just a normal enemy and nothing else.

#12 King Harkinian

King Harkinian

    This site is still a thing?

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

Posted 09 January 2010 - 06:37 PM

The line
CODE
if(spawn == 0) spawn = this;
wont compile. It gives me the error:
CANNOT CAST FFC TO FLOAT. How do you fix this?

#13 Joe123

Joe123

    Retired

  • Members

Posted 09 January 2010 - 06:41 PM

*slaps self*
Grab it again now.

#14 King Harkinian

King Harkinian

    This site is still a thing?

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

Posted 10 January 2010 - 07:59 AM

Uhh.. the script isn't working. The enemy spawns when link is in a certain amount of pixels, but not in a straight line ( I stand behind the phantom and the enemy spawns icon_eek.gif ).

#15 Joe123

Joe123

    Retired

  • Members

Posted 10 January 2010 - 08:02 AM

As per your specification,
QUOTE
and if link stands too close the enemy will chase link

that's what it's supposed to do.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users