Full Version : Rend Error
xmlspawner >>Scripting Support >>Rend Error


<< Prev | Next >>

Erica- 03-03-2007
Hi not sure what to change here but i get this error
CODE
Errors:
+ Custom Scripts 2.0/World Book Travel/Rend.cs:
   CS0029: Line 59: Cannot implicitly convert type 'System.Collections.Generic.
List<Server.Mobiles.DamageStore>' to 'System.Collections.ArrayList'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
and heres the script any idea what i need to change to get it to complie Thank You.
CODE
using System;
using Server.Items;
using System.Collections;

namespace Server.Mobiles
{
[CorpseName( "Rends corpse" )]
public class Rend : BaseCreature
{
 public static Type[] Artifacts = new Type[]
 {
  typeof( PadsOfTheCuSidhe ),
  typeof( RobeOfTheEquinox ),
  typeof( RobeOfTheEclipse )
 };

 [Constructable]
 public Rend() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.1, 0.4 )
 {
  Body = 276;
  Name = "Rend";
  BaseSoundID = 362;
  Hue = 1175;

  SetStr( 1270, 1280 );
  SetDex( 365, 370 );
  SetInt( 635, 650 );

  SetHits( 5280, 6030 );

  SetDamage( 8, 11 );

  SetDamageType( ResistanceType.Physical, 100 );

  SetResistance( ResistanceType.Physical, 75, 85 );
  SetResistance( ResistanceType.Fire, 80, 85 );
  SetResistance( ResistanceType.Cold, 45, 50 );
  SetResistance( ResistanceType.Poison, 40, 45 );
  SetResistance( ResistanceType.Energy, 50, 55 );

  SetSkill( SkillName.Anatomy, 67.0, 70.0 );
  SetSkill( SkillName.MagicResist, 97.9, 100.0 );
  SetSkill( SkillName.Tactics, 141.4, 145.0 );
  SetSkill( SkillName.Wrestling, 148.5, 155.0 );

  Fame = 10000;
  Karma = -10000;
 }

 public override void GenerateLoot()
 {
       AddLoot( LootPack.SuperBoss, 2 );
  AddLoot( LootPack.HighScrolls, Utility.RandomMinMax( 20, 40 ) );

           }

 public override void OnDeath( Container c )
 {
  ArrayList list = GetLootingRights( this.DamageEntries, this.HitsMax );
  bool awarded = false;
  for ( int i = 0; i < list.Count; ++i )
  {
   DamageStore ds = (DamageStore)list[i];

   if ( ds.m_HasRight && !awarded )
   {
    Mobile m = ds.m_Mobile;
    int luck = m.Luck;
    double chance = ((double)luck + (double)Fame)/500000;
    if ( chance > 0.1 )
     chance = 0.1;

    if ( Utility.RandomDouble() < chance )
    {
     Item item = (Item)Activator.CreateInstance( Artifacts[Utility.Random(Artifacts.Length)] );

     m.AddToBackpack( item );
     m.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed to you.
    }
   }
  }
  base.OnDeath( c );
 }

 public override bool HasBreath{ get{ return true; } } // fire breath enabled

 public Rend( Serial serial ) : base( serial )
 {
 }

 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );

  writer.Write( (int) 0 ); // version
 }

 public override void Deserialize( GenericReader reader )
 {
  base.Deserialize( reader );

  int version = reader.ReadInt();
 }
}
}



ArteGordon- 03-03-2007
QUOTE

public override void OnDeath( Container c )
{
  List<DamageStore> list = GetLootingRights(this.DamageEntries, this.HitsMax); 
bool awarded = false;

Erica- 03-04-2007
Thanks worked one more question see this part
CODE
Mobile m = ds.m_Mobile;
    int luck = m.Luck;
    double chance = ((double)luck + (double)Fame)/500000;
    if ( chance > 0.1 )
     chance = 0.1;
what number would i change that 0.1 to for them to get the robe 50% of the chance. meaning to have 50% chance of getting it.

ArteGordon- 03-04-2007
The chance is based on luck and fame. So with luck of 1000 and fame of 10000, your chance value would be 11000/500000, or 0.022.
That gives you a 2% chance of dropping.

If you want it to just drop 50% of the time, independent of luck or fame, just change all of this

CODE

   Mobile m = ds.m_Mobile;
   int luck = m.Luck;
   double chance = ((double)luck + (double)Fame)/500000;
   if ( chance > 0.1 )
    chance = 0.1;

   if ( Utility.RandomDouble() < chance )


to this

CODE


   if ( Utility.RandomDouble() < 0.5)

Erica- 03-04-2007
QUOTE (ArteGordon @ March 04, 2007 06:23 am)
The chance is based on luck and fame. So with luck of 1000 and fame of 10000, your chance value would be 11000/500000, or 0.022.
That gives you a 2% chance of dropping.

If you want it to just drop 50% of the time, independent of luck or fame, just change all of this

CODE

   Mobile m = ds.m_Mobile;
   int luck = m.Luck;
   double chance = ((double)luck + (double)Fame)/500000;
   if ( chance > 0.1 )
    chance = 0.1;

   if ( Utility.RandomDouble() < chance )


to this

CODE


   if ( Utility.RandomDouble() < 0.5)

Ok did this heres the script you can see what i comment out with this --->/* */
and complies tested but test and only keeps giving the RobeOfTheEquinox only any idea why.
CODE
using System;
using Server.Items;
using System.Collections;
using System.Collections.Generic;
using Server;


namespace Server.Mobiles
{
[CorpseName( "Rends corpse" )]
public class Rend : BaseCreature
{
 public static Type[] Artifacts = new Type[]
 {
  typeof( PadsOfTheCuSidhe ),
  typeof( RobeOfTheEquinox ),
  typeof( RobeOfTheEclipse )
 };

 [Constructable]
 public Rend() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.1, 0.4 )
 {
  Body = 276;
  Name = "Rend";
  BaseSoundID = 362;
  Hue = 1175;

  SetStr( 1270, 1280 );
  SetDex( 365, 370 );
  SetInt( 635, 650 );

  SetHits( 5280, 6030 );

  SetDamage( 10, 18 );

  SetDamageType( ResistanceType.Physical, 100 );

  SetResistance( ResistanceType.Physical, 75, 85 );
  SetResistance( ResistanceType.Fire, 80, 85 );
  SetResistance( ResistanceType.Cold, 45, 50 );
  SetResistance( ResistanceType.Poison, 40, 45 );
  SetResistance( ResistanceType.Energy, 50, 55 );

  SetSkill( SkillName.Anatomy, 67.0, 70.0 );
  SetSkill( SkillName.MagicResist, 97.9, 100.0 );
  SetSkill( SkillName.Tactics, 141.4, 145.0 );
  SetSkill( SkillName.Wrestling, 148.5, 155.0 );

  Fame = 10000;
  Karma = -10000;
 }

 public override void GenerateLoot()
 {
       AddLoot( LootPack.SuperBoss, 2 );
  AddLoot( LootPack.HighScrolls, Utility.RandomMinMax( 20, 40 ) );

           }

 public override void OnDeath( Container c )
 {
 List<DamageStore> list = GetLootingRights(this.DamageEntries, this.HitsMax);  
  bool awarded = false;
  for ( int i = 0; i < list.Count; ++i )
  {
   DamageStore ds = (DamageStore)list[i];

   if ( ds.m_HasRight && !awarded )
   {
    Mobile m = ds.m_Mobile;
    /*int luck = m.Luck;
    double chance = ((double)luck + (double)Fame)/500000;
    if ( chance > 0.1 )
     chance = 0.1;

    if ( Utility.RandomDouble() < chance )*/
    if ( Utility.RandomDouble() < 0.5)
                             {
     
                                   Item item = (Item)Activator.CreateInstance( Artifacts[Utility.Random(Artifacts.Length)] );

     m.AddToBackpack( item );
     m.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed to you.
    }
   }
  }
  base.OnDeath( c );
 }

 public override bool HasBreath{ get{ return true; } } // fire breath enabled

 public Rend( Serial serial ) : base( serial )
 {
 }

 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );

  writer.Write( (int) 0 ); // version
 }

 public override void Deserialize( GenericReader reader )
 {
  base.Deserialize( reader );

  int version = reader.ReadInt();
 }
}
}


ArteGordon- 03-04-2007
All three artifacts will drop given the code that you posted. You just got unlucky when testing it.