|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Newbie
Join Date: Oct 2004
Posts: 46
|
I want to script a creature that has a small chance to drop ONE of a few items in your pack. I tryed copying the Dark Father script, but they guys never drop anything here is what i did any help would be great
using System; using System.Collections; using Server; using Server.Items; using System.Collections.Generic; namespace Server.Mobiles { [CorpseName( "a demon knight corpse" )] public class DeamonLord : BaseCreature { public override bool IgnoreYoungProtection { get { return Core.ML; } } public static Type[] ArtifactRarity10 { get { return m_ArtifactRarity10; } } public static Type[] ArtifactRarity11 { get { return m_ArtifactRarity11; } } private static Type[] m_ArtifactRarity10 = new Type[] { typeof( MelisandesHairDye ) }; private static Type[] m_ArtifactRarity11 = new Type[] { typeof( TotemOfVoid ), typeof( CrimsonCincture ), typeof( CrystallineRing ), typeof( MinaxsArmor ), typeof( KeeoneansChainMail ), typeof( VesperOrderShield ), typeof( VesperChaosShield ), typeof( GypsyHeaddress ), typeof( NystulsWizardsHat ), typeof( JesterHatOfChuckles ), typeof( BlackthornsKryss ), typeof( SwordOfJustice ), typeof( GeoffreysAxe ), typeof( ClaininsSpellbook ), typeof( LordBritishThroneDeed ), typeof( TreatiseonAlchemyTalisman ), typeof( PrimerOnArmsTalisman ), typeof( MyBookTalisman ), typeof( TalkingtoWispsTalisman ), typeof( GrammarOfOrchishTalisman ), typeof( BirdsofBritanniaTalisman ), typeof( TheLifeOfTravelingMinstrelTalisman ), typeof( MaceAndShieldGlasses ), typeof( GlassesOfTheArts ), typeof( FoldedSteelGlasses ), typeof( TradesGlasses ), typeof( LyricalGlasses ), typeof( AnthropomorphistGlasses ), typeof( LightOfWayGlasses ), typeof( NecromanticGlasses ), typeof( WizardsCrystalGlasses ), typeof( MaritimeGlasses ), typeof( TreasuresAndTrinketsGlasses ), typeof( PoisonedGlasses ), typeof( HuntersHeaddress ), typeof( SpiritOfTheTotem ) }; public static Item CreateRandomArtifact() { if ( !Core.AOS ) return null; int count = ( m_ArtifactRarity10.Length * 5 ) + ( m_ArtifactRarity11.Length * 4 ); int random = Utility.Random( count ); Type type; if ( random < ( m_ArtifactRarity10.Length * 5 ) ) { type = m_ArtifactRarity10[random / 5]; } else { random -= m_ArtifactRarity10.Length * 5; type = m_ArtifactRarity11[random / 4]; } return Loot.Construct( type ); } public static Mobile FindRandomPlayer( BaseCreature creature ) { List<DamageStore> rights = BaseCreature.GetLootingRights( creature.DamageEntries, creature.HitsMax ); for ( int i = rights.Count - 1; i >= 0; --i ) { DamageStore ds = rights[i]; if ( !ds.m_HasRight ) rights.RemoveAt( i ); } if ( rights.Count > 0 ) return rights[Utility.Random( rights.Count )].m_Mobile; return null; } public static void DistributeArtifact( BaseCreature creature ) { DistributeArtifact( creature, CreateRandomArtifact() ); } public static void DistributeArtifact( BaseCreature creature, Item artifact ) { DistributeArtifact( FindRandomPlayer( creature ), artifact ); } public static void DistributeArtifact( Mobile to ) { DistributeArtifact( to, CreateRandomArtifact() ); } public static void DistributeArtifact( Mobile to, Item artifact ) { if ( to == null || artifact == null ) return; Container pack = to.Backpack; if ( pack == null || !pack.TryDropItem( to, artifact, false ) ) to.BankBox.DropItem( artifact ); to.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed on you. } public static int GetArtifactChance( Mobile boss ) { if ( !Core.AOS ) return 0; int luck = LootPack.GetLuckChanceForKiller( boss ); int chance; if ( boss is DeamonLord ) chance = 1500 + (luck / 5); else chance = 750 + (luck / 10); return chance; } public static bool CheckArtifactChance( Mobile boss ) { return GetArtifactChance( boss ) > Utility.Random( 100000 ); } public override WeaponAbility GetWeaponAbility() { switch ( Utility.Random( 3 ) ) { default: case 0: return WeaponAbility.DoubleStrike; case 1: return WeaponAbility.WhirlwindAttack; case 2: return WeaponAbility.CrushingBlow; } } public override void OnDeath( Container c ) { base.OnDeath( c ); if ( !Summoned && !NoKillAwards && DeamonLord.CheckArtifactChance( this ) ) DeamonLord.DistributeArtifact( this ); } [Constructable] public DeamonLord() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 ) { Name = NameList.RandomName( "demon knight" ); Title = "the Dark Father"; Body = 792; BaseSoundID = 0x165; SetStr( 500 ); SetDex( 100 ); SetInt( 900 ); SetHits( 30000 ); SetMana( 5000 ); SetDamage( 17, 21 ); SetDamageType( ResistanceType.Physical, 20 ); SetDamageType( ResistanceType.Fire, 20 ); SetDamageType( ResistanceType.Cold, 20 ); SetDamageType( ResistanceType.Poison, 20 ); SetDamageType( ResistanceType.Energy, 20 ); SetResistance( ResistanceType.Physical, 30 ); SetResistance( ResistanceType.Fire, 30 ); SetResistance( ResistanceType.Cold, 30 ); SetResistance( ResistanceType.Poison, 30 ); SetResistance( ResistanceType.Energy, 30 ); SetSkill( SkillName.DetectHidden, 80.0 ); SetSkill( SkillName.EvalInt, 100.0 ); SetSkill( SkillName.Magery, 100.0 ); SetSkill( SkillName.Meditation, 120.0 ); SetSkill( SkillName.MagicResist, 150.0 ); SetSkill( SkillName.Tactics, 100.0 ); SetSkill( SkillName.Wrestling, 120.0 ); Fame = 18000; Karma = -18000; VirtualArmor = 64; } public override void GenerateLoot() { AddLoot( LootPack.SuperBoss, 2 ); AddLoot( LootPack.HighScrolls, Utility.RandomMinMax( 6, 60 ) ); } public override bool BardImmune{ get{ return !Core.SE; } } public override bool Unprovokable{ get{ return Core.SE; } } public override bool Uncalmable{ get{ return Core.SE; } } public override Poison PoisonImmune{ get{ return Poison.Lethal; } } public override int TreasureMapLevel{ get{ return 1; } } private static bool m_InHere; public override void OnDamage( int amount, Mobile from, bool willKill ) { if ( from != null && from != this && !m_InHere ) { m_InHere = true; AOS.Damage( from, this, Utility.RandomMinMax( 8, 20 ), 100, 0, 0, 0, 0 ); MovingEffect( from, 0xECA, 10, 0, false, false, 0, 0 ); PlaySound( 0x491 ); m_InHere = false; } } public DeamonLord( Serial serial ) : base( serial ) { } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); } } } |
|
|
|
|
|
#3 (permalink) |
|
Forum Novice
Join Date: Jan 2008
Posts: 162
|
When you fix something yourself you should always post the fix in case someone else searches for this and needs help with the same thing. Theres nothing worse than doing a search, finding something you need help with, and then seeing "fixed it myself" as the solution.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|