RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[2.2] Kill Tracker Ball

Mortis

Knight
Sorry, still no time to work on this until this weekend. When the X takes my daughter away from me for the weekend.

I just started working full time again as of 2/4/13 and do not have the time as I am a single parent with one nine year old to take care of.
 

MrNice

Squire
All good brother, I am a medic in the army so I understand :) Just trying to make the system bug free. To recap known bugs (on my end) - Tracker forgets, at random, who it belongs to, if you purchase an item it subtracts the points but will also let you go into the negative while it keeps giving prizes. Pets and summons do not count towards kill points! No rush :) I am always learning so if anyone else can point me in the direction of another script I could compare it to let me know and I will try to fix it myself!
 

Bittiez

Sorceror
Okay, changed the gump file. Fixed negative costs, and also cut back codes of line by about 1000 lines by removing the need for 190 cases, this also makes it easier for shards to add/customize items.
 

Attachments

  • KillPointTracker.rar
    15.5 KB · Views: 0

Bittiez

Sorceror
Another update, consolidated more code and cut another ~700 lines off, and it seems to run faster in game :)
 

Attachments

  • KillPointTracker.rar
    14.4 KB · Views: 4

Bittiez

Sorceror
Okay, you will need to replace all three files. This *should* fix the forgotten owners. I still haven't been able to refresh it on bind/unbind so it shows accurate name, so it wont show who it's bound to till after relog
 

Attachments

  • KillPT.zip
    19.2 KB · Views: 1

MrNice

Squire
now why does your killpointtracker.cs file seem so big? this is the one I use.


using System;
using Server.Items;
using Server.Gumps;
using Server.Network;
using System.Collections;
using Server.Misc;
using Server.Mobiles;
using Server.Commands;
namespace Server.Items
{
public class KillPointTracker : Item
{
private int m_Points;
private int m_TotalPoints1;
private int m_PointsCap = 1000000;
private int m_RedeemedPoints;
public static int BoundTo = 0;
[CommandProperty( AccessLevel.GameMaster )]
public int Points { get { return m_Points; } set { m_Points = value; InvalidateProperties(); } }
[CommandProperty( AccessLevel.GameMaster )]
public int TotalPt { get { return m_TotalPoints1; } set { m_TotalPoints1 = value; InvalidateProperties(); } }
[CommandProperty( AccessLevel.GameMaster )]
public int PointsCap { get { return m_PointsCap; } set { m_PointsCap = value; InvalidateProperties(); } }
[CommandProperty( AccessLevel.GameMaster )]
public int RedeemedPoints { get { return m_RedeemedPoints; } set { m_RedeemedPoints = value; InvalidateProperties(); } }
[Constructable]
public KillPointTracker() : base( 0x1ECD )
{
LootType = LootType.Blessed;
Movable = true;
m_Points = 0;
m_RedeemedPoints = 0;
m_TotalPoints1 = 0;
Name = "Kill Point Tracker";
Hue = 38;
BoundTo = 0;
}
public override void GetProperties( ObjectPropertyList list )
{

base.GetProperties( list );
if (m_Points > 0)

list.Add(" <BASEFONT COLOR=#1DF0101>{0}<BASEFONT COLOR=#FFFFFF> <BASEFONT COLOR=#1EFF00>Kill Points<BASEFONT COLOR=#FFFFFF> <BASEFONT COLOR=#0000FF>|<BASEFONT COLOR=#FFFFFF> <BASEFONT COLOR=#1DF0101>{1}<BASEFONT COLOR=#FFFFFF> <BASEFONT COLOR=#1EFF00>Kills Total<BASEFONT COLOR=#FFFFFF> <BASEFONT COLOR=#0000FF>|<BASEFONT COLOR=#FFFFFF> <BASEFONT COLOR=#1DF0101>{2}<BASEFONT COLOR=#FFFFFF> <BASEFONT COLOR=#1EFF00>Redeemed Points<BASEFONT COLOR=#FFFFFF>",m_Points.ToString(), m_TotalPoints1.ToString(), m_RedeemedPoints.ToString());
else { list.Add("Kill Points Tracker *Empty* "); }
}
public override void OnDoubleClick(Mobile from)
{
if (!IsChildOf(from.Backpack))
{
from.SendMessage(62, "That must be in your pack for you to use it." );
return;
}
else
{
if ( from.Backpack == null || from.Backpack.GetAmount( typeof( KillPointTracker ) ) > 1 )
{
from.SendMessage( 62, "You can only have one kill point tracker in your pack to use this!" );
}
else
{
from.SendGump( new BoundToKillTracker(from) );
}
}
}
public KillPointTracker(Serial serial): base(serial)
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) m_Points );
writer.Write( (int) m_TotalPoints1);
writer.Write( (int) m_RedeemedPoints);
writer.Write( (int) BoundTo );//Serialize who it is bound to.
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_Points = reader.ReadInt();
m_TotalPoints1 = reader.ReadInt();
m_RedeemedPoints = reader.ReadInt();
BoundTo = reader.ReadInt();//Read on startup who it is bound to.
}
}
}
 

MrNice

Squire
In the file you uploaded it seems the gumps are put in their own file AND in the killpointtracker.cs file.
 

MrNice

Squire
what I am confused about is the fact that I use the gump file you fixed along with my killpointtracker.cs file that is MUCH smaller and it still works, minus forgetting owner from time to time, it seems the gumps are just repeated in the killpointtracker.cs file is this not the case?
 

MrNice

Squire
+ Mobiles/BaseCreature.cs:
CS0120: Line 1400: An object reference is required for the nonstatic field,
method, or property 'Server.Items.KillPointTracker.BoundTo'
CS0120: Line 1442: An object reference is required for the nonstatic field,
method, or property 'Server.Items.KillPointTracker.BoundTo'
CS0120: Line 1465: An object reference is required for the nonstatic field,
method, or property 'Server.Items.KillPointTracker.BoundTo'
CS0120: Line 1511: An object reference is required for the nonstatic field,
method, or property 'Server.Items.KillPointTracker.BoundTo'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.


this is new error using newest upload
 

Bittiez

Sorceror
UPDATED - 3/14/13
-Fixed Total Points Count
-Removed all entries to basecreature, it no longer needs them!

Updated Version, Everything appears to be working!

In your BaseCreature.cs you need to find your OnDamage() method(Do a search for "void OnDamage(int amount, Mobile from, bool willKill)" and it should bring you to the correct method)

Step 1:

Next extract the attached zip file to your customs folder(Custom(s)/KillPT/Files here..)

Open Settings.cs and edit the settings as necessary.


Step 2:
Now adding items to the Stone

First find line number 362

You should see something along the lines of this:
Code:
                //100$ items
                item_list.Add(@"Bone Couch Deed");
                item_list.Add(@"Your item here");
                item_list.Add(@"Your item here");
                item_list.Add(@"Your item here");
                item_list.Add(@"Your item here");
                item_list.Add(@"Your item here");
                item_list.Add(@"Your item here");
                item_list.Add(@"Your item here");
                item_list.Add(@"Your item here");
                item_list.Add(@"Your item here");
And it continues to //9000$

Basically all this part is is the item name shown in the Gump, so for example the first one(Bone Couch Deed) is item number 1 and listed in the 100$ items, you can edit all of these as necessary.


Now the second part to this is setting up the actual items/prices..

Now find line number 1314 and you should see this:
Code:
items[1] = new BoneCouchDeed();
            price[1] = 100;
            name[1] = "bone couch";

This should be fairly explanatory, you will need to set the number(in this above case it is 1) to the correct slot:
First item in 100$ = 1
Last item in 100$ = 10

First item in 500$ = 61
Last item in 500$ = 70

First item in 1000$ = 101
Last item in 1000$ = 110

First item in 5000$ = 161
Last item in 5000$ = 170
 

Attachments

  • KillPT.zip
    8.7 KB · Views: 14

Bittiez

Sorceror
Well if you choose to do %, it will take the % you set(default = 0.05(5%)) of the monster's hit points(for example 5% of 700 hit points = 35) and give that many points to the kill tracker(to make it so harder monsters = bigger bonus)
 

MrNice

Squire
Ok so I use a custom token system and I changed the item from bonecouch to BronzeToken like this

items[1] = (new BronzeToken());
price[1] = (100);
name[1] = ("bronze token");

I go to the stone with 100 points, purchase it, and get this crash :

unUO Version 2.2, Build 4753.1368
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
.NET Framework: 2.0.50727.5420
Time: 2/27/2013 5:51:09 PM
Mobiles: 18785
Items: 147529
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Items.KillTracker.spend(KillPointTracker kpt, Int32 amt)
at Server.Items.KillTracker.OnResponse(NetState sender, RelayInfo info)
at Server.Network.PacketHandlers.DisplayGumpResponse(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)
 
Top