Frosttiger

Citizen
the only event sink we are missing is the skill ones we have the craft event sink already. also thanks for finding who made these syste that helps as I remember downloading it but wasn't sure who did it.
[doublepost=1475100363][/doublepost]also note I checked runuo GitHub they do not have skill event sink.
 

Dan(Tasanar)

Moderator
Here is the crash for the Discovery one

Code:
RunUO Version 0.5, Build 6092.27866
Operating System: Microsoft Windows NT 6.2.9200.0
.NET Framework: 4.0.30319.42000
Time: 9/27/2016 12:16:09 AM
Mobiles: 43486
Items: 229230
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Scripts.Systems.Achievements.DiscoveryAchievement.EventSink_OnEnterRegion(OnEnterRegionEventArgs e)
   at Server.OnEnterRegionEventHandler.Invoke(OnEnterRegionEventArgs e)
   at Server.EventSink.InvokeOnEnterRegion(OnEnterRegionEventArgs e)
   at Server.Region.OnRegionChange(Mobile m, Region oldRegion, Region newRegion)
   at Server.Mobile.UpdateRegion()
   at Server.Mobile.SetLocation(Point3D newLocation, Boolean isTeleport)
   at Server.Mobiles.PlayerMobile.SetLocation(Point3D loc, Boolean isTeleport)
   at Server.Mobile.Move(Direction d)
   at Server.Mobiles.PlayerMobile.Move(Direction d)
   at Server.Network.PacketHandlers.MovementReq(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)


Could we also get a link to the GitHub repository this came from? I would push updates. I already added about 50 more Achievements as well as made sub categories for Crafting and Resource Gathering.
 

darklotus

Citizen
The error just comes from the old version of net framework that is set in runuo 2.2, so the issue is "int category =1". So remove the =1 and I guess you will need to adjust the script further since it may not actually set the category in some places
The errors you see will be because im using C#6 language features not due to old .net featureslol.
You need to build Script.CS.dll in visual studio to use C#6 stuff or else go thru and remove any C#6 language stuff like property default values and such.


Here is the crash for the Discovery one
Could we also get a link to the GitHub repository this came from? I would push updates. I already added about 50 more Achievements as well as made sub categories for Crafting and Resource Gathering.
If you set a break point you will find servUO is calling OnEnterRegionEventHandler with a null region, just add a check for that should solve your crash.



The achievement saving system also uses a modified player mobile by default and you need to change the #define to swap it to saving data on an item.

It's had basic testing on runuo 2.0 and a newish servUO, but that was a few months ago.

I made it public as an example for how an achievement system could be done, with just some sample discovery types, you could add any type you would by creating a new class extending BaseAchievment.

I would rather you just direct people to the github than host a download as it would promote more people contributing bug fixes etc back to it. Happy to accept any pull requests etc.

If theres any code that isnt self descriptive please let me know and ill add some comments etc.
 

tass23

Moderator
The achievement saving system also uses a modified player mobile by default and you need to change the #define to swap it to saving data on an item.
Hey DL, do you have the modified playermobile, as it is not included, even on GitHub?
 

darklotus

Citizen
you just uncomment line #1 in AchievmentSystem.cs to store info on an item instead but if you do want to use your own playerMobile you need the below.

Code:
internal Dictionary<int, AchieveData> Achievements = new Dictionary<int, AchieveData>();
public int AchievementPointsTotal { get; set; }

Serialize Method
Code:
            writer.Write(AchievementPointsTotal);
            writer.Write(Achievements.Count);
            foreach (var kv in Achievements)
            {
                writer.Write(kv.Key);
                kv.Value.Serialize(writer);
            }

Deserialize Method
Code:
            AchievementPointsTotal = reader.ReadInt();
            int count = reader.ReadInt();
            if(count > 0)
            {
                for(int i = 0; i < count;i++)
                {
                    Achievements.Add(reader.ReadInt(), new AchieveData(reader));
                }
            }
 

darklotus

Citizen
it was mainly designed and tested on runuo 2.0 which is why i didnt use XML Saving.

Not all achievement types will work without adding the missing event-sinks though, so either copy how they are implemented in servuo and implement them in your runuo or remove those achievement types.
 

Ravenwolfe

Moderator
I would rather you just direct people to the github than host a download as it would promote more people contributing bug fixes etc back to it. Happy to accept any pull requests etc.

If theres any code that isnt self descriptive please let me know and ill add some comments etc.

@Frosttiger - Please remove resource download and place a link to his Github as request by repo owner.
 

Frosttiger

Citizen
I can do that thanks for every one helping out like I said I just downloaded it off a site wasnte sure who the owner was. reason didn't take credit but figured people been asking.

download removed
 

Ravenwolfe

Moderator
I can do that thanks for every one helping out like I said I just downloaded it off a site wasnte sure who the owner was. reason didn't take credit but figured people been asking.

download removed

Sorry if I sounded bad, I totally appreciate you bringing it to the community! I just wanted to make sure we respect his wishes.
 

darklotus

Citizen
The github has been updated, should build with no issues now on servuo.

There is a bug in the code to display sub categories though which ill get fixed next time im free.
 

Doom

Citizen
where exactly do you make these changes to playermobile? i have 36 different case of serialization and theres no how to or moded playermobile
 

darklotus

Citizen
where exactly do you make these changes to playermobile? i have 36 different case of serialization and theres no how to or moded playermobile
Only one of those 36 cases are invoked, you want to modify the one that is used, or bump the version and add a new case to handle the added information. It's the same as adding any new value to be serialized on an existing class.

To be honest this code was published just as an idea of how i saw an achievement system being implemented, It's pretty useless if your not comfortable with C#.

@Canar, I dont think anyone can help you if you dont explain your problem. It's like me calling a mechanic and saying my car doesnt work. He cant help if he doesnt have some details.

The error you get could be helpful...