Jump to content

Photo

100% for Entry


  • Please log in to reply
5 replies to this topic

#1 Joelmacool

Joelmacool

    Addicted to Overwatch

  • Moderators
  • Real Name:Joel
  • Location:Country of Europe

Posted 03 October 2019 - 06:33 AM

I haven't posted a script request in a while, so here's one now. 

The script would basically create a solid object that would disappear once you have collected all the items in the game. This would mean the player needs to get 100% of all items in order for the object to disappear. The items in question would preferably be located on the active subscreen, including having all the Heart Containers. An alternative method may be to have a checklist, but that sounds pretty tedious to set-up.

Would this be too hard to create? (And thanks if you do decide to script this for me)



#2 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 03 October 2019 - 09:36 AM

I haven't posted a script request in a while, so here's one now. 

The script would basically create a solid object that would disappear once you have collected all the items in the game. This would mean the player needs to get 100% of all items in order for the object to disappear. The items in question would preferably be located on the active subscreen, including having all the Heart Containers. An alternative method may be to have a checklist, but that sounds pretty tedious to set-up.

Would this be too hard to create? (And thanks if you do decide to script this for me)

This... would be fairly simple,but would require you adding the individual components to the script. i.e.

ffc script completionBlock
{
    void run(int openCombo)
    {
        if(!Link->Item[ITEM_1]) return;
        if(!Link->Item[ITEM_2]) return;
        //Repeat this for EVERY item.
        if(Link->MaxHP < (MAX_LIFE)) return; //MAX_LIFE needs to be the highest your life can get; 100% hearts.
        if(Link->MaxMP < (MAX_MAGIC)) return; //Same for magic
        //Put any other conditions here.
        Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = openCombo; //This opens the block the FFC is placed on
    }
}

  • Joelmacool likes this

#3 ywkls

ywkls

    Master

  • Members

Posted 03 October 2019 - 09:47 AM

What I did, for items; was make each one add to a counter that tracked how many you had.

const int COUNTER_ITEM = CR_SCRIPT1;//A script counter

//Increase a counter every time you get an item with it attached
item script Item_Collection{
     void run(){
          Game->Counter[COUNTER_ITEM]++;
     }
}

//FFC script to trigger screen secrets if you get 100 percent

ffc script OneHundredPercent{
     void run(int total){
          //Does nothing if screen secrets have already been triggered
          if(Screen->State[ST_SECRET])
              Quit();
          while(true){
               //This allows you to have more than exactly 100 items
               if(Game->Counter[COUNTER_ITEM]>=total){
                    Screen->State[ST_SECRET]=true;
                    Screen->TriggerSecrets();
                    Quit();
               }
               Waitframe();
          }
     }
}

I'm not entirely sure, but I think that for this to work right; you have to set up COUNTER_ITEM in the quest's Init global script like so.

//Must be named "Init"
//Automatically assigned to a slot
//Runs when you start the quest.
global script Init{
     void run(){
           //Set to the maximum number of items you can get in the quest.
           Game->MCounter[COUNTER_ITEM]=100;
     }
}

If you have any questions, let me know.


  • Joelmacool likes this

#4 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 05 October 2019 - 11:16 AM

There are a couple of things you could do to simplify the item check. One would be to list the numbers in an array:
int requiredItems[]={ 5, 6, 7, 24, 36, 37, 45, 102 };
for(int i=0; i<SizeOfArray(requiredItems); i++) {
    if(!Link->Item[requiredItems[i]])
        return;
}
You could also mark the items themselves. Scripts can read items' names, so you could use a special character to mark each required item, e.g. "Sword 1 (Wooden) *". Of course, if you have item names displayed on the subscreen, that's probably not a good idea.
  • Joelmacool likes this

#5 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 06 October 2019 - 04:08 AM

Basiclly, what Saffith said. This should be a complete script, to the parameters that you specified.

 
//import "std.zh"     //uncomment if not called elsewhere
//import "classic.zh" //uncomment if not called elsewhere

//Transforms a combo at its location to another combo if Link has the required items
//Place directly over the combo to change
//Enable the ffc flag: Run on screen init
//D0 is the combo to morph your roadblock into

ffc script roadblock100percent
{
	void run(int new_combo) 
	{
		this->Data = CMB_INVISIBLE
		int itemslist[]=
		{
			
			I_SWORD1, I_SWORD2, I_SWORD3
			
		};
		int sz = SizeOfArray(itemslist); //Slightly faster than calling SizeofArray every frame
		bool waiting = true;
		do
		{
			for ( int q = sz; q >= 0; --q )
			{
				if(Link->Item[ itemslist[q] ] )
				{
					waiting = false;
				}
			}
			Waitframe();
		} while(waiting);

		//If we reaxh here, then Link has all of the items
		Game->PlaySound(SFX_SECRET);
		Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = new_combo;
	}
}	


//Bonus content: Specify a completion percent as D1
ffc script roadblockSPECIFYpercent
{
	void run(int new_combo, int perc_required) 
	{
		this->Data = CMB_INVISIBLE
		int itemslist[]=
		{
			
			I_SWORD1, I_SWORD2, I_SWORD3
			
		};
		int sz = SizeOfArray(itemslist)
		bool waiting = true;
		int count; int actual_perc;
		do
		{
			for ( int q = sz; q >= 0; --q )
			{
				if(Link->Item[ itemslist[q] ] )
				{
					++count
				}
			}
			actual_perc = ( 100 / sz ) * count;
			Waitframe();
		} while(actual_perc < perc_required);
		Game->PlaySound(SFX_SECRET);
		Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = new_combo;
	}
}	
Fill in the array with item IDs to collect.

#6 ChrisHunter64

ChrisHunter64

    average everyday normal guy

  • Members

Posted 16 November 2019 - 03:56 PM

Damn ask for a script and you get 4


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users