Jump to content

Photo

Boomerang Movement Influence


  • Please log in to reply
16 replies to this topic

#16 Aefre

Aefre

    artist guy

  • Members
  • Real Name:Jarik
  • Location:Oregon

Posted 26 June 2017 - 12:04 PM

Thank you so much! I think ill just use

 

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!

Thanks so much! I don't think the global I had is worth the trouble, so I'll just stick to this for now. I'll defnetly ask if I do find a worthwhile one though. Again, thank you so much!



#17 Aefre

Aefre

    artist guy

  • Members
  • Real Name:Jarik
  • Location:Oregon

Posted 26 June 2017 - 03:39 PM

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)

I noticed it gave an error, do you know who to fix that? I can't even download it, its weird.

EDIT: It seems to have fixed itself...


Edited by Aefre, 26 June 2017 - 03:42 PM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users