Jump to content

ScriptMan

Active+ Member
  • Posts

    33
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Posts posted by ScriptMan

  1. Hello! Today I found that in lua the modification of item.set_socket(0, value) does not work.


    Fixed:

    	int item_set_socket(lua_State* L)
    	{
    		CQuestManager& q = CQuestManager::instance();
    		if (q.GetCurrentItem() && lua_isnumber(L, 1) && lua_isnumber(L, 2))
    		{
    			int idx = (int)lua_tonumber(L, 1);
    			int value = (int)lua_tonumber(L, 2);
    			if (idx >= 0 && idx < ITEM_SOCKET_MAX_NUM)
    				q.GetCurrentItem()->SetSocket(idx, value);
    		}
    		return 0;
    	}


    Original:

    	int item_set_socket(lua_State* L)
    	{
    		CQuestManager& q = CQuestManager::instance();
    		if (&q == NULL)
    			return 0;
    
    		LPITEM item = q.GetCurrentItem();
    
    		if (item == NULL)
    			return 0;
    
    		if (item && lua_isnumber(L, 1) && lua_isnumber(L, 2))
    		{
    			int idx = (int) lua_tonumber(L, 1);
    			int value = (int) lua_tonumber(L, 2);
    
    			if (idx == NULL)
    				return 0;
    
    			if (value == NULL)
    				return 0;
    
    			if (idx >=0 && idx < ITEM_SOCKET_MAX_NUM)
    				item->SetSocket(idx, value);
    		}
    		return 0;
    	}


    Explanation:
    If the socket index is 0, it returns and does not run the code... fck logic.

    			if (idx == NULL)
    				return 0;

     

    • Metin2 Dev 3
    • Love 1
  2. 2 hours ago, Papix said:

    Hello community,

    I needed to remove the collision from all the monsters and decided to share with you how to do it.

    Anything included in mob_proto from vnum 101 to 99999 loses the collision.

      Hide contents

     


    The collision is removed, but when you are attacking it continues to exist.

      Reveal hidden contents

     


    Step by Step

    Hidden Content

    • #Binary
      @GameLib/ActorInstanceCollisionDetection.cpp

      After:

       

      BOOL CActorInstance::TestActorCollision(CActorInstance& rVictim)
      {
      	if (rVictim.IsDead())
      		return false;


      Add:

      #ifdef REMOVE_MOB_COLLISION
      	if (rVictim.GetRace() >= 101 && rVictim.GetRace() <= 99999 && !isAttacking())
      		return false;
      #endif


      @Locale_inc.h


      Add:

      #define REMOVE_MOB_COLLISION

       

     



    WTF Bro?

    	if (rVictim.GetActorType() == TYPE_ENEMY || rVictim.GetActorType() == TYPE_NPC)
    		return FALSE;

     

    • Metin2 Dev 1
    • kekw 1
  3. 6 minutes ago, Owsap said:

    I still don't understand...
    When you unmount all bonuses are removed.

    
    -- Quest
    when 31071.use begin
    	if pc.is_polymorphed() then
    		return syschat("You can't ride while transformed.")
    	end
    
    	if pc.is_riding() or pc.is_mount() then
    		pc.unmount()
    	else
    		if horse.is_summon() then
    			horse.unsummon()
    		end
    
    		pc.mount(22006, 3600)
    		pc.mount_bonus(apply.MOV_SPEED, 60, 3600)
    	end
    end
    
    // @ questlua_pc.cpp
    	int pc_mount_bonus(lua_State* L)
    	{
    		BYTE applyOn = static_cast<BYTE>(lua_tonumber(L, 1));
    		long value = static_cast<long>(lua_tonumber(L, 2));
    		long duration = static_cast<long>(lua_tonumber(L, 3));
    
    		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
    
    		if (ch && ch->GetMountVnum())
    		{
    			ch->RemoveAffect(AFFECT_MOUNT_BONUS);
    			ch->AddAffect(AFFECT_MOUNT_BONUS, aApplyInfo[applyOn].bPointType, value, AFF_NONE, duration, 0, false);
    		}
    
    		return 0;
    	}
    
    	int pc_unmount(lua_State* L)
    	{
    		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
    
    		ch->RemoveAffect(AFFECT_MOUNT);
    		ch->RemoveAffect(AFFECT_MOUNT_BONUS);
    
    		if (ch->IsHorseRiding())
    			ch->StopRiding();
    
    		return 0;
    	}

     

    jtbEn90.gif

     

     

    Yes but! Use ctrl+g or h or j.

    And Dizer not use Costume mount system.

  4. 8 minutes ago, Owsap said:

    What do you mean with "Status don't clear, only if you click them" and what are you trying todo with this function?


    If you're trying to add a bonus to the mount your using you can use this function: pc.mount_bonus(type, value, duration)

    
    local mount_vnum = 22006 -- Mount Vnum
    local affect_duration = 3600 -- 1h
    
    pc.mount(mount_vnum, affect_durration)
    pc.mount_bonus(apply.MOV_SPEED, 20, affect_durration) -- Apply bonus with +20 move speed

     

     

     

    No no.
    Here is problem this:

     

    Base Riding code added for your character riding bonus: str vit etc point..
     

    If you using this code...

    pc.mount()


    So.. Now stop riding and check your Character window ingame. (Bonus cp. VIT, INT, STR ..)

×
×
  • 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.