1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Server resources

Discussion in 'Script Support' started by Ravenwolfe, Sep 14, 2013.

  1. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,147
    Likes Received:
    123
    I've never been a fan of putting a lot of thing in players backpacks. However, i want to use a token system to reward players for certain things. So my idea is to add a new property on playermobile called tokens and have certain action increase the value and decrease the value when the spend the token (using a token stone).

    However, everyone i have seen uses an object in the players pack. So my question is, is there a reason not to have the value stored on playermobile? Is it simply that people dont like playermobile edits or does this increase load on the server or something?

    I know nothing about server memory usage and such, but it seems to me that a value stored on PM would be less drag on the server then the items would or am i mistaken?
     
  2. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,013
    Likes Received:
    131
    You could also try using XmlAttachments, then increase or decrease the value on the attachment. With XmlQuestNPCs (and their quests) you're basically completely setup to do all that from the get go, no playermobile edits required if you have all of the XmlSpawner package installed already.
     
    • Like Like x 1
  3. RoninGT
    Offline

    RoninGT Active Member

    Joined:
    Aug 15, 2013
    Messages:
    119
    Likes Received:
    35
    You could also use the CustomFramework built into ServUO. Would required that. I could write you up a demo code if you would like.

    RoninGT
     
    • Like Like x 2
  4. sec_goat
    Offline

    sec_goat Member

    Joined:
    Aug 26, 2013
    Messages:
    110
    Likes Received:
    14
    @RoninGT I for one would like to see some demo code using the CustomFramework.
     
  5. RoninGT
    Offline

    RoninGT Active Member

    Joined:
    Aug 15, 2013
    Messages:
    119
    Likes Received:
    35
    Well @Insanity would be a better one for a full fledged demo of the CustomsFramework but over the past for weeks I have been is Luke to his Obi :p so ill whip something up.
    --- Double Post Merged, Sep 14, 2013, Original Post Date: Sep 14, 2013 ---
    Here is a good demo of CustomFrameworks using points like you were looking for. This is a PreRelease of a system I have on my server. Its a self res system for players.

    Overview
    • Players can buy, find, or Donate for After Grave Point Deeds
    • Aftergrave Point deeds add points to the character used in the self res and corpse find commands.
    • Players can use [resme to res them selfs if they cant find a healer, This command will use Aftergrave points if any are or 5000 gold (Amount modifiable in core)
    • Players can use [getcorpse to find their most recent corpse. This command will use Aftergrave points if any are available or 5000 gold (Amount modifiable in core. )
    This is a good example of how to use the CustomFrameworks for things that effect a mobile. No playermobile changes required.

    RoninGT
    --- Double Post Merged, Sep 14, 2013 ---
    I have been converting most of my scripts over to support the CustomsFramework built into ServUO comes in very handy.

    RoninGT
     

    Attached Files:

    • Like Like x 1
  6. Insanity
    Offline

    Insanity Active Member

    Joined:
    Mar 2, 2013
    Messages:
    276
    Likes Received:
    61
    Meh, I started to write a demo...but then I didn't see the point. There are 3 systems in use built into ServUO that are great "demos" of it in action and how to use it properly. Now that doesn't mean I'm against teaching people how to use it. I believe a How-To/Tutorial would be a better solution to explaining how to use the framework. Than a simple demo core/module, as it won't help explain all that much to the average joe.

    So...I believe I'll get to work on a basic Tutorial, using the Token part as a example.

    As for the answer to your original question. The reason that most people don't store the info directly on the PlayerMobile is because they try to avoid distro edits. Distro edits make it that much harder to share systems, and harder to install on someone that doesn't know C# very well. The biggest fear is adding something that needs to be serialized, as most people fear messiing with Mobile/Item serialization. As it is indeed easy to mess it up and wipe a lot of stuff.

    But as mentioned. The CustomsFramework is a great solution to your problem. You could maintain and serialize the data outside of any item/mobile class. Saving you from doing distro edits, or possibly messing up serialization. While also link the data to a mobile/item for easy access to the data.

    @RoninGT's example above is a good starting point. You can also view the Toolbar system, food system, or slayer title system, found within the Customs folder of ServUO. They all heavily rely on the CustomsFramework.
     
    • Winner Winner x 2
    • Agree Agree x 1
  7. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,147
    Likes Received:
    123
    Great stuff, you guys are brilliant! I can't believe I didn't think of an XMLattachment after I used to be a tester years ago for ArteGordon!

    I've never had a clue what the CustomFramework stuff does, so thank you both, I will look at the example and I would love to see a tutorial on it!!

    My plan is to have people gain tokens for claiming corpses (kinda like the old [grab command) which helps clean up the server, for trashing items they dont need, for killing another player (part of a meaningful pvp system I'm working on), and for staff rewards to be given out at events and such.
     
    • Like Like x 1
  8. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,013
    Likes Received:
    131
    There's the trash for tokens backpack you can get with Daat99's token system. You could also use that code as a basis for using an Xmlattachment. :)
     
  9. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,147
    Likes Received:
    123
    Ok, I looked over the scripts and I think I get mostly what happens but I am still a bit confused. Its clear that there is something called a "module" that is linked to a player and holds the value for the "aftergrave points". There also appears to be a "core" that controls the system. I get what the commands do and everything. What I don't understand is where the values are actually stored. Something has to be holding the values for each and every character. Is this in a file on the server? Is it in memory?

    You have to forgive me, I have no training in programming and I am totally self taught.
     
  10. RoninGT
    Offline

    RoninGT Active Member

    Joined:
    Aug 15, 2013
    Messages:
    119
    Likes Received:
    35
    Sorry for the late reply my PC went poof :(

    In BaseModule there is a value LinkedMobile. This saves the player, or creature that the module is linked too and the Module its self saves all the values you want to attach to the mobile.

    Hope this helps

    RoninGT
     
  11. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,147
    Likes Received:
    123
    Ah, that makes sense, in many ways its sounds similar to the way xml works, very cool, thank you!
     
    • Like Like x 1
  12. RoninGT
    Offline

    RoninGT Active Member

    Joined:
    Aug 15, 2013
    Messages:
    119
    Likes Received:
    35
    It is there are multi ways of doing it if you ever seen my bounty hunter system it has its own save system that does not require pm edits only diff is that CustomsFramework is built into the core


    Sent from my iPhone using Tapatalk - now Free
     
  13. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,147
    Likes Received:
    123
    Yeah, seems like a good way to do it. It has the benefits of using xmlattachments but you dont have to edit the scripts to add the attachments like you do with xml (such as adding attachments in charactercreation).
    I cant wait to see a tutorial on this!
     
  14. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,013
    Likes Received:
    131
    Is that how you add attachments for Xml Raven? You should have a spawner or XmlQuestNPC do it. So much easier and if your attachment follows a basic structure of one of the pre-made attachments it's super easy. Sorry, I didn't mean to sound like any other way is stupid or anything.
     
  15. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,147
    Likes Received:
    123
    Well, it depends. I've had spawners do it, deeds do it, or do a global command to do it. But in the case of a token system that will be added to all playermobiles, its best to do it at character creation so that future players have it when they start.
     
  16. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,013
    Likes Received:
    131
    Or just have a spawner at the starting location do it. Hehe
     
  17. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,147
    Likes Received:
    123
    Very true, but its an easy edit to chactercreation and doesnt require serial/deserial or anything.
     
Similar Threads: Server resources
Forum Title Date
ServUO Discussion Server Crashes Today at 7:46 PM
Bug Reports Undertaker's Staff crashes server Yesterday at 10:01 AM
Script Support Mining attempts crashes server Monday at 7:17 PM
Script Support Server throws this error Oct 5, 2017
Script Support Server restarts on character creation Sep 30, 2017
ServUO Discussion EC - How to log in my personal server Sep 29, 2017
Archived Bug Reports Treasure Map Decoding Causes Server Crash Sep 28, 2017