Jump to content

Photo

OoT style Hover Boots

Hover Boots Question

  • Please log in to reply
12 replies to this topic

#1 SparksTheUnicorn

SparksTheUnicorn

    Lonk, Hero of Lime

  • Members

Posted 07 June 2020 - 02:22 PM

So for my current quest, I am trying to figure out a way to have the hover boots work like they do in OoT along side their standard use. In other words. the idea would be that if link walks over combos with a certain flag while the hover boots are in his inventory, he will ignore the walkability and damage/warp effects of the combo for the duration of the hover boots effect.

 

I assume this would probably have to be some kind of global script, and since I am knew to scripting, I wanted to ask for some help in writing it.

To be clear, I am not looking for someone to just write the code for me (although if you would like to do so please feel free), as I am trying to learn zscript, I just wanted to find any helpful people willing to teach me how to do something like this, as it this will also be my first self written global script.

 

Thanks!



#2 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 07 June 2020 - 03:53 PM

Okay, here's some very general pointers. In ZScript, it's often easier to take advantage of in-engine features rather than re-inventing the wheel. For example, boots will negate damage combos. So make a boots item with no magic cost. Give it to Link when the hover boots effect is active. Take it away when the effect is over. That'll cover the damage combos. For negating warps, you can take advantage of another features. If a FFC is covering a warp, Link can't use it. So when Link is using the hover boots, staple an invisible FFC to his position. That'll keep him from triggering stair combos and such.

 

As far as activating the effect, what you'll need to do is constantly check the combos around Link (it'd probably be enough to just check Screen->ComboT for the 4 corners of Link's hitbox, since he has to be overlapping substantially with stairs or damage combos to trigger them). If he's touching one, you'd give him the boots, staple the FFC to him, and start a timer. Every frame the timer's going, check if Link is still colliding with one of those combos. If he no longer is, reset the timer and take away those things. If the timer runs out though, take them away regardless. Then, don't allow the effect to trigger again until Link is off of those combos (all four corners of his sprite aren't touching damage or stairs combos).


  • SparksTheUnicorn likes this

#3 SparksTheUnicorn

SparksTheUnicorn

    Lonk, Hero of Lime

  • Members

Posted 07 June 2020 - 04:47 PM

Okay, here's some very general pointers. In ZScript, it's often easier to take advantage of in-engine features rather than re-inventing the wheel. For example, boots will negate damage combos. So make a boots item with no magic cost. Give it to Link when the hover boots effect is active. Take it away when the effect is over. That'll cover the damage combos. For negating warps, you can take advantage of another features. If a FFC is covering a warp, Link can't use it. So when Link is using the hover boots, staple an invisible FFC to his position. That'll keep him from triggering stair combos and such.

 

As far as activating the effect, what you'll need to do is constantly check the combos around Link (it'd probably be enough to just check Screen->ComboT for the 4 corners of Link's hitbox, since he has to be overlapping substantially with stairs or damage combos to trigger them). If he's touching one, you'd give him the boots, staple the FFC to him, and start a timer. Every frame the timer's going, check if Link is still colliding with one of those combos. If he no longer is, reset the timer and take away those things. If the timer runs out though, take them away regardless. Then, don't allow the effect to trigger again until Link is off of those combos (all four corners of his sprite aren't touching damage or stairs combos).

 

Thank you!

Would it be possible to, rather than use Screen->ComboT for links hitbox corners, just use LinkComboTypeCollision, and then activate the boots and place the ffc if that function returns a value higher than 0 (or would it be higher than -1, I am not sure there)?

 

Also I assume this would all be part of my global script, correct? And presumably before the waitframe right?



#4 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 07 June 2020 - 05:39 PM

Would it be possible to, rather than use Screen->ComboT for links hitbox corners, just use LinkComboTypeCollision, and then activate the boots and place the ffc if that function returns a value higher than 0 (or would it be higher than -1, I am not sure there)?

I'm actually not familiar with LinkComboTypeCollision, but if it does what the name sounds like, that should work. I'd still probably check it specifically against damage and stair combos, since checking against any combo type could prevent other combo types (docks, for example) from working.

Also I assume this would all be part of my global script, correct? And presumably before the waitframe right?

Yes. For organizations sake, it'd probably be easiest to put this all in one function and put that function before the waitframe. You'll also want a bit before your while(true) loop that turns everything off. That way, if you die while using the hoverboots, you won't still be using them when you continue.
  • SparksTheUnicorn likes this

#5 Jared

Jared

    Deified

  • Members
  • Real Name:Jared
  • Pronouns:He / Him
  • Location:New Hampshire

Posted 07 June 2020 - 05:57 PM

I actually had someone make a script just like this for me a long time ago. Hover Boots they were. So it is indeed possible.


  • SparksTheUnicorn likes this

#6 Mani Kanina

Mani Kanina

    Rabbits!

  • Members

Posted 07 June 2020 - 08:46 PM

If you don't mind looking like he's constantly faling/throwing up, you can do like I did in a shitty test script for hoover boots a while back: Just constantly set link's Z every frame to be slightly off ground.

(Don't do this, it's a terrible solution).


Edited by Mani Kanina, 07 June 2020 - 08:47 PM.

  • SparksTheUnicorn likes this

#7 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 07 June 2020 - 08:52 PM

Honestly... that's not a terrible solution. To get around the jumping/falling animation problem, you just need to make Link invisible for the period and draw him manually.


  • Mani Kanina and SparksTheUnicorn like this

#8 Mani Kanina

Mani Kanina

    Rabbits!

  • Members

Posted 07 June 2020 - 09:10 PM

Honestly... that's not a terrible solution. To get around the jumping/falling animation problem, you just need to make Link invisible for the period and draw him manually.

You'd probably have to re-draw all frames though, like, a lot of other item uses aren't prevented in the air, but their animation will be canceled I'm pretty sure.


  • SparksTheUnicorn likes this

#9 SparksTheUnicorn

SparksTheUnicorn

    Lonk, Hero of Lime

  • Members

Posted 07 June 2020 - 09:18 PM

If you don't mind looking like he's constantly faling/throwing up, you can do like I did in a shitty test script for hoover boots a while back: Just constantly set link's Z every frame to be slightly off ground.

(Don't do this, it's a terrible solution).

I actually just now figured out a way to get the effect I was looking for in a way similar to this.

 

When I tried the original idea, with spawning an FFC on link and giving him the boots and what not, it sadly didn't work. However, I then I realized that the Pegasus Boots from the database cause link to go up into the air a bit after hitting a wall, and when you have the hover boots, that causes you to float. So I realized I could just take the Hookshot script from the std.Weapons header, and update it so that, like with the Pegasus Boots, when Link is pulled towards a grapple point by the hook shot, his Z position is increased slightly upon reaching his destination (alongside creating a small screen shake for effect).

 

After testing it, it works perfectly. Anyway, thank you guys so much for all your suggestions and help!

 

EDIT: I still need to figure out how to get it to work without the hookshot, but at lease this solves the issue enough for my main puzzle idea for this dungeon to work.


Edited by SparksTheUnicorn, 07 June 2020 - 09:21 PM.

  • Russ and Jared like this

#10 Demonlink

Demonlink

    Lurking in the shadows...

  • Members
  • Real Name:Miguel
  • Location:Wouldn't you like to know?

Posted 08 June 2020 - 10:55 AM

By any chance, are you using a pit script in your quest? If so, you'd need to make it compatible with it as well. (That would look awesome) :D



#11 SparksTheUnicorn

SparksTheUnicorn

    Lonk, Hero of Lime

  • Members

Posted 08 June 2020 - 11:51 PM

By any chance, are you using a pit script in your quest? If so, you'd need to make it compatible with it as well. (That would look awesome) :D

 

I believe I am using Moosh's pit scriptm yes. Thank you for the reminder, I will have to do that. 

 

Also, so while the Hookshot thing worked well enough for a bit, it had two big problems that I just couldn't handle. Those being that I couldn't use the normal Hookshot (I had to use a scripted one), and that I only got half the effect I was after (I had Link hovering after hookshoting to a grapple point, but not when walking over a pit/damage combo). So I decided to start again from scratch. Fast forward a few hours later to now, and I just completed the first script that was made almost entirely from scratch.

 

Of course it still does have some issues (for some reason direct and sensitive warps are still activated if link enters them from the sides, when it should instead be activated the hover boots), but I am still pretty proud of this. :)

 

SO BEHOLD, OCARINA OF TIME STYLE HOVER BOOTS:

////////////////////////////////
/////OoT Hover Boots Script/////
/////	      V1.0	   /////
///// By SparksTheUnicron  /////
/////	    06/09/2020	   /////
////////////////////////////////

//NOTE: The method for detecting if Link is on a combo flagged as hoverable (meaning Link's Boots will activate when on said Combo) is an edited version of the method used by Moosh's pit script for detecting if link is on a pit
//NOTE: This script requires stdCombos.zh, std.zh, and stdExtra.zh

//import "std.zh"
//import "stdCombos.zh"
//import "stdExtra.zh"

const int hoverDuration = 50; //Time, in frames, that the hover effect lasts. Set to 45 for the default hover boot length. This should be set to the same value as the hover duration in the items attributes
const int hoverID = 92; //Item ID of the hover boots
const int HoverFlag = 109; //combo flag that causes link to start hovering
const int rechargeTime = 20; //time, in frames, that link must wait before he can hover again after landing

bool hover_charged = true; //the hover boots can be used
bool hover_activate=false; //the hover boots have been triggered
bool jumped=false; //has the initial jump occured
bool chargingUp=false;

int hovWidth = 2;
int hovHeight = 2;
int hovX;
int hovY;
int hovComb;
int hoverTimer = 0;
int rechargeTimer = 0;

void StopHover()
{
	hoverTimer=hoverDuration;
	hover_activate=false;
	jumped=true;
	hover_charged=true;
}

void OoTStartUp() //call before while(true) to make sure all variables are set correctly on start up and respawn
{
	hoverTimer = hoverDuration; //reset hover timer
	hover_activate=false; //stop hovering
	hover_charged=true; //hover is available
	jumped=true;
}
void OoTHoverBoots()
{
	
	if((Link->Item[hoverID]) && hover_charged && OnHoverFlag()==1)
	{
		hover_activate=true; //signals the boots are active
		jumped=false;
		hover_charged=false; //we have used up our charge
		hoverTimer = hoverDuration; //sets the hover timer to be max
	}
	if(hover_activate)
	{
		if(!jumped)
		{
			Link->Z++;
			Link->Z++;
			jumped=true;
		}
		if(hoverTimer<=0)
		{
			StopHover();
		}
		else
		{
			hoverTimer--;
		}
	}
}



int OnHoverFlag()
{
	int total;
	for(int hovx=0; hovx<=1; hovx++)
	{
		for(int hovy=0; hovy<=1; hovy++)
		{
			hovX = Floor(Link->X+7-hovWidth/2+(hovWidth-1)*hovx)+1; //check the corners of links hitbox to see if he touches a hover activating combo
			hovY = Floor(Link->Y+11-hovHeight/2+(hovHeight-1)*hovy)+1;
			if((Screen->ComboF[ComboAt(hovX, hovY)]==HoverFlag))
			{
				total |= 1<<(1+(hovx+hovy*2));
			}
		}
	}
	if(total>0)
	{
		return 1;//(total>>1);
	}
	else
	{
		return -1;
	}
}


////EXAMPLE GLOBAL SCRIPT////
global script OoTHoverGlobal{
	void run(){
		OoTStartUp();
		while(true){
			//random functions
			//more random functions
			OoTHoverBoots();
                        Waitframe();
		}
	}
}
			

Edited by SparksTheUnicorn, 09 June 2020 - 01:40 PM.


#12 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 09 June 2020 - 04:19 AM

Your example global will softlock the game, as it doesn't have a 'Waitframe()'


  • SparksTheUnicorn likes this

#13 SparksTheUnicorn

SparksTheUnicorn

    Lonk, Hero of Lime

  • Members

Posted 09 June 2020 - 01:40 PM

Your example global will softlock the game, as it doesn't have a 'Waitframe()'

OOOPS! thank you





Also tagged with one or more of these keywords: Hover Boots, Question

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users