mitty2
Member
Guys basically this script works great. What I'm trying to do is give it a value of 1 once it is constructed, so I can add it to my vendor stone. Right now the only way to add in game obviously is to type [add LevelUpScroll 1 Ive tried quite a few things but it doesn't show up ingame, when you buy off stone. because it has no value on creation, till you give it one.
Here is part of the code im stuck on...
using System;
using Server.Network;
using Server.Prompts;
using Server.Mobiles;
using Server.Misc;
using Server.Items;
using Server.Gumps;
using Server.Targeting;
using Server.Targets;
namespace Server.Items
{
public class LevelUpScroll : Item
{
private int m_Value;
[CommandProperty(AccessLevel.GameMaster)]
public int Value
{
get
{
return m_Value;
}
set
{
m_Value = value;
}
}
[Constructable]
public LevelUpScroll (int value) : base(0x14F0)
{
Weight = 1.0;
Hue = 0x64;
m_Value = value;
}
public override void AddNameProperty(ObjectPropertyList list)
{
list.Add("an Item Level Deed (+{0} max levels)", m_Value);
}
public override void OnSingleClick(Mobile from)
{
base.LabelTo(from, "an Item Level Deed (+{0} max levels)", m_Value);
}
public LevelUpScroll(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
//Version 0
writer.Write((int)m_Value);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Value = reader.ReadInt();
break;
}
}
}
public override void OnDoubleClick(Mobile from)
{
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
return;
}
else
{
from.SendMessage("Which item would you like to level up?");
from.Target = new LevelItemTarget(this); // Call our target
}
}
}
public class LevelItemTarget : Target
{
private LevelUpScroll m_Scroll;
public LevelItemTarget(LevelUpScroll scroll) : base(-1, false, TargetFlags.None)
{
this.m_Scroll = scroll;
}
Here is part of the code im stuck on...
C#:
using Server.Network;
using Server.Prompts;
using Server.Mobiles;
using Server.Misc;
using Server.Items;
using Server.Gumps;
using Server.Targeting;
using Server.Targets;
namespace Server.Items
{
public class LevelUpScroll : Item
{
private int m_Value;
[CommandProperty(AccessLevel.GameMaster)]
public int Value
{
get
{
return m_Value;
}
set
{
m_Value = value;
}
}
[Constructable]
public LevelUpScroll (int value) : base(0x14F0)
{
Weight = 1.0;
Hue = 0x64;
m_Value = value;
}
public override void AddNameProperty(ObjectPropertyList list)
{
list.Add("an Item Level Deed (+{0} max levels)", m_Value);
}
public override void OnSingleClick(Mobile from)
{
base.LabelTo(from, "an Item Level Deed (+{0} max levels)", m_Value);
}
public LevelUpScroll(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
//Version 0
writer.Write((int)m_Value);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Value = reader.ReadInt();
break;
}
}
}
public override void OnDoubleClick(Mobile from)
{
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
return;
}
else
{
from.SendMessage("Which item would you like to level up?");
from.Target = new LevelItemTarget(this); // Call our target
}
}
}
public class LevelItemTarget : Target
{
private LevelUpScroll m_Scroll;
public LevelItemTarget(LevelUpScroll scroll) : base(-1, false, TargetFlags.None)
{
this.m_Scroll = scroll;
}