|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#3 (permalink) |
|
Uh, ok Phantom that made no sense to me...
and also I have tried that with a bracelet and I get this error: Scripts: Compiling C# scripts...failed (1 errors, 0 warnings) - Error: Scripts\PrinceOfDarknessL.cs: CS0116: (line 1, column 1) A namespace does not directly contain members such as fields or methods Do I need to add something to all the "using" statements at the top? This is the file code: [code:1]Using System; namespace Server.Items { public class PrinceOfDarknessBracelet : BaseBracelet { [Constructable] public PrinceOfDarknessBracelet() : base( 0x1086 ) { Resistances.Fire = 20; Attributes.LowerManaCost = 15; Attributes.WeaponDamage = 10; Attributes.WeaponSpeed = 3; Attributes.CastSpeed = 4; Weight = 2.5; } public PrinceOfDarknessBracelet( 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(); } } } [/code:1] Note: I have already tried adding "using Server;" to the top and it changes nothing |
|
|
|
|
|
|
#5 (permalink) |
|
er, that last one was the WORST possible example I could have given...I didnt even look at the specific file...
Phantom I meant how do you apply the SkillBonuses attribute to jewelry through code? Here is a better example of what i was trying to do: [code:1] using System; namespace Server.Items { public class ApocBossRing : BaseRing { [Constructable] public ApocBossRing() : base( 0x108a ) { SkillBonuses.Skill_1_Name = Magery; SkillBonuses.Skill_1_Value = 4; SkillBonuses.Skill_2_Name = EvalInt; SkillBonuses.Skill_2_Value = 2; SkillBonuses.Skill_3_Name = Meditation; SkillBonuses.Skill_3_Value = 3; Resistances.Cold = 7; Resistances.Energy = 3; Weight = 5.0; } public ApocBossRing( 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(); } } } [/code:1] If you can't see anything still look under [code:1][Contructable] public ApocBossRing() : base( 0x108a )[/code:1] |
|
|
|
|
|
|
#6 (permalink) |
|
Sorry forgot to post my errors:
- Error: Scripts\ApocBossL.cs: CS0103: (line 10, column 32) The name 'Magery' does not exist in the class or namespace 'Server.Items.ApocBossRing' - Error: Scripts\ApocBossL.cs: CS0103: (line 12, column 32) The name 'EvalInt' does not exist in the class or namespace 'Server.Items.ApocBossRing' - Error: Scripts\ApocBossL.cs: CS0103: (line 14, column 32) The name 'Meditation' does not exist in the class or namespace 'Server.Items.ApocBossRing' I'm thinkin I need a new namespace or using statement? |
|
|
|
|
|
|
#8 (permalink) |
|
Bad Boy
Join Date: Jun 2003
Posts: 80
|
ok It works on Beta 33r2
here you go i had to redo your script but got it to work[code:1]using System; using Server.Network; using Server.Items; namespace Server.Items { public class ApocBossRing : BaseRing { public SkillMod m_SkillMod0; public SkillMod m_SkillMod1; public SkillMod m_SkillMod2; [Constructable] public ApocBossRing() : this( 0 ) { } [Constructable] public ApocBossRing( int hue ) : base( 0x108a ) { Weight = 5.0; Resistances.Cold = 7; Resistances.Energy = 3; } public ApocBossRing( 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(); if ( Parent is Mobile ) { m_SkillMod0 = new DefaultSkillMod( SkillName.Magery, true, 4 ); ((Mobile)Parent).AddSkillMod( m_SkillMod0 ); m_SkillMod1 = new DefaultSkillMod( SkillName.EvalInt, true, 2 ); ((Mobile)Parent).AddSkillMod( m_SkillMod1 ); m_SkillMod2 = new DefaultSkillMod( SkillName.MagicResist, true, 3 ); ((Mobile)Parent).AddSkillMod( m_SkillMod2 ); } } public override bool OnEquip( Mobile from ) { m_SkillMod0 = new DefaultSkillMod( SkillName.Magery, true, 4 ); from.AddSkillMod( m_SkillMod0 ); m_SkillMod1 = new DefaultSkillMod( SkillName.EvalInt, true, 2 ); from.AddSkillMod( m_SkillMod1 ); m_SkillMod2 = new DefaultSkillMod( SkillName.MagicResist, true, 3 ); from.AddSkillMod( m_SkillMod2 ); return true; } public override void OnRemoved( object parent ) { if ( parent is Mobile ) { ((Mobile)parent).RemoveStatMod("Bane" ); ((Mobile)parent).Hits = ((Mobile)parent).HitsMax; } if ( m_SkillMod0 != null ) { m_SkillMod0.Remove(); m_SkillMod0 = null; } if ( m_SkillMod1 != null ) { m_SkillMod1.Remove(); m_SkillMod1 = null; } if ( m_SkillMod2 != null ) { m_SkillMod2.Remove(); m_SkillMod2 = null; } } public override void OnSingleClick( Mobile from ) { this.LabelTo( from, Name ); this.LabelTo( from, "Mage Power!" ); } } }[/code:1] Just a suggestion but i would change this line of code [code:1][Constructable] public ApocBossRing( int hue ) : base( 0x108a ) { Weight = 5.0; Resistances.Cold = 7; Resistances.Energy = 3; } [/code:1] to this so the ring has a name [code:1] [Constructable] public ApocBossRing( int hue ) : base( 0x108a ) { Weight = 5.0; Resistances.Cold = 7; Resistances.Energy = 3; Name = "ApocBossRing"; } [/code:1] |
|
|
|
|
|
#11 (permalink) |
|
Join Date: Aug 2003
Posts: 2
|
Hey Zidane,
Why don't you try this : [code:1]using System; namespace Server.Items { public class ApocBossRing : BaseRing { [Constructable] public ApocBossRing() : base( 0x108a ) { SkillBonuses.Skill_1_Name = SkillName.Magery; SkillBonuses.Skill_1_Value = 4; SkillBonuses.Skill_2_Name = SkillName.EvalInt; SkillBonuses.Skill_2_Value = 2; SkillBonuses.Skill_3_Name = SkillName.Meditation; SkillBonuses.Skill_3_Value = 3; Resistances.Cold = 7; Resistances.Energy = 3; Weight = 5.0; } public ApocBossRing( 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(); } } } [/code:1] That should work for you.....or whoever else. |
|
|
|
|
|
#12 (permalink) | |
|
Bad Boy
Join Date: Jun 2003
Posts: 80
|
Quote:
|
|
|
|
|
|
|
#13 (permalink) |
|
Sorry for the bump but I havent been able to check up on this post for a long time.
Noobus I tried youre code and the scripts all compiled fine but the ring does not have any skill bonuses...I read youre code and it looks like it should work but it doesnt... And also I do not want to change the name because it is not meant to be a super-rare or one-of-a-kind or anything like that; just a kickass ring found on a very strong monster's corpse that you can add directly so you dont waste 2 or 3 years of your life changing the attributes. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|