Uhmmm I've a low knowledge of C# (and English
)... but with the reference and reading the other example... I've done this...
But: I don't know how to raise the skill (I've tryed to use .Value props... but it is a props so it's read only..), I've tryed to get other props but uhmm I've failed...
So... is there a complete references to props, method, ecc..?
Here the script (the messages are in italian ^^):
[code:1]
using System;
using Server.Targeting;
using Server.Items;
namespace Server.SkillHandlers
{
public class Begging
{
public static void Initialize()
{
SkillInfo.Table[6].Callback = new SkillUseCallback( OnUse );
}
public static TimeSpan OnUse( Mobile m )
{
m.Target = new Begging.BeggingTarget( m );
m.RevealingAction();
m.SendMessage( "A chi vuoi chiedere la carita'?" );
return TimeSpan.FromSeconds( 10.0 );
}
private class BeggingTarget : Target
{
private Mobile m_Begger;
public BeggingTarget( Mobile begger ) : base ( 1, false, TargetFlags.None )
{
m_Begger = begger;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is Mobile )
{
Mobile targ = (Mobile)targeted;
Container pack = m_Begger.Backpack;
int begMod = (int) (m_Begger.Skills[SkillName.Begging].Value * 100);
int begStr = targ.Str; // I've chosen a random prop
int iGold = (int) ((begMod / begStr) + 1);
if (begMod > begStr)
{
pack.DropItem( new Gold( iGold ) );
m_Begger.SendMessage("Hai convinto {0} a darti dei soldi", targ.Name);
}
else
{
m_Begger.SendMessage("{0} si rifiuta di darti dei soldi", targ.Name);
}
}
else
{
m_Begger.SendMessage( "Solo su esseri viventi" );
}
}
}
}
}
[/code:1]