Emme
Member
- ServUO Version
- Publish 57
- Ultima Expansion
- Age Of Shadows
Hello, Ive made this script that is almost finished (this night i will start to setting rewards and then will be finished) and runs perfectly (I attach the item and the experience script that can be added in loot)..
This is a taliisman that can be charged with experience from mobs. Clicking on talisman while it''s weared activate/deactivate talismn improving life rege and mana cost consuming some experience. (this need some mods if someone is interested i can post it). When you use the talisman from your backpack it open a reward gump where you can spend eperience.
This talisman gives also stat bonus of experience / 100 until max value of 15 points.
the question is... i need to add the same bonus mod (exp\100) to all resistance, but when i add it in the method of on equip, the method on remove can't read mod[]. I've tryied to set a private mod method, but I am still not enought skillfull to understand why it does''t work. Someone can help me?
Thank you
the file is talismanoslayer.
if you like it take it. no reference needed. it's all done by me and I am happy when peaple likes my creations
This is a taliisman that can be charged with experience from mobs. Clicking on talisman while it''s weared activate/deactivate talismn improving life rege and mana cost consuming some experience. (this need some mods if someone is interested i can post it). When you use the talisman from your backpack it open a reward gump where you can spend eperience.
This talisman gives also stat bonus of experience / 100 until max value of 15 points.
the question is... i need to add the same bonus mod (exp\100) to all resistance, but when i add it in the method of on equip, the method on remove can't read mod[]. I've tryied to set a private mod method, but I am still not enought skillfull to understand why it does''t work. Someone can help me?
Thank you
the file is talismanoslayer.
Code:
using System;
using Server.Mobiles;
using Server.Gumps;
using Server.Network;
namespace Server.Items
{
public class TalismanoSlayer : Item
{
private int talismano_exp;
private int incremento;
public bool TalisAttivo;
/* private ResistanceMod[] mods = new ResistanceMod[5] here i've tryed to do private method
{
new ResistanceMod( ResistanceType.Fire, 5 ),
new ResistanceMod( ResistanceType.Poison, 5 ),
new ResistanceMod( ResistanceType.Energy, 5 ),
new ResistanceMod( ResistanceType.Cold, 5 ),
new ResistanceMod( ResistanceType.Physical, 5)
};*/
[CommandProperty(AccessLevel.GameMaster)]
public int TalismanExperience { get { return talismano_exp; } set { talismano_exp = value; } }
[Constructable]
public TalismanoSlayer(): base(0x2F58)
{
Name = "a slayer talisman";
Hue = 1287;
Layer = Layer.Talisman;
TalisAttivo = false;
}
public TalismanoSlayer(Serial serial): base(serial)
{
}
public override void OnDoubleClick(Mobile from)
{
Item talism = from.FindItemOnLayer(Layer.Talisman);
if (IsChildOf(from.Backpack))
{
if ((from.FindItemOnLayer(Layer.Talisman) == null) && (from.Map == Map.Trammel))
{
from.AddItem(this);
from.SendGump(new TaliGump(from));
}
else
from.SendMessage("your talisman slot must be free and you can use it only in trammel");
return;
}
if (talism == this)
{
if (TalisAttivo)
{
TalisAttivo = false;
Hue = 1287;
from.SendMessage(" you turn OFF the power of the talisman. ");
return;
}
else
{
TalisAttivo = true;
Hue = 1288;
from.SendMessage(" you turn ON the power of the talisman. ");
return;
}
}
return;
}
public override bool OnEquip(Mobile from)
{
incremento = talismano_exp / 100;
if (incremento < 0) incremento = 0;
if (incremento > 15) incremento = 15;
if (talismano_exp > 1500) talismano_exp = 1500;
if (from.Map != Map.Trammel)
{
from.SendMessage("You can wear it only in Trammel ");
return false;
}
else
from.AddStatMod(new StatMod(StatType.All, incremento + "All", incremento, TimeSpan.Zero));
if(talismano_exp >= 100) from.PlaySound(0x1EA);
// from.AddResistanceMod(new ResistanceMod(ResistanceType.Physical, incremento);
// from.AddResistanceMod(mods[5]);
// if i puth resistance mod here it works, but no works on remove
from.SendMessage("this item is only for PVM ");
base.OnEquip(from);
return true;
}
public override void OnRemoved(object o)
{
if (o is Mobile)
{
((Mobile)o).RemoveStatMod(incremento + "All");
// ((Mobile)o).RemoveResistanceMod(mods[5]); // here i've tryed to get off stats, but for sure i am missing something
((Mobile)o).SendMessage("talisman's avaiable experience is {0} ", talismano_exp);
if (TalisAttivo)
{
TalisAttivo = false;
Hue = 1287;
}
}
base.OnRemoved(o);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
writer.Write((int)talismano_exp);
writer.Write((int)incremento);
// writer.Write((bool)TalisAttivo);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
talismano_exp = reader.ReadInt();
incremento = reader.ReadInt();
TalisAttivo = false; /* reader.ReadBool(); */
break;
}
}
public class TaliGump : Gump
{
public TaliGump(Mobile from)
: base(285, 0)
{
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage(0);
AddBackground(17, 69, 498, 313, 9250);
AddLabel(224, 84, 16, "Rewards");
AddRadio(30, 120, 208, 209, false, 1);
AddRadio(30, 140, 208, 209, false, 2);
AddRadio(30, 160, 208, 209, false, 3);
AddRadio(30, 180, 208, 209, false, 4);
AddRadio(30, 200, 208, 209, false, 5);
AddRadio(30, 220, 208, 209, false, 6);
AddRadio(30, 240, 208, 209, false, 7);
AddRadio(30, 260, 208, 209, false, 8);
AddRadio(30, 280, 208, 209, false, 9);
AddRadio(30, 300, 208, 209, false, 10);
AddRadio(287, 120, 208, 209, false, 11);
AddRadio(287, 140, 208, 209, false, 12);
AddRadio(287, 160, 208, 209, false, 13);
AddRadio(287, 180, 208, 209, false, 14);
AddRadio(287, 200, 208, 209, false, 15);
AddRadio(287, 220, 208, 209, false, 16);
AddRadio(287, 240, 208, 209, false, 17);
AddLabel(55, 119, 1153, "a white horse(20) ");
AddLabel(55, 139, 1153, "Reagents bag(15) ");
AddLabel(55, 159, 1153, "Bag of potions(20) ");
AddLabel(55, 179, 1153, "10000 Gold(25) ");
AddLabel(55, 199, 1153, "Scroll of Trascendence(30) ");
AddLabel(55, 219, 1153, "Slayer equip ticket(40) ");
AddLabel(55, 239, 1153, "Horned studded armor(70) ");
AddLabel(55, 259, 1153, "Agapite plate armor(80) ");
AddLabel(55, 279, 1153, "10 Kudos(100) ");
AddLabel(55, 299, 1153, "5 Trascendence Scrolls(120) ");
AddLabel(310, 119, 1153, "5 Slayer equip ticket(180) ");
AddLabel(310, 139, 1153, "Repair Slayer Weapon deed(280) ");
AddLabel(310, 159, 1153, "Repair Slayer Armor deed(300) ");
AddLabel(310, 179, 1153, "Weapon Refinement contract(400) ");
AddLabel(310, 199, 1153, "Verite Ointment(700) ");
AddLabel(310, 219, 1153, "Valorite Ointment(1300) ");
AddLabel(310, 239, 1153, "Destroy your talisman ");
AddLabel(310, 254, 1153, "and get slayer blessing water ");
AddButton(214, 344, 247, 248, 30, GumpButtonType.Reply, 0);
from.SendMessage("You open the reward page");
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
if (info.ButtonID == 30)
{
string toSay = "";
for (int i = 0; i < info.Switches.Length; i++)
{
int m = info.Switches[i];
switch (m)
{
case 1: // 1 whitehorse 20
if ((from.FindItemOnLayer(Layer.Talisman) is TalismanoSlayer))
{
Item talismano = from.FindItemOnLayer(Layer.Talisman);
if ((((TalismanoSlayer)talismano).TalismanExperience >= 20) && (from.Hits > 1))
{
toSay += "you have obtained a white horse ";
((TalismanoSlayer)talismano).TalismanExperience -= 20;
HorseSpawn cavallo = new HorseSpawn();
cavallo.Body = 0xC8;
cavallo.Hue = 1150;
cavallo.Name = "a white horse";
cavallo.ControlSlots = 0;
cavallo.Controlled = true;
cavallo.ControlMaster = from;
Point3D loc = from.Location;
Map map = from.Map;
cavallo.MoveToWorld(loc, map);
}
else
{
toSay += "you haven't got enought experience";
}
}
else
{
toSay += "you must equip your talisman";
}
break;
// this it will be my workwork for this night. Completing it :P
case 2: // bag all reags 15
toSay += "Radio 2 : "; break;
case 3: //bag potion 20
toSay += "Radio 3 : "; break;
case 4: // 10k gold 25
toSay += "Radio 4 : "; break;
case 5: // scroll trasce 30
toSay += "Check 5, "; break;
case 6: // ticket slayer 40
toSay += "Check 6, "; break;
case 7: // horned studa 70
toSay += "Check 7, "; break;
case 8: // aga plate 80
toSay += "Check 8, "; break;
case 9: // 10 Kudos 100
toSay += "Check 9, "; break;
case 10: //5 scroll trasce 120
toSay += "Check 10, "; break;
case 11: // 5 ticket slayer 180
toSay += "Radio 11 : "; break;
case 12: // deed ripara weapon 280
toSay += "Radio 12 : "; break;
case 13: // deed ripara arm 300
toSay += "Radio 13 : "; break;
case 14: // except refinement 400
toSay += "Radio 14 : "; break;
case 15:// verite oint 500
toSay += "Check 51, "; break;
case 16: //valorite oint 1300
toSay += "Check 16, "; break;
case 17: // destroy talisman for belssing water servono 1500 exp
toSay += " tasto inattivo"; break;
}
}
from.SendMessage(toSay);
}
}
}
}
}