Jump to content

Photo

FFC Request


  • Please log in to reply
5 replies to this topic

#1 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 06 July 2018 - 03:38 PM

Enemy IDs listed in the arguments have no hitbox. (Whether it's disabled or way off-screen)



#2 klop422

klop422

    Guess I'm full of monsters and treasure

  • Members
  • Real Name:Not George
  • Location:Planet Earth

Posted 06 July 2018 - 05:12 PM

I got one from Zoria a bit back:

ffc script IgnoreNPC{
    void run (int npc_id){
        Waitframes(5);
        while(true){
            for ( int q = Screen->NumNPCs(); q > 0; q-- ) {
                npc n = Screen->LoadNPC(q);
                if ( n->ID == npc_id ) {
                    n->CollDetection = false;
                    continue;
                }
            }
            Waitframe();
        }
    }
}

Don't know if it works for more than one enemy onscreen (haven't needed it for that :/).

I believe it works by moving the hitbox offscreen, meaning you can't affect the enemy either.


  • Cukeman likes this

#3 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 10 July 2018 - 04:32 PM

Wonderful! And it does work for multiple enemies of the same ID. Thank you!



#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 11 July 2018 - 07:42 AM

For grins, this should allow up to eight npc IDs.
 
ffc script IgnoreNPCs
{
	void run()
	{
		Waitframes(5);
		while(true)
		{
			for ( int q = Screen->NumNPCs(); q > 0; --q ) 
			{
				npc n = Screen->LoadNPC(q);
				for ( int w = 0; w < 8; ++w )
				{
					if ( n->ID == this->InitD[w] )
					{
						n->CollDetection = false;
					}
				}
				
			}
			Waitframe();
		}
            
        }
}


P.S. The continue instruction in the prior script has no purpose, as the loop continues at where it was placed anyway.

It probably has no effect on the resulting ASM. I'm only mentioning it, as some might think it's mandatory for some reason. I don't know why I put it there, unless I had a condition that I inverted and forgot to remove it.
 
for ( int a = 0; a < 4; ++a )
{
    do_something();
//end of loop, so it continues back to its start}

for ( int b = 0; b < 4; ++b )
{
    do_something();
    continue; //superfluous
}


You want to use the continue instruction to prematurely return to the start of a loop.

 
for ( int a = 0; a < 4; ++a )
{
    if (!condition ) continue; // instructions after this will not 
                               // run if the condition evaluates true.
    do_something(); // Runs if the continue condition evaluates false.

}



My guess, is that I originally had:
 
ffc script IgnoreNPC
{
	void run(int npc_id)
	{
		Waitframes(5);
		while(true)
		{
			for ( int q = Screen->NumNPCs(); q > 0; --q ) 
			{
				npc n = Screen->LoadNPC(q);
				
				if ( n->ID != npc_id ) continue;
				n->CollDetection = false;

				
			}
			Waitframe();
		}
            
        }
}
(Note that this would have the same effect.)



If not that, then perhaps I had another condition in there (that I removed), or I was drunk when I wrote it. Any of these are plausible.

I know that it's mine, as it has a signature style element that no-one-else here uses. Can you spot it?

Further, I know approximately when I must've made that, due to two other choices: One logical that I've since refined, and the other a style choice that I've since changed.

#5 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 11 July 2018 - 07:45 AM

Wait, so in the original script, how many enemies of the same Enemy ID does the script handle at once?



#6 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 11 July 2018 - 07:58 AM

Wait, so in the original script, how many enemies of the same Enemy ID does the script handle at once?

Wait, so in the original script, how many enemies of the same Enemy ID does the script handle at once?


As many as exist on the screen.

The revision supports up to eight IDs: One for each D* arg.
  • Cukeman likes this


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users