Jump to content

Photo

Boomerang Movement Influence


  • Please log in to reply
16 replies to this topic

#1 Aefre

Aefre

    artist guy

  • Members
  • Real Name:Jarik
  • Location:Oregon

Posted 18 June 2017 - 04:55 PM

My previous post seems to be neglected, so I'm removing the 2nd request I made, the pegasus boots.

Thats not what i'm requesting today though, what I am requesting is a boomerang that can influenced by using the arrow keys. For example, in Oracle of Seasons, you get the L2 Boomerang, or the Magical Boomerang, and you can control it by holding down the item button and controlling it with the control pad. I want something to replicate this in zquest. I'm not sure if this is possible, but please give it some consideration.

Thanks for reading!



#2 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 18 June 2017 - 05:36 PM

A pegasus boots script you can find in the database here: http://www.purezc.ne...=scripts&id=159 But I have never tested it, so I don't know how good it is.

 

For boomerang you'll need someone to script it for you, it's not too difficult though. If no one else does, I'll do it in 2 days or so? :) Is combining global scripts a problem for you?


Edited by Avataro, 18 June 2017 - 05:38 PM.


#3 Deedee

Deedee

    Bug Frog Dragon Girl

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

Posted 18 June 2017 - 08:32 PM

I know Nick and LinkTheMaster had one in their Fairy Dream quest. You should ask them!



#4 Aefre

Aefre

    artist guy

  • Members
  • Real Name:Jarik
  • Location:Oregon

Posted 19 June 2017 - 08:07 PM

I know Nick and LinkTheMaster had one in their Fairy Dream quest. You should ask them!

Their quest is why I wanted it, while replaying recently I thought of ways I could use it.


A pegasus boots script you can find in the database here: http://www.purezc.ne...=scripts&id=159 But I have never tested it, so I don't know how good it is.

 

For boomerang you'll need someone to script it for you, it's not too difficult though. If no one else does, I'll do it in 2 days or so? :) Is combining global scripts a problem for you?

Combining globals is a problem, but I am fine with replacing my current global. 2 days is great! Thanks!


Edited by Aefre, 19 June 2017 - 08:05 PM.


#5 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 20 June 2017 - 08:05 PM

I'm having a problem making this script. Can someone help?

import "std.zh"

//controllable boomerang item IDs. leave unneeded numbers as 0.
const int CBoomerang_ItemID1 = 23;
const int CBoomerang_ItemID2 = 24;
const int CBoomerang_ItemID3 = 35;
const int CBoomerang_ItemID4 = 0;
const int CBoomerang_ItemID5 = 0;

global script ActiveScript{
    void run(){
		int CBoomerang_State;
        while(true){
			if ( CBoomerang_State <= 1 && NumLWeaponsOf(LW_BRANG) > 0 ) {
				if ( (CBoomerang_ItemID1 > 0 && ((GetEquipmentA() == CBoomerang_ItemID1 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID1 && Link->InputB)))
				|| (CBoomerang_ItemID2 > 0 && ((GetEquipmentA() == CBoomerang_ItemID2 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID2 && Link->InputB)))
				|| (CBoomerang_ItemID3 > 0 && ((GetEquipmentA() == CBoomerang_ItemID3 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID3 && Link->InputB)))
				|| (CBoomerang_ItemID4 > 0 && ((GetEquipmentA() == CBoomerang_ItemID4 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID4 && Link->InputB)))
				|| (CBoomerang_ItemID5 > 0 && ((GetEquipmentA() == CBoomerang_ItemID5 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID5 && Link->InputB))) ) { //if item button is held down
					CBoomerang_State = 0;
					lweapon CBoomerang = LoadLWeaponOf(LW_BRANG);
					if ( !CBoomerang->Angular ) {
						CBoomerang->Angular = true;
						if ( CBoomerang->Dir == DIR_RIGHT ) CBoomerang->Angle = 0;
						if ( CBoomerang->Dir == DIR_DOWN ) CBoomerang->Angle = DegtoRad(90);
						if ( CBoomerang->Dir == DIR_LEFT ) CBoomerang->Angle = DegtoRad(180);
						if ( CBoomerang->Dir == DIR_UP ) CBoomerang->Angle = DegtoRad(270);
					}
					if ( Link->InputLeft )
						CBoomerang->Angle -= DegtoRad(6);
					else if ( Link->InputRight )
						CBoomerang->Angle += DegtoRad(6);
					CBoomerang->Dir = RadianAngleDir4(CBoomerang->Angle);
					Link->InputUp = false;
					Link->InputRight = false;
					Link->InputDown = false;
					Link->InputLeft = false;
				}
			}
			if ( NumLWeaponsOf(LW_BRANG) > 0 )
				CBoomerang_State ++;
			else
				CBoomerang_State = 0;
			Waitframe();
		}
	}
}

So the problem is:

If you set the boomerang weapon->Angular = true; for some reason it's angle gets set to 0. So I made it check it's direction to set the correct angle, but apparently the boomerang uses only 4 directions, even when thrown diagonally, so I can't check if it's thrown diagonally. Because of this, with my script, you can't throw the controllable boomerang diagonally.


Edited by Avataro, 20 June 2017 - 08:24 PM.


#6 Aefre

Aefre

    artist guy

  • Members
  • Real Name:Jarik
  • Location:Oregon

Posted 22 June 2017 - 06:44 AM

While looking at your script, I noticed the thing "GetEquipmentB" I'm just wondering if the B part means Only the B button, because I have it so it can be both. I can change it if its a big problem.


Edited by Aefre, 22 June 2017 - 06:44 AM.


#7 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 22 June 2017 - 11:28 AM

While looking at your script, I noticed the thing "GetEquipmentB" I'm just wondering if the B part means Only the B button, because I have it so it can be both. I can change it if its a big problem.

 

No worries there, it would work with A and B.



#8 judasrising

judasrising

    I play guitar

  • Members
  • Location:Sweden but born in Finland

Posted 23 June 2017 - 02:48 AM

I am using justin`s Pegasus boots script and it works very well ,easy to setup.



#9 Aefre

Aefre

    artist guy

  • Members
  • Real Name:Jarik
  • Location:Oregon

Posted 23 June 2017 - 10:51 AM

I guess I never thought of it till now, but is it possible to make the boomerang not able to touch walls? Like, any of them? I can't do what I want when you can just throw it through a wall. Sorry for not saying this before. I'll try to think of everything before I post something next time.



#10 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 23 June 2017 - 10:55 AM

I guess I never thought of it till now, but is it possible to make the boomerang not able to touch walls? Like, any of them? I can't do what I want when you can just throw it through a wall. Sorry for not saying this before. I'll try to think of everything before I post something next time.

 

 

Yes, I was actually going to include that as an option :) I guess I'll have to scrap my script though and start from the beginning because I didnt get diagonal throwing to work.

 

I don't know when or if I'll get it done.

 

(Offtopic: Also, your demo is currently not downloadable, the site gives an error)


Edited by Avataro, 23 June 2017 - 10:59 AM.


#11 cavthena

cavthena

    Apprentice

  • Members
  • Real Name:Clayton
  • Location:I wish I knew

Posted 23 June 2017 - 11:17 AM

For diagonal throws you could try grabbing Link's inputs when thrown and assign the angle yourself. Another option is to wait 2 frames then grab the angle from Link to the boomerang LWeapon and set the angle that way.

#12 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 23 June 2017 - 03:38 PM

For diagonal throws you could try grabbing Link's inputs when thrown and assign the angle yourself. Another option is to wait 2 frames then grab the angle from Link to the boomerang LWeapon and set the angle that way.

 

(Emphasis, mine.)

 

This is how the new diagonal hookshot, and the diagonal boomerang work internally.

 

Replicating the behaviour is essentially this:

 

if ( Link->InputLeft && Link->InputDown  ) //LeftDown
{
    weap->Dir == LEFTDOWN;
}

 

and so forth.


  • Jared likes this

#13 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 23 June 2017 - 04:07 PM

Okay so here is the finished script:

import "std.zh"

//controllable boomerang item IDs. leave unneeded numbers as 0.
const int CBoomerang_ItemID1 = 24;
const int CBoomerang_ItemID2 = 35;
const int CBoomerang_ItemID3 = 0;
const int CBoomerang_ItemID4 = 0;
const int CBoomerang_ItemID5 = 0;
const int LWBoomerang_Wallblock = 1; //0 = normal behavior, 1 = all of links boomerangs are stopped by solidity

global script ActiveScript{
	void run(){
		int CBoomerang_State;
		while(true){
			CBoomerang(CBoomerang_State);
			Waitframe();
		}
	}
}

int CBoomerang(int CBoomerang_State) {
	if ( NumLWeaponsOf(LW_BRANG) > 0 ) {
		lweapon LWBoomerang = LoadLWeaponOf(LW_BRANG);
		if ( LWBoomerang->DeadState == WDS_ALIVE && Screen->isSolid(LWBoomerang->X+8, LWBoomerang->Y+8) && LWBoomerang_Wallblock == 1 )
			LWBoomerang->DeadState = WDS_BOUNCE;
	}
	if ( CBoomerang_State <= 1 && NumLWeaponsOf(LW_BRANG) > 0 ) {
		if ( (CBoomerang_ItemID1 > 0 && ((GetEquipmentA() == CBoomerang_ItemID1 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID1 && Link->InputB)))
		|| (CBoomerang_ItemID2 > 0 && ((GetEquipmentA() == CBoomerang_ItemID2 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID2 && Link->InputB)))
		|| (CBoomerang_ItemID3 > 0 && ((GetEquipmentA() == CBoomerang_ItemID3 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID3 && Link->InputB)))
		|| (CBoomerang_ItemID4 > 0 && ((GetEquipmentA() == CBoomerang_ItemID4 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID4 && Link->InputB)))
		|| (CBoomerang_ItemID5 > 0 && ((GetEquipmentA() == CBoomerang_ItemID5 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID5 && Link->InputB))) ) { //if item button is held down
			CBoomerang_State = 0;
			lweapon CBoomerang = LoadLWeaponOf(LW_BRANG);
			if ( !CBoomerang->Angular ) {
				CBoomerang->Angular = true;
				if ( (CBoomerang->Dir == DIR_RIGHT || CBoomerang->Dir == DIR_DOWN) && Link->InputRight && Link->InputDown )
					CBoomerang->Angle = DegtoRad(45);
				else if ( (CBoomerang->Dir == DIR_LEFT || CBoomerang->Dir == DIR_DOWN) && Link->InputLeft && Link->InputDown )
					CBoomerang->Angle = DegtoRad(135);
				else if ( (CBoomerang->Dir == DIR_LEFT || CBoomerang->Dir == DIR_UP) && Link->InputLeft && Link->InputUp )
					CBoomerang->Angle = DegtoRad(225);
				else if ( (CBoomerang->Dir == DIR_RIGHT || CBoomerang->Dir == DIR_UP) && Link->InputRight && Link->InputUp )
					CBoomerang->Angle = DegtoRad(315);
				else {
					if ( CBoomerang->Dir == DIR_RIGHT ) CBoomerang->Angle = 0;
					if ( CBoomerang->Dir == DIR_DOWN ) CBoomerang->Angle = DegtoRad(90);
					if ( CBoomerang->Dir == DIR_LEFT ) CBoomerang->Angle = DegtoRad(180);
					if ( CBoomerang->Dir == DIR_UP ) CBoomerang->Angle = DegtoRad(270);
				}
			}
			if ( Link->InputLeft )
				CBoomerang->Angle -= DegtoRad(6);
			else if ( Link->InputRight )
				CBoomerang->Angle += DegtoRad(6);
			CBoomerang->Dir = RadianAngleDir4(CBoomerang->Angle);
			Link->InputUp = false;
			Link->InputRight = false;
			Link->InputDown = false;
			Link->InputLeft = false;
		}
	}
	if ( NumLWeaponsOf(LW_BRANG) > 0 )
		CBoomerang_State ++;
	else
		CBoomerang_State = 0;
	return CBoomerang_State;
}

A test quest: https://www.mediafir...y9f0yb0tmg7a3cp

 

Please post your current global script and I can combine your global script with this one for you.

 

Also for some reason you can't change a boomerangs step speed, not even a script created one. Or I was doing something wrong. I'm not going to upload this to the DB because I'm unhappy with the script.

 

Hope you like it though!


Edited by Avataro, 23 June 2017 - 04:08 PM.


#14 Deedee

Deedee

    Bug Frog Dragon Girl

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

Posted 23 June 2017 - 10:33 PM

Also for some reason you can't change a boomerangs step speed, not even a script created one. Or I was doing something wrong. I'm not going to upload this to the DB because I'm unhappy with the script.

Either create a global variable, or use a misc variable, and use it as a separate "stepfloat" counter for decimal movement for the boomerang. If "step" is lower than 3 (which is the boomerang's step speed on throwing (2 for returning)), decrease "stepfloat" by however many "step" is lower than 3. If higher than 3, increase by however many higher than three. Then, if stepfloat is over or equal to 1, move the boomerang in the angle it's moving in, i lower of equal to -1, move it in opposite direction. Then subtract/add 1 to stepfloat. Do this after Waitdraw.



#15 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 24 June 2017 - 05:53 AM

Okay so here is the finished script:

import "std.zh"

//controllable boomerang item IDs. leave unneeded numbers as 0.
const int CBoomerang_ItemID1 = 24;
const int CBoomerang_ItemID2 = 35;
const int CBoomerang_ItemID3 = 0;
const int CBoomerang_ItemID4 = 0;
const int CBoomerang_ItemID5 = 0;
const int LWBoomerang_Wallblock = 1; //0 = normal behavior, 1 = all of links boomerangs are stopped by solidity

global script ActiveScript{
	void run(){
		int CBoomerang_State;
		while(true){
			CBoomerang(CBoomerang_State);
			Waitframe();
		}
	}
}

int CBoomerang(int CBoomerang_State) {
	if ( NumLWeaponsOf(LW_BRANG) > 0 ) {
		lweapon LWBoomerang = LoadLWeaponOf(LW_BRANG);
		if ( LWBoomerang->DeadState == WDS_ALIVE && Screen->isSolid(LWBoomerang->X+8, LWBoomerang->Y+8) && LWBoomerang_Wallblock == 1 )
			LWBoomerang->DeadState = WDS_BOUNCE;
	}
	if ( CBoomerang_State <= 1 && NumLWeaponsOf(LW_BRANG) > 0 ) {
		if ( (CBoomerang_ItemID1 > 0 && ((GetEquipmentA() == CBoomerang_ItemID1 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID1 && Link->InputB)))
		|| (CBoomerang_ItemID2 > 0 && ((GetEquipmentA() == CBoomerang_ItemID2 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID2 && Link->InputB)))
		|| (CBoomerang_ItemID3 > 0 && ((GetEquipmentA() == CBoomerang_ItemID3 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID3 && Link->InputB)))
		|| (CBoomerang_ItemID4 > 0 && ((GetEquipmentA() == CBoomerang_ItemID4 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID4 && Link->InputB)))
		|| (CBoomerang_ItemID5 > 0 && ((GetEquipmentA() == CBoomerang_ItemID5 && Link->InputA) || (GetEquipmentB() == CBoomerang_ItemID5 && Link->InputB))) ) { //if item button is held down
			CBoomerang_State = 0;
			lweapon CBoomerang = LoadLWeaponOf(LW_BRANG);
			if ( !CBoomerang->Angular ) {
				CBoomerang->Angular = true;
				if ( (CBoomerang->Dir == DIR_RIGHT || CBoomerang->Dir == DIR_DOWN) && Link->InputRight && Link->InputDown )
					CBoomerang->Angle = DegtoRad(45);
				else if ( (CBoomerang->Dir == DIR_LEFT || CBoomerang->Dir == DIR_DOWN) && Link->InputLeft && Link->InputDown )
					CBoomerang->Angle = DegtoRad(135);
				else if ( (CBoomerang->Dir == DIR_LEFT || CBoomerang->Dir == DIR_UP) && Link->InputLeft && Link->InputUp )
					CBoomerang->Angle = DegtoRad(225);
				else if ( (CBoomerang->Dir == DIR_RIGHT || CBoomerang->Dir == DIR_UP) && Link->InputRight && Link->InputUp )
					CBoomerang->Angle = DegtoRad(315);
				else {
					if ( CBoomerang->Dir == DIR_RIGHT ) CBoomerang->Angle = 0;
					if ( CBoomerang->Dir == DIR_DOWN ) CBoomerang->Angle = DegtoRad(90);
					if ( CBoomerang->Dir == DIR_LEFT ) CBoomerang->Angle = DegtoRad(180);
					if ( CBoomerang->Dir == DIR_UP ) CBoomerang->Angle = DegtoRad(270);
				}
			}
			if ( Link->InputLeft )
				CBoomerang->Angle -= DegtoRad(6);
			else if ( Link->InputRight )
				CBoomerang->Angle += DegtoRad(6);
			CBoomerang->Dir = RadianAngleDir4(CBoomerang->Angle);
			Link->InputUp = false;
			Link->InputRight = false;
			Link->InputDown = false;
			Link->InputLeft = false;
		}
	}
	if ( NumLWeaponsOf(LW_BRANG) > 0 )
		CBoomerang_State ++;
	else
		CBoomerang_State = 0;
	return CBoomerang_State;
}

A test quest: https://www.mediafir...y9f0yb0tmg7a3cp

 

Please post your current global script and I can combine your global script with this one for you.

 

Also for some reason you can't change a boomerangs step speed, not even a script created one. Or I was doing something wrong. I'm not going to upload this to the DB because I'm unhappy with the script.

 

Hope you like it though!

 

Boomerangs do not have a 'step': Their rate of movement is tied to a hardcoded clock, which is also linked to their animation. If you want to affect its rate of travel, you need to manually position it every frame. You cannot alter their range in 2.50.x either, unless you trigger WDS_BOUNCE on a timer.

 

I have fixed the Range issue for 2.6, but the step speed / clock issue is unchanged for the present.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users