Since you want it per player (which I think is a bad idea but it's your call) then you need to create a new private property called m_Owner of type Mobile in your bow script (like it was suggested before).darksky said:Currently, I didnt change the player mobile, so I have no props to specify a race, just at appearece, so I need work on the mobile, Ill need specify the m_Mobile on the race script, but I need get the weapon script working first and I get those errors
using System;
using Server.Network;
using Server.Items;
namespace Server.Items
{
[FlipableAttribute( 0x13B2, 0x13B1 )]
public class ElvenBow : BaseRanged
{
public override int EffectID{ get{ return 0xF42; } }
public override Type AmmoType{ get{ return typeof( Arrow ); } }
public override Item Ammo{ get{ return new Arrow(); } }
public override WeaponAbility PrimaryAbility{ get{ return WeaponAbility.ParalyzingBlow; } }
public override WeaponAbility SecondaryAbility{ get{ return WeaponAbility.MortalStrike; } }
public override int AosStrengthReq{ get{ return 30; } }
public override int AosMinDamage{ get{ return 16; } }
public override int AosMaxDamage{ get{ return 18; } }
public override int AosSpeed{ get{ return 25; } }
public override int OldStrengthReq{ get{ return 20; } }
public override int OldMinDamage{ get{ return 9; } }
public override int OldMaxDamage{ get{ return 41; } }
public override int OldSpeed{ get{ return 20; } }
public override int DefMaxRange{ get{ return 10; } }
public override int InitMinHits{ get{ return 255; } }
public override int InitMaxHits{ get{ return 255; } }
public override WeaponAnimation DefAnimation{ get{ return WeaponAnimation.ShootBow; } }
[Constructable]
public ElvenBow() : base( 0x13B2 )
{
LootType = LootType.Blessed;
Name = "Elven Bow";
Hue = 1109;
Attributes.SpellChanneling = 1;
Attributes.WeaponSpeed = 20;
Weight = 6.0;
Layer = Layer.TwoHanded;
}
public override void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy )
{
phys = fire = cold = pois = 0;
nrgy = 100;
}
public override bool OnEquip( Mobile from )
{
if ( from.Race != Elf )
{
from.SendMessage( "Only elves may use this weapon." );
return false;
}
else
{
return true;
}
}
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 ( Weight == 7.0 )
Weight = 6.0;
}
}
}
- Error: Scripts\ElficBow.cs: CS0117: (line 56, column 6) 'Server.Mobile' não c
ontém uma definição para 'Race'
You declared the Race property in the PlayerMobile class and not in the Mobile class.darksky said:'Server.Mobile' does not contain a definition for 'Race'
public override bool OnEquip( [COLOR="Blue"]Mobile[/COLOR] from )
You can use google to find a lot of c# tutorials in almost all the languages.darksky said:I agree, I need read come c# tutorials... (If u know any good guide in portuguese... I dont know speak english)
Each race will have a weapon like Arty, its blessed but I wont other race using the item.
I almost got my brain working, its hard, anyway Im trying lol.
using System;
using Server.Network;
using Server.Items;
namespace Server.Items
{
[FlipableAttribute( 0x13B2, 0x13B1 )]
public class ElvenBow : BaseRanged
{
public override int EffectID{ get{ return 0xF42; } }
public override Type AmmoType{ get{ return typeof( Arrow ); } }
public override Item Ammo{ get{ return new Arrow(); } }
public override WeaponAbility PrimaryAbility{ get{ return WeaponAbility.ParalyzingBlow; } }
public override WeaponAbility SecondaryAbility{ get{ return WeaponAbility.MortalStrike; } }
public override int AosStrengthReq{ get{ return 30; } }
public override int AosMinDamage{ get{ return 16; } }
public override int AosMaxDamage{ get{ return 18; } }
public override int AosSpeed{ get{ return 25; } }
public override int OldStrengthReq{ get{ return 20; } }
public override int OldMinDamage{ get{ return 9; } }
public override int OldMaxDamage{ get{ return 41; } }
public override int OldSpeed{ get{ return 20; } }
public override int DefMaxRange{ get{ return 10; } }
public override int InitMinHits{ get{ return 255; } }
public override int InitMaxHits{ get{ return 255; } }
public override WeaponAnimation DefAnimation{ get{ return WeaponAnimation.ShootBow; } }
[Constructable]
public ElvenBow() : base( 0x13B2 )
{
LootType = LootType.Blessed;
Name = "Elven Bow";
Hue = 1109;
Attributes.SpellChanneling = 1;
Attributes.WeaponSpeed = 20;
Weight = 6.0;
Layer = Layer.TwoHanded;
}
public override void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy )
{
phys = fire = cold = pois = 0;
nrgy = 100;
}
public override bool OnEquip( Mobile from )
{
private string m_From;
m_From = from;
if ( m_From is PlayerMobile & m_From.Race != Elf )
{
from.SendMessage( "Only elves may use this weapon." );
return false;
}
else
{
return true;
}
}
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 ( Weight == 7.0 )
Weight = 6.0;
}
}
}
Scripts: Compiling C# scripts...failed (12 errors, 0 warnings)
- Error: Scripts\ElvenBow.cs: CS1513: (line 54, column 2) } esperada
- Error: Scripts\ElvenBow.cs: CS1519: (line 56, column 8) Símbolo '=' inválido
na declaração de membro class, struct ou interface
- Error: Scripts\ElvenBow.cs: CS1519: (line 56, column 14) Símbolo ';' inválido
na declaração de membro class, struct ou interface
- Error: Scripts\ElvenBow.cs: CS1519: (line 57, column 13) Símbolo 'is' inválid
o na declaração de membro class, struct ou interface
- Error: Scripts\ElvenBow.cs: CS1519: (line 57, column 29) Símbolo '&' inválido
na declaração de membro class, struct ou interface
- Error: Scripts\ElvenBow.cs: CS1519: (line 57, column 43) Símbolo '!=' inválid
o na declaração de membro class, struct ou interface
- Error: Scripts\ElvenBow.cs: CS1519: (line 57, column 50) Símbolo ')' inválido
na declaração de membro class, struct ou interface
- Error: Scripts\ElvenBow.cs: CS1519: (line 60, column 17) Símbolo '(' inválido
na declaração de membro class, struct ou interface
- Error: Scripts\ElvenBow.cs: CS0116: (line 63, column 1) Espaço para nome não
contém diretamente membros, como campos ou métodos
- Error: Scripts\ElvenBow.cs: CS1518: (line 69, column 17) Class, delegate, enu
m, interface ou struct esperado
- Error: Scripts\ElvenBow.cs: CS1518: (line 76, column 17) Class, delegate, enu
m, interface ou struct esperado
- Error: Scripts\ElvenBow.cs: CS1022: (line 85, column 1) Definição de espaço p
ara nome ou tipo, ou final do arquivo esperado
Scripts: One or more scripts failed to compile or no script files were found.
private string m_From;
m_From = from;
if ( m_From is PlayerMobile & m_From.Race != Elf )
}
[CommandProperty( AccessLevel.GameMaster )]
public Race Race
{
get{ return m_Race; }
set{ m_Race = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public Race [COLOR="Red"]RaceType[/COLOR]
{
get{ return m_Race; }
set{ m_Race = value; }
}
That will work only if your elves didn't casted a spell that changed their hue or painted themself using an item that changed the hue.darksky said:Im sorry guys... Im so stupid!
I need learn c#... When I get some free time Ill read some guides...
Thank you! I got this script working....
Elves in my shard have a special and different color, so why not?
Code:public override bool OnEquip( Mobile from ) { if ( from.Hue != 33820 ) { from.SendMessage( "Only elves may use this weapon." ); return false; } else { return true; } }
lol