Jump to content

Photo

Give Link Item (while on Combo)


  • Please log in to reply
16 replies to this topic

#1 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 16 February 2016 - 06:34 PM

I would like to request a FFC script that quietly adds an item to Link's inventory as long as Link is standing on a combo (and takes it away if he is not). D0 being the item number, and D1 being the combo number.

 

I'm planning to use tile modification to change Link's appearance while he is walking on certain combos. Thank you for anyone willing to make this.



#2 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 16 February 2016 - 08:01 PM

import "std.zh"

/////////////////////////
//Give Item If On Combo//
/////////////////////////

//D0: Item ID to give
//D1: Combo to check for
//D2: SFX upon receiving the item (leave at 0 to turn off)
//D3: Give the Item if Link's in the air? (leave at 0 for yes, 1 or higher otherwise)
//D4: SFX upon losing the item (leave at 0 to turn off)

ffc script ComboTileModifier
{
	
	void run(int itemid, int comboid, int SFXON, int inair, int SFXOFF)
	{
		
		while (true)
		{
			
			if (ComboD[ComboAt(Link->X + 8, Link->Y + 8)] == comboid && (inair < 1 || Link->Z <= 0)) //If on the combo
			{
				if (Link->Item[itemid] == false) //Check to see if he doesn't have the item currently. Prevents lag from giving an item every second.
				{
					if (SFXON > 0) Game->PlaySound(SFXON); //Play sound if applicable.
					Link->Item[itemid] = true; //Give him the item.
				}
			}
			
			else //If not on the combo
			{
				if (Link->Item[itemid] == true) //Check to see if he has the item currently. Prevents lag from losing an item every second.
				{
					if (SFXOFF > 0) Game->PlaySound(SFXOFF); //Play sound if applicable
					Link->Item[itemid] = false; //Lose the item.
				}
			}
			Waitframe();
		}
	}
}

  • Cukeman likes this

#3 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 16 February 2016 - 09:35 PM

Oh shoot, I forgot to mention that Link's 'A' and 'B' buttons should be disabled while he is on the combo. Can you add that? Sorry.



#4 coolgamer012345

coolgamer012345

    🔸

  • Members
  • Location:Indiana, USA

Posted 16 February 2016 - 11:30 PM

Oh shoot, I forgot to mention that Link's 'A' and 'B' buttons should be disabled while he is on the combo. Can you add that? Sorry.

 

Patched it in:

import "std.zh"

/////////////////////////
//Give Item If On Combo//
/////////////////////////

//D0: Item ID to give
//D1: Combo to check for
//D2: SFX upon receiving the item (leave at 0 to turn off)
//D3: Give the Item if Link's in the air? (leave at 0 for yes, 1 or higher otherwise)
//D4: SFX upon losing the item (leave at 0 to turn off)

ffc script ComboTileModifier
{
	
	void run(int itemid, int comboid, int SFXON, int inair, int SFXOFF)
	{
		
		while (true)
		{
			
			if (ComboD[ComboAt(Link->X + 8, Link->Y + 8)] == comboid && (inair < 1 || Link->Z <= 0)) //If on the combo
			{
				if (Link->Item[itemid] == false) //Check to see if he doesn't have the item currently. Prevents lag from giving an item every second.
				{
					if (SFXON > 0) Game->PlaySound(SFXON); //Play sound if applicable.
				        Link->Item[itemid] = true; //Give him the item.
				}
                                
                                Link->InputA = false;
                                Link->InputB = false;
			}
			
			else //If not on the combo
			{
				if (Link->Item[itemid] == true) //Check to see if he has the item currently. Prevents lag from losing an item every second.
				{
					if (SFXOFF > 0) Game->PlaySound(SFXOFF); //Play sound if applicable
					Link->Item[itemid] = false; //Lose the item.
				}
			}
			Waitframe();
		}
	}
}

Edited by Coolgamer012345, 16 February 2016 - 11:31 PM.

  • Cukeman and Deedee like this

#5 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 02 March 2016 - 03:07 AM

 

Patched it in:

import "std.zh"

/////////////////////////
//Give Item If On Combo//
/////////////////////////

//D0: Item ID to give
//D1: Combo to check for
//D2: SFX upon receiving the item (leave at 0 to turn off)
//D3: Give the Item if Link's in the air? (leave at 0 for yes, 1 or higher otherwise)
//D4: SFX upon losing the item (leave at 0 to turn off)

ffc script ComboTileModifier
{
	
	void run(int itemid, int comboid, int SFXON, int inair, int SFXOFF)
	{
		
		while (true)
		{
			
			if (ComboD[ComboAt(Link->X + 8, Link->Y + 8)] == comboid && (inair < 1 || Link->Z <= 0)) //If on the combo
			{
				if (Link->Item[itemid] == false) //Check to see if he doesn't have the item currently. Prevents lag from giving an item every second.
				{
					if (SFXON > 0) Game->PlaySound(SFXON); //Play sound if applicable.
				        Link->Item[itemid] = true; //Give him the item.
				}
                                
                                Link->InputA = false;
                                Link->InputB = false;
			}
			
			else //If not on the combo
			{
				if (Link->Item[itemid] == true) //Check to see if he has the item currently. Prevents lag from losing an item every second.
				{
					if (SFXOFF > 0) Game->PlaySound(SFXOFF); //Play sound if applicable
					Link->Item[itemid] = false; //Lose the item.
				}
			}
			Waitframe();
		}
	}
}

 

 

"Error S09: Variable ComboD is Undeclared"

(line 22)


Edited by Cukeman, 02 March 2016 - 03:08 AM.


#6 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 02 March 2016 - 03:09 AM

Replace "ComboD" with "Screen->ComboD".


  • Cukeman likes this

#7 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 02 March 2016 - 03:29 AM

Ah! This script is amazing! Thanks everyone!  :omg:  :drool:  :D



#8 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 10 March 2016 - 02:46 PM

I've noticed something about this script which I'm not sure about.
 
I'm testing this script by giving and taking a Blue Ring from Link.
 
If I run the script at Screen Init, then Link turns blue while the screen is scrolling (if combo D1 is onscreen), which is a good thing if the first combo Link lands on is the one specified in D1, but it's not a good thing otherwise. D1 may or may not be the first combo Link lands on depending which side of the screen he enters from... I don't know if there's a solution to this.
 
EDIT: Actually, when I think about the way I'm going to use this script, it shouldn't be a problem at all :)


Edited by Cukeman, 17 April 2016 - 07:33 AM.


#9 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 17 April 2016 - 04:15 AM

Hm. As I was testing various things in my quest and changing around the different screens Link begins on, I stumbled upon a game-freezing issue.

 

When I opened up the file in Zelda Classic, and the first screen Link appeared on was running one instance of "ComboTileMod" and two instances of "CreateItem" the game froze. If I change the DMap continue point (to a screen not running those scripts) that doesn't happen.

 

Not sure if I'll ever be running either of those scripts on a continue point screen or not, but there might be some scripting error worth looking into.

 

script


Edited by Cukeman, 17 April 2016 - 04:57 AM.


#10 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 17 April 2016 - 04:50 AM

A few questions:

When you say the game froze, do you mean that all gameplay stopped and it no longer accepted input, but music kept playing? And what arguments to the FFC scripts did you use, and what init data for Link's items did you have that might have been relevant? I can't see any infinite loops that would have caused this, and it's not freezing on a test quest that recreates the situation you described.

Edited by Lejes, 17 April 2016 - 04:50 AM.


#11 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 17 April 2016 - 07:01 AM

*enables music* ...okay this is a game freeze that still plays music, but none of the inputs do anything

 

FFC 1 (ComboTile Mod)

D0: 154 (shield item)

D1: 741 (combo number)

D2: 0 = no SFX

D3: 1 = don't give Link item when he's in the air

D4: 0 = no SFX

 

FFC 2 (CreateItem)

D0: 31 (whistle item)

D1: 0 = Link doesn't hold up item

D2: 31 (whistle item)

 

FFC 3 (CreateItem)

D0: 31 (whistle item)

D1: 1 = Link holds up item

D2: 31 (whistle item)

 

Frozen Quest (music enabled)

Link begins on screen 00 with the 3 scripts running:

https://drive.google...YWlVZW9wMmhjeG8

 

Non-Frozen Quest (music not enabled)

Link begins on screen 10 with no scripts running:

https://drive.google...anVrMDN6dS1KRUk

 

EDIT: Forgot the Init Data. Link begins with:

Boomerang 1, Roc's Feather, and Sword 1


Edited by Cukeman, 17 April 2016 - 07:10 AM.


#12 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 17 April 2016 - 07:36 AM

I did some testing and I'm pretty sure Tango is at fault here. It thinks a menu is open (Tango_MenuIsActive() always returns true) and so it's disabling inputs for everything after Tango_Update1(). But I'm really not sure why it's doing this, and finding out would take a lot more digging.

#13 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 17 April 2016 - 07:55 AM

I'm not using Tango for anything so far. If I delete lines 5, 27, and 35 will that disable everything from Tango?



#14 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 17 April 2016 - 08:12 AM

Just put "//" in front of lines 27 and 35. That will completely disable Tango while keeping the lines intact in case this gets figured out later.
  • Cukeman likes this

#15 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 17 April 2016 - 08:26 AM

Just put "//" in front of lines 27 and 35. That will completely disable Tango while keeping the lines intact in case this gets figured out later.

 

Yup, that unfroze it




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users