[C++] Başlangıçta İtemler Üstüne Efsunlu Bir Şekilde Giyili Gelsin.

  • Konbuyu başlatan Konbuyu başlatan Admin
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 32

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0



Merhabalar başlangıçta itemler giyili bir şekilde başlama paylaşılmıştı bende bunun farklı bir kodlamayla ve efsunlu bir şekilde başlamayı paylaşacam isteyen istediğini kullanabilir ;

cmd.cpp aç

arat
Kod:
ACMD(do_click_mall);

altına ekle
Kod:
ACMD(do_item_verr); ACMD(do_iteme_efsun_ver2);

arat
Kod:
"click_mall",

altına ekle
Kod:
{ "item_verr",            do_item_verr,            0,    POS_DEAD,    GM_PLAYER        },     { "iteme_efsun_ver2",        do_iteme_efsun_ver2,        0,    POS_DEAD,    GM_PLAYER        },

cmd_general.cpp aç

arat
Kod:
ACMD(do_click_mall)

bu fonksiyonun altına ekle

Kod:
ACMD(do_item_verr){     BYTE job = ch->GetJob();     LPITEM item;     for (int i = 0; i < 6; i++)     {         item = ch->GetWear(i);         if (item != NULL)             ch->UnequipItem(item);     }     item = ch->GetWear(WEAR_SHIELD);     if (item != NULL)         ch->UnequipItem(item);     switch (job)     {     case JOB_SURA:         {                    item = ITEM_MANAGER::instance().CreateItem(19);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(11609);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(12489);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(13009);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(14009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(15009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(16009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(17009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(39036 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);         }         break;     case JOB_WARRIOR:         {                    item = ITEM_MANAGER::instance().CreateItem(19);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(11209);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(12209 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(13009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(14009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(15009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(16009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(17009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(39036 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);         }         break;     case JOB_SHAMAN:         {                    item = ITEM_MANAGER::instance().CreateItem(5009);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(11809);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(12629 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(13009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(14009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(15009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(16009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(17009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(39036 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);         }         break;     case JOB_ASSASSIN:         {                    item = ITEM_MANAGER::instance().CreateItem(19);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(11409);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(12349 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(13009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(14009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(15009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(16009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(17009 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(39036 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);         }         break;     } } ACMD(do_iteme_efsun_ver2) {     BYTE job = ch->GetJob();     LPITEM item;     switch (job)     {     case JOB_WARRIOR:     case JOB_ASSASSIN:     case JOB_SURA:     case JOB_SHAMAN:         {             //  -- Kask Efsunları             item = ch->GetWear(WEAR_HEAD);             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_ATT_SPEED, 8);                 item->SetForceAttribute( 1, APPLY_HP_REGEN, 30);                 item->SetForceAttribute( 2, APPLY_ATTBONUS_ANIMAL, 20);                 item->SetForceAttribute( 3, APPLY_DODGE, 15);                 item->SetForceAttribute( 4, APPLY_STEAL_HP, 10);             }             // -- Silah Efsunları             item = ch->GetWear(WEAR_WEAPON);             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_STR, 12);                 item->SetForceAttribute( 1, APPLY_CRITICAL_PCT, 10);                 item->SetForceAttribute( 2, APPLY_PENETRATE_PCT, 10);                 item->SetForceAttribute( 3, APPLY_ATTBONUS_ANIMAL, 20);                 item->SetForceAttribute( 4, APPLY_STUN_PCT, 8);             }             // -- Kalkan Efsunları             item = ch->GetWear(WEAR_SHIELD);             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_CON, 12);                 item->SetForceAttribute( 1, APPLY_BLOCK, 15);                 item->SetForceAttribute( 2, APPLY_REFLECT_MELEE, 10);                 item->SetForceAttribute( 3, APPLY_IMMUNE_STUN, 1);                 item->SetForceAttribute( 4, APPLY_STR, 12);             }             //  -- Zırh Efsunları             item = ch->GetWear(WEAR_BODY);             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_MAX_HP, 2000);                 item->SetForceAttribute( 1, APPLY_CAST_SPEED, 20);                 item->SetForceAttribute( 2, APPLY_STEAL_HP, 10);                 item->SetForceAttribute( 3, APPLY_REFLECT_MELEE, 10);                 item->SetForceAttribute( 4, APPLY_ATT_GRADE_BONUS, 50);             }             //  -- Ayakkabı Efsunları             item = ch->GetWear(WEAR_FOOTS);             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_MAX_HP, 2000);                 item->SetForceAttribute( 1, APPLY_MAX_SP, 80);                 item->SetForceAttribute( 2, APPLY_MOV_SPEED, 8);                 item->SetForceAttribute( 3, APPLY_ATT_SPEED, 8);                 item->SetForceAttribute( 4, APPLY_CRITICAL_PCT, 10);             }             //  -- Bilezik Efsunları             item = ch->GetWear(WEAR_WRIST);             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_MAX_HP, 2000);                 item->SetForceAttribute( 1, APPLY_MAX_SP, 80);                 item->SetForceAttribute( 2, APPLY_PENETRATE_PCT, 10);                 item->SetForceAttribute( 3, APPLY_STEAL_HP, 10);                 item->SetForceAttribute( 4, APPLY_MANA_BURN_PCT, 10);             }             //  -- Kolye Efsunları             item = ch->GetWear(WEAR_NECK);             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_MAX_HP, 2000);                 item->SetForceAttribute( 1, APPLY_HP_REGEN, 30);                 item->SetForceAttribute( 2, APPLY_CRITICAL_PCT, 10);                 item->SetForceAttribute( 3, APPLY_PENETRATE_PCT, 10);                 item->SetForceAttribute( 4, APPLY_STEAL_HP, 10);             }             //  -- Kupe Efsunları             item = ch->GetWear(WEAR_EAR);             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_MOV_SPEED, 20);                 item->SetForceAttribute( 1, APPLY_ATTBONUS_ANIMAL, 20);                 item->SetForceAttribute( 2, APPLY_POISON_REDUCE, 5);                 item->SetForceAttribute( 3, APPLY_ATTBONUS_DEVIL, 20);                 item->SetForceAttribute( 4, APPLY_ATTBONUS_UNDEAD, 20);             }         }         break;     } }

Başlangıçta item veren questine ekle

Kod:
command("item_verr")             command("iteme_efsun_ver2")

örn ;

0DEQDL.png


Önemli Not 1 :





Yada başka yol ;

item_verr ve iteme_efsun_ver2 kodlarını kendinize göre userlerin bulamayacağı bir şekilde kodlayın örn item_verr yerine 1785469_item gibi userlerin bulamayacağı bir şekilde tüm item_verr yazanları değiştirin değiştirin. Aynı şekilde iteme_efsun_ver2 yazanlarıda farklı bir kodla değiştirin. Çünkü userler bu kodları direk yazarsa item gelir efsun gelir direk bug yapabilirler bu yüzden bu kodları kendinize göre userlerin bulamayacağı bir kodla değiştirin. Ben burda örnek olsun diye basitce item_verr ve iteme_efsun_ver şeklinde yazdım

Önemli Not 2 :

Sistem gayet iyi çalışmaktadır. Not 1 ri yapıldıktan sonra bug fln olmaz içiniz rahat olsun.

Metin2 Oyununda C++ ile Başlangıçta Efsunlu Itemlerin Giydirilmesi

Metin2 özel sunucularında kullanıcı deneyimini artırmak ve oyuncuların oyun içi ilk adımlarını daha keyifli hale getirmek için, başlangıç itemlerinin efsunlu olarak giydirilmesi oldukça yaygın bir yöntemdir. Bu işlem genellikle C++ tabanlı sunucu kaynak kodları üzerinde yapılmaktadır. Bu makalede, Metin2 Lobby gibi platformlarda geliştirilen özel sunucularda, C++ kullanarak oyuncuların oyun içine girişte efsunlu itemlerle başlamasını nasıl sağlayacağımızı detaylıca ele alacağız.

Başlangıç Itemleri ve Efsun Kavramı

Metin2'de başlangıç itemleri, oyuncunun karakter oluşturduktan sonra sahip olduğu ilk eşyalardır. Bu eşyalar genellikle standart özelliklere sahiptir. Ancak, bazı sunucular oyuncuların dikkatini çekmek ve onlara farklı bir deneyim sunmak için bu itemlere efsunlar ekler. Efsunlar, itemlere bonus nitelikler kazandıran değerlerdir ve bu değerler genellikle +%1, +%2, +%7 gibi şekillerde belirtilir.

C++ Kaynak Kodlarında Değişiklik Yapma

Oyuncuya efsunlu bir itemin giydirilmesi için öncelikle C++ tabanlı oyun sunucusu kodlarında gerekli değişiklikleri yapmak gerekmektedir. Bu işlem genellikle game core veya server src[/CR] dosyalarında yer alan karakter oluşturma ve envanter başlatma fonksiyonlarında gerçekleştirilir.

Örneğin, oyuncu bir karakter oluşturduğunda, char_create fonksiyonu çalışır. Bu fonksiyonun sonunda, oyuncuya verilecek başlangıç itemlerini eklemek için bir fonksiyon çağrısı yapılır. Burada, efsunlu bir item eklemek için şu adımları izleyebiliriz:

- Oyuncunun envanterinde boş bir slotun kontrol edilmesi
- Belirlenen item ID'sine göre efsunlu itemin oluşturulması
- Efsun seviyesinin belirlenmesi ve iteme atanması
- Itemin oyuncuya giydirilmesi

Python Script Entegrasyonu

Bazı durumlarda, C++ kodları dışında Python tabanlı sistemlerle entegre çalışmak da mümkündür. Özellikle py root ve uiscript dosyaları üzerinden, item ekleme işlemlerini daha dinamik hale getirebilirsiniz. Bu sayede, farklı sınıflara göre efsunlu itemler tanımlamak ve bu itemlerin otomatik olarak giydirilmesini sağlamak mümkün olur.

Efsun Seviyesi ve Bonuslar

Efsun seviyesi, itemin sahip olduğu bonus miktarını belirler. Örneğin +%7 efsunlu bir silah, +%1 efsunlu bir silaha göre daha güçlüdür. Bu değerler genellikle db core üzerinden de kontrol edilir ve sunucu tarafında doğru şekilde yorumlanır. Efsunlu itemlerin doğru şekilde işlenebilmesi için hem oyun sunucusu hem de veritabanı yapılandırmasının uyumlu olması gerekir.

Sonuç

C++ kullanarak Metin2 özel sunucularında başlangıçta efsunlu itemlerin giydirilmesi, oyuncu memnuniyetini artırabilir ve oyun içi ilk etkileşimleri daha keyifli hale getirebilir. Bu işlem için sunucu kaynak kodlarına detaylı müdahaleler yapılması gerekse de, doğru yapılandırmalarla oldukça etkili sonuçlar elde edilebilir. Metin2 Lobby gibi platformlarda yer alan kaynaklar bu süreçte yardımcı olacaktır.


Equipping Enchanted Items at Start in Metin2 with C++

To enhance user experience and make players' first steps in the game more enjoyable, equipping enchanted starting items is a common method in Metin2 private servers. This process is typically performed on C++ based server source codes. In this article, we will detail how to enable players to start the game with enchanted items using C++ in private servers like Metin2 Lobby.

Starting Items and Enchantment Concept

In Metin2, starting items are the initial equipment that a player receives after creating a character. These items usually have standard attributes. However, some servers add enchantments to these items to attract players and provide them with a different experience. Enchantments grant bonus attributes to items, typically indicated by values like +%1, +%2, +%7, etc.

Making Changes in C++ Source Code

To equip an enchanted item to the player, modifications must be made in the C++ based game server code. This process generally occurs in functions related to character creation and inventory initialization found in game core or server src[/CR] files.

For example, when a player creates a character, the char_create function runs. At the end of this function, there is usually a call to add starting items to the player. To add an enchanted item, you can follow these steps:

- Check for an empty slot in the player's inventory
- Create the enchanted item based on its defined ID
- Determine and assign the enchantment level to the item
- Equip the item to the player

Python Script Integration

In some cases, it is also possible to work integratedly with Python-based systems alongside C++ code. Particularly via py root and uiscript files, you can make item-adding processes more dynamic. This allows defining enchanted items per class and automatically equipping them to the player.

Enchantment Level and Bonuses

The enchantment level determines the amount of bonus attributes an item has. For example, a +%7 enchanted sword is stronger than a +%1 enchanted sword. These values are typically checked via the db core and interpreted correctly on the server side. To ensure enchanted items are processed correctly, both the game server and database configurations must be compatible.

Conclusion

Equipping enchanted starting items in Metin2 private servers using C++ can increase player satisfaction and make initial in-game interactions more enjoyable. Although detailed modifications to server source code are required, effective results can be achieved with proper configurations. Resources available on platforms like Metin2 Lobby will assist during this process.
 

Şuan Bu Konuyu Görüntüleyen Kullanıcılar (Toplam : 0, Üye : 0, Misafir : 0)

Benzer konular

Geri
Üst Alt