Jump to content

Cataclismo

Premium
  • Posts

    232
  • Joined

  • Last visited

  • Days Won

    7
  • Feedback

    0%

Posts posted by Cataclismo

  1. That's not a bug. That's normal.

    File: char_item.cpp

    Function:

    bool CHARACTER::EquipItem(LPITEM item, int iCandidateCell)
    

    The code:

    	if (iWearCell != WEAR_ARROW 
    		&& (dwCurTime - GetLastAttackTime() <= 1500 || dwCurTime - m_dwLastSkillTime <= 1500))
    	{
    		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°¡¸¸È÷ ÀÖÀ» ¶§¸¸ Âø¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù."));
    		return false;
    	}
    

    You should not edit it. I think this code has his own role.

  2. File: questlua_global.cpp

    Find :

    void RegisterGlobalFunctionTable(lua_State* L)
    

    and above this function add:

    	// mob_spawn(vnum, x, y, map_index)
    	int _mob_spawn(lua_State* L)
    	{
    		if (lua_gettop(L) < 4)
    		{
    			sys_err("_mob_spawn: not enough arguments");
    			lua_pushboolean(L, 0);
    			return 1;
    		}
    
    		if(false == lua_isnumber(L, 1) || false == lua_isnumber(L, 2) || false == lua_isnumber(L, 3) || false == lua_isnumber(L, 4))
    		{
    			sys_err("_mob_spawn: invalid arguments");
    			lua_pushboolean(L, 0);
    			return 1;
    		}
    
    		const DWORD dwVnum = static_cast<DWORD>(lua_tonumber(L, 1));
    		const long lX = static_cast<long>(lua_tonumber(L, 2));
    		const long lY = static_cast<long>(lua_tonumber(L, 3));
    		const long lMapIndex = static_cast<long>(lua_tonumber(L, 4));
    
    		const CMob* pMonster = CMobManager::instance().Get(dwVnum);
    		if (!pMonster)
    		{
    			sys_err("_mob_spawn: wrong vnum");
    			lua_pushboolean(L, 0);
    			return 1;
    		}
    
    		LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(lMapIndex);
    		if (!pkSectreeMap)
    		{
    			sys_err("_mob_spawn: wrong mapindex");
    			lua_pushboolean(L, 0);
    			return 1;
    		}
    
    		LPCHARACTER mob = CHARACTER_MANAGER::instance().SpawnMob(dwVnum, lMapIndex, lX, lY, 0);
    		if (!mob)
    		{
    			sys_err("_mob_spawn: mob not spawned; coords maybe wrong?");
    			lua_pushboolean(L, 0);
    			return 1;
    		}
    
    		lua_pushboolean(L, 1);
    		return 1;
    	}
    

    Now search for

    {	"spawn_mob",					_spawn_mob						},
    

    And add after:

    {	"mob_spawn",					_mob_spawn						},
    

    And you call it like this:

    mob_spawn(vnum, x, y, map_index)
    

    The function returns true/false if mob was called or not.

    Also, if the mob is not called then it will display an error in your syserr file:

    "_mob_spawn: not enough arguments" -- you called the function with fewer arguments


    "_mob_spawn: invalid arguments" -- you passed an wrong arguments. all must be numbers
    "_mob_spawn: wrong vnum" -- you provided wrong mob vnum
    "_mob_spawn: wrong mapindex" -- you provided wrong map index
    "_mob_spawn: mob not spawned; coords maybe wrong?" -- mob could not be spawned. this may happen if the coords are wrong

    • Love 1
  3. Hi Guys, I change the item_name, item_proto, mob_proto and mob_name in the serverfiles, but now when I start the server show me "Connection Refused".. Help

     

    They have mistakes.

    In the folder where your db core is located you have a file called syserr. In this file you can find almost everytime the source of your problem. You probably never looked in it and you deleted it everytime. Stop doing this. Are very, very important those files for finding the source of your problems. Everytime when something is not working check these files and you may find where's your problem.

     

    Delete it (if you didn't already), and open your db core. Wait until your db core closes (because it will) and then read syserr.

    PS: I recommend you to delete it because it's easier to find the problems when the files are small and your errors are writed only once.

  4. input_db.cpp:2839: warning: format '%u' expects type 'unsigned int', but argument 8 has type 'long int'
    input_db.cpp:2839: warning: format '%u' expects type 'unsigned int', but argument 9 has type 'long int'
    input_db.cpp:2839: warning: format '%u' expects type 'unsigned int', but argument 10 has type 'long int'
    input_db.cpp:2839: warning: too few arguments for format
    

    Change from %u to %lu for arguments 8, 9 and 10 (count them). Also, I think you provided less arguments than it needs.

    input_main.cpp:3374: error: duplicate case value
    input_main.cpp:3301: error: previously used here
    

    You have used case SOMETHING: more than just one time (available for all errors you get!).

    You used on line 3301 and also on line 3374. Use them just once. If you used them just once then the values are the same even the name are not. You should provide unique numbers for each (in packet.h). If you change their values make sure you do that in client too.

  5. Because there are a lot of stupid players.

    If you do a classic and old style server they're like "What do you have special? You just copied finalongju" and if you do a server with some new systems they're like "This is not metin2 anymore".

    But there are old style servers. I don't know how was the server you mentioned, but I think they're close.

  6. First of all, ask your questions here next time..

    About your problem, it seems you included utils.h more than just one time and your functions are redefined.

    Open utils.h and in top of the file, before everything else, add this:

    #pragma once
    
    

    If this does not work you should check your code for duplicate include.

    • Love 2
  7. Next time, use Questions and Answers forum, please.

    I think you want to change hit damage bonus on items. You can do that by editing file item_addon.cpp

    // SKILL BONUS:
    int iSkillBonus = MINMAX(-30, (int) (gauss_random(0, 5) + 0.5f), 30);
    
    // HIT BONUS (based on skill bonus)
    int iNormalHitBonus = 0;
    if (abs(iSkillBonus) <= 20)
    	iNormalHitBonus = -2 * iSkillBonus + abs(number(-8, 8) + number(-8, 8)) + number(1, 4);
    else
    	iNormalHitBonus = -2 * iSkillBonus + number(1, 5);
    

    For item bonuses search in char_item.cpp

    case USE_ADD_ATTRIBUTE :
    

    and replace this

    if (item2->GetAttributeCount() < 4)
    

    with this

    if (item2->GetAttributeCount() < 5)
    

    Good luck.

  8. File name: char_skill.cpp

    Function:

    void CHARACTER::SkillLevelUp(DWORD dwVnum, BYTE bMethod)
    

    Search this:

    		switch (GetSkillMasterType(pkSk->dwVnum))
    		{
    			case SKILL_NORMAL:
    				if (GetSkillLevel(pkSk->dwVnum) >= 17)
    				{
    					if (GetQuestFlag("reset_scroll.force_to_master_skill") > 0)
    					{
    						SetSkillLevel(pkSk->dwVnum, 20);
    						SetQuestFlag("reset_scroll.force_to_master_skill", 0);
    					}
    					else
    					{
    						if (number(1, 21 - MIN(20, GetSkillLevel(pkSk->dwVnum))) == 1)
    							SetSkillLevel(pkSk->dwVnum, 20);
    					}
    				}
    				break;
    

    And replace it with this:

    		switch (GetSkillMasterType(pkSk->dwVnum))
    		{
    			case SKILL_NORMAL:
    				if (GetSkillLevel(pkSk->dwVnum) >= 17)
    				{
    					SetSkillLevel(pkSk->dwVnum, 20);
    					sys_log(0, "FORCE MASTER: %u", pkSk->dwVnum);
    				}
    				break;
    
  9. I don't know how this system works, but I think you can work around by yourself because I don't see anyone to post it for free.

    I will give you a few details, but I can't make the code for you right now because I am busy.

    This is my own "work around". Is not the right method, but that's all I got.

     

    Attention!: This is NOT tested and I don't guarantee that this works. Use with care.

    This is just for testing purposes only. NEVER do it in live version.

     

    First of all, your item need the type ITEM_USE, and the subtype USE_SPECIAL.

    Now open common/length.h and find

    enum EWearPositions
    

    and before

    WEAR_MAX = 32
    

    add

    WEAR_SHOULDER = YOUR_SLOT,
    

    YOUR_SLOT must be the one you have in client.

     

    In char_item.cpp, in UseItemEx function find this:

    case USE_SPECIAL:
        switch (item->GetVnum())
        {
    

    and right after it put this code:

    case CODE1:
    case CODE2:
    case CODE3:
    {
    	if (!item->IsEquipped())
    	{
    		if (!CanEquipNow(item))
    		{
    			ChatPacket(CHAT_TYPE_INFO, "You can't equip this object.");
    			return false;
    		}
    		else
    		{
    			return item->EquipTo(this, WEAR_SHOULDER);
    		}
    	}
    	else
    	{
    		if (!CanUnequipNow(item))
    		{
    			ChatPacket(CHAT_TYPE_INFO, "You can't unequip this object.");
    			return false;
    		}
    		else
    		{
    			return UnequipItem(item);
    		}
    	}
    }
    

    Replace CODE1, CODE2, CODE3 with your items code.

    • Love 3
  10. Ok , now it's work only if i have this items in inventory but if they are equipped they don't drop....

    And also i have problem, after compilation the game with this function , when i write /kill <player name> and this player is online i have crash core(ch1_core1)

     

    Oh, you want equipment too. I didn't know.

    About the command, yeah, probably because the pkKiller parameter is not set. I fixed that too.

    Here's the code:

    	if (pkKiller && IsPC())
    	{
    		if (GetMapIndex() == YOUR_MAPINDEX && pkKiller->IsPC())
    		{
    			PIXEL_POSITION pos;
    			pos.x = GetX();
    			pos.y = GetY();
    	 
    			for (WORD i = 0; i < INVENTORY_MAX_NUM + WEAR_MAX_NUM; ++i)
    			{
    				LPITEM item = GetInventoryItem(i);
    				if (item)
    				{
    					switch (item->GetVnum())
    					{
    						case 1:
    						case 2:
    						case 3:
    						case 4:
    						case 5:
    							{
    								SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 255);
    								item->RemoveFromCharacter();
    								item->AddToGround(GetMapIndex(), pos, true);
    								item->StartDestroyEvent();
    							}
    							break;
    					}
    				}
    			}
    		}
    	}
    
    • Love 1
  11.  

    i will try , thx :rolleyes:

     

    EDIT:

    At compilation i have this...

    char_battle.cpp: In member function 'void CHARACTER::Dead(CHARACTER*, bool)':
    char_battle.cpp:1302: error: expected primary-expression before ')' token
    compile cmd_emotion.cpp
    compile cmd_general.cpp
    gmake: *** [OBJDIR/char_battle.o] Error 1
    gmake: *** Waiting for unfinished jobs....
    
    

     

     

    Ooops. I writed the code wrong. I edited my previous post so you can copy again the code.

    • Love 1
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.