1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Random Attributes to items?

Discussion in 'Script Support' started by SomeDude, May 4, 2014.

  1. SomeDude
    Offline

    SomeDude New Member

    Joined:
    Mar 20, 2013
    Messages:
    27
    Likes Received:
    0
    Code (C#):
    1.  
    2. using System;
    3. using Server;
    4. using Server.Items;
    5.  
    6.  
    7. namespace Server.Items
    8. {
    9.               public class SignofChaos: ChaosShield
    10. {
    11.  
    12.         public override int InitMinHits{ get{ return 255; } }
    13.         public override int InitMaxHits{ get{ return 255; } }
    14.  
    15.         public override int BaseColdResistance{ get{ return 5; } }
    16.         public override int BaseEnergyResistance{ get{ return 5; } }
    17.         public override int BasePhysicalResistance{ get{ return 5; } }
    18.         public override int BasePoisonResistance{ get{ return 5; } }
    19.         public override int BaseFireResistance{ get{ return 5; } }
    20.            
    21.               [Constructable]
    22.               public SignofChaos()
    23. {
    24.  
    25.                           Weight = 5;
    26.                           Name = "Sign of Chaos";
    27.                           Hue = 1092;
    28.            
    29.               Attributes.AttackChance = 15;
    30.               Attributes.BonusHits = 20;
    31.               Attributes.CastSpeed = 2;
    32.               Attributes.DefendChance = 15;
    33.  
    34.  
    35.                   }
    36.               public SignofChaos( Serial serial ) : base( serial )
    37.                       {
    38.                       }
    39.            
    40.               public override void Serialize( GenericWriter writer )
    41.                       {
    42.                           base.Serialize( writer );
    43.                           writer.Write( (int) 0 );
    44.                       }
    45.            
    46.               public override void Deserialize(GenericReader reader)
    47.                       {
    48.                           base.Deserialize( reader );
    49.                           int version = reader.ReadInt();
    50.                       }
    51.                   }
    52.               }
    53.  
    Tryin to make like randomly picks from 1 to 15 any ideals on this ?
    Attributes.AttackChance = 1, 15;
    Attributes.BonusHits = 1, 20;
    Attributes.CastSpeed = 1, 2;
    Attributes.DefendChance = 1, 15;

    getting theses errors
    Code (C#):
    1. ----------------------------------------------------------------------------
    2. ServUO - [http://www.servuo.com] Version 0.5, Build 5210.7645
    3. Publish 54
    4. Core: Running with arguments: -debug
    5. Core: Optimizing for 2 64-bit processors
    6. RandomImpl: CSPRandom (Software)
    7. Scripts: Compiling C# scripts...Failed with: 1 errors, 0 warnings
    8. Errors:
    9. + Customs/Items/Shields/SignofChaos.cs:
    10.     CS1002: Line 29: ; expected
    11.     CS1525: Line 29: Invalid expression term ','
    12.     CS1002: Line 29: ; expected
    13.     CS1002: Line 30: ; expected
    14.     CS1525: Line 30: Invalid expression term ','
    15.     CS1002: Line 30: ; expected
    16.     CS1002: Line 31: ; expected
    17.     CS1525: Line 31: Invalid expression term ','
    18.     CS1002: Line 31: ; expected
    19.     CS1002: Line 32: ; expected
    20.     CS1525: Line 32: Invalid expression term ','
    21.     CS1002: Line 32: ; expected
    22. Scripts: One or more scripts failed to compile or no script files were found.
    23. - Press return to exit, or R to try again.
    24.  
     
    #1 SomeDude, May 4, 2014
    Last edited: May 4, 2014
  2. SomeDude
    Offline

    SomeDude New Member

    Joined:
    Mar 20, 2013
    Messages:
    27
    Likes Received:
    0
    Ok lol figured it out used the Utility.Random ... method like so sorry all :)

    Attributes.AttackChance = Utility.RandomMinMax(1, 15);
    Attributes.BonusHits = Utility.RandomMinMax(1, 20);
    Attributes.CastSpeed = Utility.RandomMinMax(1, 2);
    Attributes.DefendChance = Utility.RandomMinMax(1, 15);
     
    • Helpful Helpful x 1
Similar Threads: Random Attributes
Forum Title Date
Script Support Lookpack.cs how to add random item Nov 14, 2017
Script Support Need help how to make reward drop in back pack randomly Nov 13, 2017
Custom Releases XmasSnowFlakes1.1 with random hue and Player Name Nov 7, 2017
Script Support Random Player Names on item Nov 6, 2017
Support Random wall spawn Sep 29, 2017
Script Support Random hue public gates Sep 3, 2017
Archived Bug Reports Huntmaster rewards are chosen not random- proof inside Jul 2, 2017