Jump to content

Photo

Wand-made arrows pierce enemies


  • Please log in to reply
5 replies to this topic

#1 Jared

Jared

    Bring back what once was mine, what once was mine.

  • Members
  • Real Name:Jared
  • Gender:Male
  • Location:Massachusetts

Posted 22 February 2021 - 07:24 PM

https://www.purezc.n...76540&p=1060126

 

As seen in this thread, arrows made by using the wand item, pierce enemies instead of hitting and disappearing.

 

2.55 build 85.


Edited by Jared, 23 February 2021 - 07:55 AM.


#2 Mitchfork

Mitchfork

    no fun. not ever.

  • Members
  • Real Name:Mitch
  • Gender:Male
  • Location:Alabama

Posted 25 February 2021 - 01:31 PM

This is due to behavior where arrows created by any source other than the native bow item pierce enemies by default. 

 

I don't think there's a direct way to set this via scripting.  You have indirect control over this via setting lweapon->Parent to an arrow item with an unchecked "Penetrate Enemies" flag.

 

Zoria mentioned that this is a bug here: https://www.purezc.n...76540&p=1060229

 

I don't disagree, but this behavior has probably been around long enough that somebody may have relied on it. I can update my scripts since I'm still in development but I have a bow item that assumes this behavior.  Maybe "Script-created arrows don't pierce by default" could be a Quest Script Setting or Quest Option?


  • Twilight Knight likes this

#3 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Gender:Male
  • Location:Washington

Posted 25 February 2021 - 11:56 PM

I can confirm that fixing this bug without a quest rule would break older quests. I have quests that rely upon the piercing behaviour.


  • Mitchfork likes this

#4 ZoriaRPG

ZoriaRPG

    The Timelord

  • ZC Developers
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 26 February 2021 - 02:12 PM

I can confirm that fixing this bug without a quest rule would break older quests. I have quests that rely upon the piercing behaviour.

 

Wait a moment... CreateLWeapon(LW_ARROW) always pierced in 2.50? I do not recall that. I would expect penetration to be off by default.

 

Also, the original report seems to only apply to the Weapon Type field in the 2.55 item editor. I think that CreateLWeaponEx() would be able to circumvent this, and that perhaps in this case the flag 'Allow Magic w/o Book' is being used when you set the wand to create arrow weapons.


This is due to behavior where arrows created by any source other than the native bow item pierce enemies by default. 

 

I don't think there's a direct way to set this via scripting.  You have indirect control over this via setting lweapon->Parent to an arrow item with an unchecked "Penetrate Enemies" flag.

 

Zoria mentioned that this is a bug here: https://www.purezc.n...76540&p=1060229

 

I don't disagree, but this behavior has probably been around long enough that somebody may have relied on it. I can update my scripts since I'm still in development but I have a bow item that assumes this behavior.  Maybe "Script-created arrows don't pierce by default" could be a Quest Script Setting or Quest Option?

 

 

If you give the player the magic book, and in the Item Editor, under Flags for the Wand, deselect  'Allow Magic w/o Book;, do the arrows still pierce?


This is the block of code in question, and why I think this is happening in 2.55, but why I think that it should not be the case for script-generated weapons: Those simply rely on the flags for the highest level arrow in inventory...
 
 

// Penetrating weapons
	if((wpnId==wArrow || wpnId==wBeam) && !cannotpenetrate())
	{
		int item=enemyHitWeapon;
		
		if(wpnId==wArrow)
		{
			if(item<0)
				item=current_item_id(itype_arrow);
				
			if(item>=0 && (itemsbuf[item].flags&ITEM_FLAG1))
				return 0;
		}
		
		else
		{
			if(item<0)
				item=current_item_id(itype_sword);
				
			if(item>=0 && (itemsbuf[item].flags&ITEM_FLAG3))
				return 0;
		}
	}


#5 P-Tux7

P-Tux7

    Illustrious

  • Members

Posted 01 March 2021 - 11:51 AM

This is the block of code in question, and why I think this is happening in 2.55, but why I think that it should not be the case for script-generated weapons: Those simply rely on the flags for the highest level arrow in inventory...

This makes no sense, because you might want different kinds of script-generated arrows to pierce or not, and also not have the Arrow item influence that.



#6 Venrob

Venrob

    Scripter / Dev

  • ZC Developers
  • Real Name:Rob
  • Gender:Male

Posted Yesterday, 10:34 AM

This makes no sense, because you might want different kinds of script-generated arrows to pierce or not, and also not have the Arrow item influence that.

Firstly, they are not script-generated. Secondly, they are LW_MAGIC, not LW_ARROW; but they have 'lweapon->Weapon = LW_ARROW;'.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users