Go Back   RunUO - Ultima Online Emulation > RunUO > RunUO Post Archive

RunUO Post Archive The Archvie

Reply
 
Thread Tools Display Modes
Old 09-09-2004, 10:50 AM   #1 (permalink)
Forum Novice
 
Halciet's Avatar
 
Join Date: Jan 2004
Location: Chapel Hill, NC
Age: 26
Posts: 165
Send a message via ICQ to Halciet Send a message via AIM to Halciet
Default How to make bows/crossbows fire poisoned bolts/arrows

Since a good deal of people have trouble figuring out how to make bows fire poisoned arrows, I figured I'd add this to the FAQ. This will show you how to make a new group of bolts/arrows with a fixed poison level and make it so if the user has one in their pack and fire a bow or crossbow, that ammunition will be used.


1. Open Scripts\Items\Resources\Arrows\Arrow.cs; use the find and replace to find all instances of "Arrow" and replace them with with "PoisonedArrow"

In the constructor, add
Code:
Name = "poisoned arrow";
So that it looks like this:

Code:
public PoisonedArrow( int amount ) : base( 0xF3F )
{
        Name = "poisoned arrow";
        Stackable = true;
	Weight = 0.1;
	Amount = amount;
}
If you would like, you can also add a new Hue to help differentiate between normal arrows.

Save the file as "PoisonedArrow.cs"



2. Open Scripts\Items\Resources\Arrows\Bolt.cs; use the find and replace to find all instances of "Bolt" and replace them with "PoisonedBolt"

In the constructor, add

Code:
 Name = "poisoned bolt";
So that it looks like this:

Code:
public PoisonedBolt( int amount ) : base( 0x1BFB )
{
        Name = "poisoned bolt";
	Stackable = true;
	Weight = 0.1;
	Amount = amount;
}
If you would like, you can also add a new Hue to help differentiate between normal bolts.

Save the file as "PoisonedBolt.cs"



3. Open Scripts\Items\Weapons\Ranged\BaseRanged.cs

In the constructor, add "Poison = Poison.Lesser;" so that it looks like:

Code:
public BaseRanged( int itemID ) : base( itemID )
{
     Poison = Poison.Lesser;
}
This will make all bows automatically poisoned, but they won't fire off the poison or display the property since the charges will be set to 0. You can change the poison level to whatever you want here, but for balance sake I just left it at Lesser.

In OnFired, add this code after "Container pack = attacker.Backpack;"

Code:
if( attacker.Player && pack != null && (( AmmoType == typeof(Arrow) && pack.ConsumeTotal( typeof( PoisonedArrow ), 1 ) ) || ( AmmoType == typeof(Bolt) && pack.ConsumeTotal( typeof( PoisonedBolt), 1 ) ) ) )
{
	PoisonCharges = 1;
				
	attacker.MovingEffect( defender, EffectID, 18, 1, false, false );
				
	return true;
}
In OnHit, add this code after "base.OnHit( attacker, defender );"

Code:
if ( Poison != null && PoisonCharges > 0 )
{
	--PoisonCharges;

	if ( Utility.RandomDouble() >= 0.75 ) // 25% chance to poison
		defender.ApplyPoison( attacker, Poison );
}
There. That makes all your archery weapons capable of shooting lesser poison arrows if you have one in your pack. For a higher chance of poisoning, use a SMALLER decimal in the random double equation; I set it to 25% chance (0.75) as I felt the usually 50% would be too unbalancing for ranged attackers. If you have both poisoned arrows and non-poisoned arrows in your pack, it will use up the poisoned ones first. You could add a context menu entry that lets you choose whether or not you want to fire poisoned or non-poisoned, but that's a bit more in-depth. Similarly, you'll probably want to make it so players can craft poison arrows, but as far as making them fireable, this is all you need to do.

-Hal
Halciet is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5