Developer Mitachi 2434 Posted June 11 Developer Share Posted June 11 (edited) This is the hidden content, please Sign In or Sign Up Alternative download links → This is the hidden content, please Sign In or Sign Up or This is the hidden content, please Sign In or Sign Up Hi devs, A while ago, during one of my routine cleanups of dead code, I stumbled upon a snippet that gave certain items at character creation (inside ::PlayerCreateSuccess). It was never actually used because it was under china_event_server. If you're using a codebase that hasn't had dead code removed, you might still have it lying around. I figured delivering starter items at that point was a good idea, and likely tested back in the day, at least on Chinese servers. So I decided to create what I’d call a "definitive version" of the give_basic_weapon system, using this old Ymir approach. Here's what I'm referring to with "OLD YMIR CODE": Spoiler Now, if you still have this, just remove, I wrote a Json handler to easly setup everything. Put simply, this allows you to create characters with predefined items, both equipped and in inventory, including custom attributes and sockets. Json Example: So, first login in game will be like: Pros: This follows the Ymir logic, there used to be a system that gave basic items to Chinese players, though it was never really used. You can spawn with the items already equipped and specify any slot number you want for each item. You can also set up count, bonuses and stones(sockets, so also duration) in the starter equipment. Since it happens during character creation, there's no risk of doing it before CItem or QuestManager is properly initialized, indeed, we don't even use them here. The function is called during PlayerCreate, so you don't need a quest flag to prevent giving items twice. It only triggers on character creation. It supports a lightweight reload (core based), so you can hot test or run a starter boost event without shutting down the server. Cons: The only annoying part is having to specify the exact slot indexes where items go, even for equipment. But hey, you only need to do it once. It has common items, shared items, job items, but check the readme on GitHub to figure out how to use it: This is the hidden content, please Sign In or Sign Up Given that this follows Ymir's original approach, I kept the implementation style consistent. The files start_item.cpp/.h resemble start_position.cpp/.h, and I opted not to introduce a new class- just a small set of global functions was sufficient. About nlohman json You can check my old post to see how to include nlohman json in your files: If you have any questions or if I made a mistake in the tutorial, feel free to comment. Edited June 11 by Mitachi Updated Internal Link 46 1 1 5 1 3 32 Link to comment https://metin2.dev/topic/33780-cool-start-with-items-ymir-way/ Share on other sites More sharing options...
Nitro Booster Luigina 28 Posted June 11 Nitro Booster Share Posted June 11 It would not be wrong to say that this is a great contribution from a great man, as there were many members in the community looking for this. Considering that there are still servers that give starter items with quests or cmd commands, this new way is quite good. 1 1 Link to comment https://metin2.dev/topic/33780-cool-start-with-items-ymir-way/#findComment-171099 Share on other sites More sharing options...
Forum Moderator Gurgarath 3261 Posted June 11 Forum Moderator Share Posted June 11 Great work, I would say I am unsure about that one, on the one hand it is probably the most powerful way to handle this and fairly fail-safe, but on the other hand it is some boilerplate code and it feels like reinventing the wheel. I would prefer the original way for really "basic" items but as soon as we need to go the extra mile and really provide specific items and modify it on the fly, this take the edge fairly quickly. I also like the fact that it can be easily extended (like allow random rare attr on the json would simply mean a token and a few lines of c++) AND that this can be reused for other parts. I really feel like it can be a powerful way to give "uniform" items in the case of events for example, or even battle-pass and whatnot. Great release and great use of lovely forgotten code! 1 1 Gurgarath coming soon Link to comment https://metin2.dev/topic/33780-cool-start-with-items-ymir-way/#findComment-171100 Share on other sites More sharing options...
Developer Mitachi 2434 Posted June 12 Author Developer Share Posted June 12 (edited) 20 hours ago, Gurgarath said: Great work, I would say I am unsure about that one, on the one hand it is probably the most powerful way to handle this and fairly fail-safe, but on the other hand it is some boilerplate code and it feels like reinventing the wheel. I would prefer the original way for really "basic" items but as soon as we need to go the extra mile and really provide specific items and modify it on the fly, this take the edge fairly quickly. I also like the fact that it can be easily extended (like allow random rare attr on the json would simply mean a token and a few lines of c++) AND that this can be reused for other parts. I really feel like it can be a powerful way to give "uniform" items in the case of events for example, or even battle-pass and whatnot. Great release and great use of lovely forgotten code! Thank you for always saying what you think, it is appreciated ngl. The handling of sockets and bonuses is not something essential, I just added it to extend it a bit before releasing it so it doesn't seems that I'm writing a quest in c++, it's just extra broth put there, what I liked was the Ymir approach never used! However, that's 16 extra lines of code (6 of which are parentheses), and in json you can simply don't use them You also have to consider that in order to share something on the forum you have to package it well, I can't come here and say “guys ymir used this code in china do it too.” a bit of effort was required Edited June 12 by Mitachi 1 1 Link to comment https://metin2.dev/topic/33780-cool-start-with-items-ymir-way/#findComment-171114 Share on other sites More sharing options...
Active Member Sogma 140 Posted June 18 Active Member Share Posted June 18 Great idea, but I have noticed an error in your guide. cmd_gm.cpp /// 2.) Search in void CHARACTER::MountVnum(DWORD vnum): //Should be: /// 2.) Search in ACMD(do_reload): -> ACMD = #define ACMD(name) void (name)(LPCHARACTER ch, const char *argument, int cmd, int subcmd) 1 Link to comment https://metin2.dev/topic/33780-cool-start-with-items-ymir-way/#findComment-171182 Share on other sites More sharing options...
Arkhe Apeiron 0 Posted June 20 Share Posted June 20 First of all, thank you for your great work on the give_basic_weapon system. I just wanted to let you know that the /reload give_basic_weapon command doesn’t seem to work on my side Is there something extra I should implement to enable it? Link to comment https://metin2.dev/topic/33780-cool-start-with-items-ymir-way/#findComment-171202 Share on other sites More sharing options...
BadRomani 68 Posted July 3 Share Posted July 3 Errors: 1: Time-limited items cannot be added. 2: Metin stones cannot be added to objects such as armor and weapons with the json file. For example: /i 19 you can add stones to this object. But you cannot add stones to the object that comes with the json file. Link to comment https://metin2.dev/topic/33780-cool-start-with-items-ymir-way/#findComment-171341 Share on other sites More sharing options...
Developer Mitachi 2434 Posted July 5 Author Developer Share Posted July 5 On 7/3/2025 at 4:35 PM, BadRomani said: Errors: 1: Time-limited items cannot be added. 2: Metin stones cannot be added to objects such as armor and weapons with the json file. For example: /i 19 you can add stones to this object. But you cannot add stones to the object that comes with the json file. You just need to setup sockets for all of them, in the case of armor/weapons, if sockets are 0, aren't usable. So put 1, in the case of /i 19 which is Sword+9, it's used to have just one slot, so you can put sockets like that: [1, 0, 0], so the first socket is allowed to collect stones in that case. About the other items, it will put socket to 0 as default, so they were created but insta disappear I guess, so again just setup the sockets. 1 Link to comment https://metin2.dev/topic/33780-cool-start-with-items-ymir-way/#findComment-171358 Share on other sites More sharing options...
Recommended Posts
Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now