Jump to content

Photo

Boumrang


  • Please log in to reply
9 replies to this topic

#1 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 15 September 2019 - 05:48 PM

hello everyone. It's been long time since i didn't made a script request. However i was thinking about an original item script.
I call it the Boumrang.

I explain: When the player throw the boomerang it'll react like a magic boomerang but instead to returns to Link when the boomerang touch an obstacle it'll explode so Link could uses the boomerang again. I was thinking about that the boomerang would be controlable with the directions buttons and can explode whenever the player choose to make it explode in purpose (by pressing the button of the boomerang assigned), so the player wouldn't have to wait that the boomerang touch a obstacle to explode. 

Nothing special to add on it except the item name for this one.


  • Matthew and SparksTheUnicorn like this

#2 Deedee

Deedee

    Bug Frog Dragon Girl

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

Posted 15 September 2019 - 06:40 PM

just steal it from saffith.


  • Shane likes this

#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 15 September 2019 - 11:37 PM

hello everyone. It's been long time since i didn't made a script request. However i was thinking about an original item script.
I call it the Boumrang.

I explain: When the player throw the boomerang it'll react like a magic boomerang but instead to returns to Link when the boomerang touch an obstacle it'll explode so Link could uses the boomerang again. I was thinking about that the boomerang would be controlable with the directions buttons and can explode whenever the player choose to make it explode in purpose (by pressing the button of the boomerang assigned), so the player wouldn't have to wait that the boomerang touch a obstacle to explode. 

Nothing special to add on it except the item name for this one.

 
 
Try this, for now:
 
//Boomerang Explodes on contact with enemy.
//v0.1, 16th September, 2019 by ZoriaRPG
//Do: Damage value for explosion. Defaults to damage power of boomerang + 2.

lweapon script exploderang
{
	void run(int explosion_damage)
	{
		while(this->isValid())
		{
			for ( int q = Screen->NumNPCs(); q > 0; --q )
			{
				npc n = Screen->LoadNPC(q);
				if ( n->Defense[NPCD_BOOMERANG] != NPCDT_IGNORE && Collision(this, n) )
				{
					n->InvFrames = 0;
					lweapon boom = Screen->CreateLWeapon(LW_BOMBBLAST);
					boom->X = this->X;
					boom->Y = this->Y;
					boom->Dir = this->Dir;
					boom->Step = 0;
					boom->Damage = ( explosion_damage > 0 ) ? explosion_damage : (this->Power + 2);
					this->DeadState = WDS_DEAD;
					Remove(this);
				}
			}
			Waitframe();
		}
	}
}
Attach it as a weapon script to a boomerang item. Should work just fine.

notice: This script is offered 'as-is' with no support. If it needs fixes, I, or someone else may provide them, as available time and resources permit.

#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 16 September 2019 - 12:12 AM

Here is also a completely untested, concept, demo script that you could put on any item.

It must be used as a passive script, but should allow mid-flight changes in direction to any projectile weapon.
 
//Script to control the child weapon of an item, mid-flight
//This is a passive item script and must run as such.
//v0.1, 16th September, 2019, by ZoriaRPG.
//v0.2, Fixed a typo,

item script passive_weapon_dir_control
{
	void run()
	{
		lweapon child; int currentbutton;
		for ( int q = Screen->NumLWeapons(); q > 0; --q ) //match the child weapon of this item to it
		{
			lweapon temp = Screen->LoadLWeapon(q);
			if ( temp->Parent == this->ID )
			{
				child = temp; break;
			}
		}
		if ( !child ) Quit();
		while(child->isValid())
		{
			if ( Hero->ItemA == this->ID ) 
			{
				currentbutton = CB_A;
			}
			else if ( Hero->ItemB == this->ID ) 
			{
				currentbutton = CB_B;
			}
			else currentbutton = 0;
			
			if ( currentbutton && Input->Button[currentbutton] )
			{
				//holding down the item button
				if ( Input->Button[CB_UP] ) 
				{
					if ( Input->Button[CB_LEFT] ) 
					{
						child->Dir = DIR_LEFTUP;
					}
					else if ( Input->Button[CB_RIGHT] ) 
					{
						child->Dir = DIR_RIGHTUP;
					}
					else child->Dir = DIR_UP;
				}
				else if ( Input->Button[CB_DOWN] ) 
				{
					if ( Input->Button[CB_LEFT] ) 
					{
						child->Dir = DIR_LEFTDOWN;
					}
					else if ( Input->Button[CB_RIGHT] ) 
					{
						child->Dir = DIR_RIGHTDOWN;
					}
					else child->Dir = DIR_DOWN;
				}
				else if ( Input->Button[CB_RIGHT] )  	//'else if', so that we don't clash. 
				{					//Won't conflict with combining with up or down.
					child->Dir = DIR_RIGHT;
				}
				else if ( Input->Button[CB_LEFT] )  	//'else if', so that we don't clash
				{					//Won't conflict with combining with up or down.
					child->Dir = DIR_LEFT;
				}
			}
			Waitframe();
		}
	}
}
Obviously, this could be reduced to messages to weapon scripts in general, or features like this could be combined into the weapon script, but I thought that it would be a novel idea to have a generic passive script for this effect.

notice:This script is offered 'as-is' with no support. If it needs fixes, I, or someone else may provide them, as available time and resources permit.

#5 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 16 September 2019 - 09:16 AM

thanks i'll test it.



#6 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 16 September 2019 - 09:56 AM

Okey so there's the problem: first from 2.53:

I got the error message that say 'unexpected identifier, expecting semicolon or or, on token dir

and there's the error message from 2.55:

Variable NPCD_Boomerang has not been declared (in the line 14)

Type Boom has not been declared (in the line 20)

There is no variable power for the pointer on the left side of -> (in the line 22) 

To be honest i has been trying to importing it for the 2.53 and for the 2.55 version of Zquest. There's any fix for that ? 



#7 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 17 September 2019 - 04:59 AM

Okey so there's the problem: first from 2.53:

I got the error message that say 'unexpected identifier, expecting semicolon or or, on token dir

and there's the error message from 2.55:

Variable NPCD_Boomerang has not been declared (in the line 14)

Type Boom has not been declared (in the line 20)

There is no variable power for the pointer on the left side of -> (in the line 22) 

To be honest i has been trying to importing it for the 2.53 and for the 2.55 version of Zquest. There's any fix for that ?


No, all of this is EXCLUSIVELY for 2.55. I won't make it for any other version as it involves weapons.

Fixed the error on line 20 of script exploderang.

Include std.zh to fix the other issues.

#8 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 17 September 2019 - 09:48 AM

There's a problem: The std.zh is already included but only the line 20 was fixed. The line 14 and 22 is still there.

And i did importing the "Boomerang Control.z" for making the "Boumrang" working but the errors is still the same unformately.



#9 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 25 September 2019 - 09:23 AM

Try:

Change `NPCD_BOOMERANG` to `NPCD_BRANG`

Change `this->Power` to `this->Damage` (That's an LWeapon script, Zoria; lweapons don't have 'Power', that's part of itemdata!)



#10 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 28 September 2019 - 12:15 AM

okey so Link throw it as a normal boomerang (i uses Script1 item type) but the thing is that the boomerang doesn't explode when it touch a solid combo and the boomerang is kinda... hard to control :/ i was wondering if it exist a way to control the boomerang more easily like for exemple holding the boomerang button (without making it explode until it touch a solid combo or until the player press once again at the boomerang button. 




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users