Jump to content

Photo

Item spawn on secrets


  • Please log in to reply
7 replies to this topic

#1 klop422

klop422

    Guess I'm full of monsters and treasure

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

Posted 26 September 2019 - 08:43 AM

Hi, just a little script required.

Basically I just want the item to not be present when you enter the screen but to appear when secrets are triggered.

Or maybe I'm dumb and didn't realise this was a thing already.


  • ChrisHunter64 likes this

#2 ChrisHunter64

ChrisHunter64

    average everyday normal guy

  • Members

Posted 26 September 2019 - 04:02 PM

Might be a dumb work around but from what ive read all of you guys are using enemies to trigger things so it might be possible to put an enemy under an overhead combo and when you defeat the enemy or "activate the secret" it can make the item appear using the enemy->item flag
Or use a script cause that would be hella easier
Too many things that should be included must be worked around doing the most complicated weirdest ways ive noticed.

#3 klop422

klop422

    Guess I'm full of monsters and treasure

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

Posted 26 September 2019 - 04:38 PM

Yeah, I thought of that, and if this doesn't work, then I'll probably do that.


  • ChrisHunter64 likes this

#4 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 28 September 2019 - 08:50 AM

Use a treasure chest combo. Make it appear with secrets, via Enemies->Secret.



#5 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 28 September 2019 - 12:36 PM

It's actually funny how after 10 years this script still doesn't exist for public use.

 

I'll post it when I'm not distracted and if no one beats me to it.


Edited by Avaro, 28 September 2019 - 12:37 PM.

  • Jared likes this

#6 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 30 September 2019 - 12:54 AM

ffc script secretitemff
{
	void run(int theItemID, int reg)
	{
		while(!Screen->State[ST_SECRETS])
		{
			Waitframe();
		}
		if (Screem->D[reg]&1) { Quit(); }
		item theItem = Screen->CreateItem(theItemID);
		theItem->X = this->X;
		theItem->Y = this->Y;
		//if version >= 2.55, uncomment the next two lines
		//theItem->PScript = Game->GetItemScript("collected_scrmsg");
		//theItem->InitD[0] = reg;
		Quit()
	}
}

item script collected_scrmsg
{
	void run(int reg)
	{
		Screen->D[reg] |= 1;
	}
}
 
Script requests should specify the ZC version being used. I'm leaving this one as-is until I know more, but in 2.55 you can set a flag with an item collect script in an automated manner that messages back to the ffc script that it shouldn't create the item again, in the future.

This should do the same for 2.53, but it is possible to glitch it with frame-advance and F6.
 
ffc script secretitemff
{
	void run(int theItemID, int reg)
	{
		while(!Screen->State[ST_SECRETS])
		{
			Waitframe();
		}
		if (Screem->D[reg]&1) { Quit(); }
		item theItem = Screen->CreateItem(theItemID);
		theItem->X = this->X;
		theItem->Y = this->Y;
		theItem->Misc[12] = 12345.6789;
		bool quit;
		while(1)
		{
			quit = true;
			for ( int q = Screen->NumItems(); q > 0; --q )
			{
				item testItem = Screen->LoadItem(q);
				if ( testItem->Misc[12] == 12345.6789 ) quit = false;
			}
			if ( quit ) 
			{
				Screen->D[reg] |= 1;
				break;
			}
			Waitframe();
		}
		Quit()
	}
}

  • ShadowTiger likes this

#7 klop422

klop422

    Guess I'm full of monsters and treasure

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

Posted 30 September 2019 - 08:04 AM

Thanks!

Sorry, yeah, meant it for 2.53

 

The top one should work, right? Can't check for a few hours. Any specific setup needed or is it just setting the ffc script on the screen where I put the item?



#8 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 02 October 2019 - 01:16 AM

Thanks!

Sorry, yeah, meant it for 2.53

 

The top one should work, right? Can't check for a few hours. Any specific setup needed or is it just setting the ffc script on the screen where I put the item?

 

You want the bottom one in 2.53. The top one, in 2.53, would require placing that collect script on the item, whereas the bottom one is only the ffc script and no extra set-up: It just uses far more instructions.

 

Position the ffc where you want the item to spawn.

 

 

 

It's actually funny how after 10 years this script still doesn't exist for public use.

 

I'll post it when I'm not distracted and if no one beats me to it.


 

I'd be curious how much these differ from whatever you wrote.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users