|
||
|
|||||||
| RunUO Post Archive The Archvie |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Novice
|
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"; Code:
public PoisonedArrow( int amount ) : base( 0xF3F )
{
Name = "poisoned arrow";
Stackable = true;
Weight = 0.1;
Amount = amount;
}
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"; Code:
public PoisonedBolt( int amount ) : base( 0x1BFB )
{
Name = "poisoned bolt";
Stackable = true;
Weight = 0.1;
Amount = amount;
}
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;
}
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;
}
Code:
if ( Poison != null && PoisonCharges > 0 )
{
--PoisonCharges;
if ( Utility.RandomDouble() >= 0.75 ) // 25% chance to poison
defender.ApplyPoison( attacker, Poison );
}
-Hal |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|