View Single Post
  #5  
Old 04-04-2012, 01:53 AM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

I think you might have to list the items in a list then random select an item(line by number) to use. This may however have a parse problem where you are transfering built in code to string types(listing) and back again.(am I sick of parsing problems yes I am)

might have some syntax errors in the following, but something like, (yes this came from Kodiak )


Code:
List<Damage> DamageList = new List<Damage>
{
    new Damage ("ElecBatteryFailure"),
    new Damage ("ElecGeneratorFailure")
// add each damage type(note add comma on preceeding line)

};

    internal class Damage 
   {
        public string EDamageType { get; set; }
        public Damage(string eDamageType)
       {
            this.EDamageType = eDamageType;
       }
   }


//random selection
Random rand = new Random();          

int i = 0;
if (DamageList.Count > 0)
i = rand.Next(0, DamageList.Count);
aircraft.hitNamed(part.NamedDamageTypes.DamageList[i].EDamageType);
});

Last edited by Smokeynz; 04-04-2012 at 02:29 AM.
Reply With Quote