Jump to content

Photo

ZScript tutorials, examples etc. chat thread


  • Please log in to reply
6 replies to this topic

#1 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 07 October 2017 - 11:14 AM

@username to tag a user after you click on (or touch) the username.


Anyways I Jason request a
http://www.youtube.com/upload
YouTube tutorial video uploaded
that shows a script being made to affect an item named
Death Potion
that instead of if used heart healing sound plays as Link's health gets healed by one half heart until Link is fully healed,
if
Death Potion
gets used both
heart healing sound gets played until Link's health is zero meaning all small hearts of Link's health are white
and also until all of Link's heart health are zero Link's heart health gets reduced by one half heart.

Edited by LikeLike888, 07 October 2017 - 11:15 AM.

  • Shane likes this

#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 09 October 2017 - 08:23 PM

Please clarify: You want an item that replicates a norma potion, in reverse?

Is Link able to move while poisoned, or is he frozen, as with a normal potion?

FWIW, I have mixed feelings on this sort of trap item. Tower of Druaga reference?

Edited by ZoriaRPG, 09 October 2017 - 08:25 PM.


#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 10 October 2017 - 10:41 AM

@username to tag a user after you click on (or touch) the username.


Anyways I Jason request a
http://www.youtube.com/upload
YouTube tutorial video uploaded
that shows a script being made to affect an item named
Death Potion
that instead of if used heart healing sound plays as Link's health gets healed by one half heart until Link is fully healed,
if
Death Potion
gets used both
heart healing sound gets played until Link's health is zero meaning all small hearts of Link's health are white
and also until all of Link's heart health are zero Link's heart health gets reduced by one half heart.





I found a minor error in the code, that I did not fix in the video. The (revised) code is below, and part 2 will be testing and implementation.

Please tell me if this is what you want to see. Can you spot the difference?
 
const int FFC_DATA_INVIS = 1; //A combo with a blank tile. 
const int SFX_POTION = 63; //The sound to play when draining HP.
const int SFX_ERROR = 64; //Error sound.

item script DeathPotion{
	//D0: A pick-up script string.
	//D1: The ID of the item. 
	void run(int item_string, int item_id){
		//grab a free ffc
		ffc f; 
		int f_id = DeathPotionGetFreeFFC(); 
		if ( f_id > -1 ) 
			//if we can find a free ffc
		{
			//Load the ffc. 
			f = Screen->LoadFFC(f_id);
			// Run the script
			f->Data = FFC_DATA_INVIS;
			//Declare the script name so that we can load it.
			int ff[]="DeathPotionFFC";
			//Load the ffc script. 
			f->Script = Game->GetFFCScript(ff);
			//This runs the effect.
			Link->Item[item_id] = false;
			//Remove the item from inventory
			Quit(); //We're done here.
			
		}
		//If we reach here, then there is an error!
		int err[]="Failed to find a free FFC slot for DeathPotionFFC!";
		TraceNL(); TraceS(err); TraceNL();
		Game->PlaySound(SFX_ERROR);
		
	}
	
	//Function to grab a free ffc. 
	//This is not sanitised, and will fail if all ffcs are used. 
	int DeathPotionGetFreeFFC(){
		ffc f = Screen->LoadFFC(q);
		//Iterate through all screen ffcs to find one 
		//that is unused. 
		for ( int q = 0; q < 32; q++ )
		{
			//if it has no combo assigned
			if ( f->Data == 0 )
			{ 
				//and no script assigned
				if ( f->Script == 0 )
				{
					//we use that ID
					return q;
	
				}
			}
		}
		//If we reach here, then we could not find a free FFC!
		//Return an error. 
		return -1; //this is a better error. 
	}
}

//The ffc script for the death potion.
//This causes Link's HP to drain. 
ffc script DeathPotionFFC{
	void run(){
		//RUn until Link is dead.
		while(Link->HP > 0)
		{
			//We will be setting Link's HP to drain
			//so every time that we adjust it, we allow the
			//game engine to drain 8HP (1/2 heart).
			if ( Game->DCounter[CR_LIFE] == 0 )
			{
				//Drain 1/2 heart
				Game->DCounter[CR_LIFE] -= 8;
				//Play the drain sound/
				Game->PlaySound(SFX_POTION);
			}
			Waitframe();
		}
		//clean up and exit the ffc (extraneous, because Link is dead!)
		this->Data = 0;
		this->Script = 0;
		Quit();
	}
}

Edited by ZoriaRPG, 10 October 2017 - 10:49 AM.


#4 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 22 February 2018 - 01:00 PM

Quest
Import ASM FFC Script
Import ASM Item Script
Import ASM Global Script
Compile ZScript...
 
 
 

Whether any script flag is needed or not
please when post a tutorial or example be as specific as possible
on how to get the script to work properly such as at least as
a 19 steps made up example below:
 
 
 

Step #1: Open up Notepad
 
 
 

Step #2: Type the following in Code box below
import "std.z"
if (Link_Does_Not_Have_Red_Ring == true) //if Link does not have red ring
{
  if (DMap_Link_Is_On == DMap 0) //if Link is on DMap 0
  {
    if (Screen_Link_Is_On == 57) //if Link is on Screen 57
    {
      if (Link_X == 58) //if Link's x position (spot) is 58
      {
        if (Link_Y = 58) //if Link's y position is 58
        {
          Link_Does_Have_Red_Ring = true; //Link now does have red ring
          Link_Does_Not_Have_Red_Ring = false; //It is false that Link does not have red ring
        }
      }
    }
  }
}
 
 
 
 
Step #3: Save the Notepad document as
whatever you want.txt
such as
Please Make Link Have Red Ring If Five Conditions Are Met.txt
 
 
 
 
Step #4: Open up Zelda Classic Quest Editor file (Atleast 2.50)
 
 
 

Step #5: Left click on
Quest
 
 
 

Step #6: Left click on
Import ASM Item Script
 
 
 
 
Step #7: In box near
Name:
type
Red Ring If Five
 
 
 
 
Step #8: Left click on
Load
 
 
 
 
Step #9: Double left click on the .txt file you made because of
Step #3:
 
 
 
 
Step #10: Left click on
OK
 
 
 
 
Step #11: To apply the script that you named its file in
Step #3:
do the following next 6 steps
 
 
 
 
Step #12: Left click on
Quest
 
 
 
 
Step #13: Left click on
DMaps
 
 
 
 
Step #14: Left click on
Edit
 
 
 
 
Step #15: Left click on
Flags
 
 
 
 
Step #16: Left click on box left of the text
Script 1
 
 
 
 
Step #17: Left click on
OK
 
 
 
 
Step #18: Save the quest as
whatever you want.qst
such as
Link can get red ring.qst
 
 
 
 
Step #19: ^ Load the quest file made by following
Step #18:
and go to x and y position 58
on screen 57 of DMap 0 and Link will have red ring.


#5 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 23 February 2018 - 07:03 AM

QuestImport ASM FFC ScriptImport ASM Item ScriptImport ASM Global ScriptCompile ZScript...   Whether any script flag is needed or notplease when post a tutorial or example be as specific as possibleon how to get the script to work properly such as at least asa 19 steps made up example below:   Step #1: Open up Notepad   Step #2: Type the following in Code box below

import "std.z"
if (Link_Does_Not_Have_Red_Ring == true) //if Link does not have red ring
{
  if (DMap_Link_Is_On == DMap 0) //if Link is on DMap 0
  {
    if (Screen_Link_Is_On == 57) //if Link is on Screen 57
    {
      if (Link_X == 58) //if Link's x position (spot) is 58
      {
        if (Link_Y = 58) //if Link's y position is 58
        {
          Link_Does_Have_Red_Ring = true; //Link now does have red ring
          Link_Does_Not_Have_Red_Ring = false; //It is false that Link does not have red ring
        }
      }
    }
  }
}
    Step #3: Save the Notepad document aswhatever you want.txtsuch asPlease Make Link Have Red Ring If Five Conditions Are Met.txt    Step #4: Open up Zelda Classic Quest Editor file (Atleast 2.50)   Step #5: Left click onQuest   Step #6: Left click onImport ASM Item Script    Step #7: In box nearName:typeRed Ring If Five    Step #8: Left click onLoad    Step #9: Double left click on the .txt file you made because ofStep #3:    Step #10: Left click onOK    Step #11: To apply the script that you named its file inStep #3:do the following next 6 steps    Step #12: Left click onQuest    Step #13: Left click onDMaps    Step #14: Left click onEdit    Step #15: Left click onFlags    Step #16: Left click on box left of the textScript 1    Step #17: Left click onOK    Step #18: Save the quest aswhatever you want.qstsuch asLink can get red ring.qst    Step #19: ^ Load the quest file made by followingStep #18:and go to x and y position 58on screen 57 of DMap 0 and Link will have red ring.

I have a video on ASM scripts ion YouTube that demonstrates how to add them to a quest. Look through my videos please, before requesting things that I have already covered.


...also, Step 1 is definitely wrong. Using Notepad.exe is always a mis-step. ;)

#6 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 23 February 2018 - 07:56 AM

Whats wrong here is step 6. And also... thank you likelike for always being so informative.


Edited by Avataro, 23 February 2018 - 07:57 AM.


#7 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 23 February 2018 - 08:32 AM

Whats wrong here is step 6. And also... thank you likelike for always being so informative.


Well, obviously, but, the actual posted code would never compile into ZASM anyway. It starts to have problems at Step 1, though. ;)

Spoiler


I suppose that I could make an ASM item script, just to show how that works, but no-one would care.
  • Avaro likes this


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users