Jump to content

Galet

Premium
  • Posts

    1384
  • Joined

  • Last visited

  • Days Won

    14
  • Feedback

    0%

Posts posted by Galet

  1. static bool CanMoveIntoBeltInventory(LPITEM item)
    {
            if (!item)
                    return false;
            
            bool bCanMove = false;
            
            int ariClawVnums[] = { 6019, 6029, 6039, 6049 };
            for (size_t i = 0; i < _countof(ariClawVnums); ++i)
            {
                    if (item->GetVnum() == ariClawVnums[i])
                            bCanMove = true;		
            }
            
            if (item->GetVnum() == ITEM_USE)
            {
                    switch (item->GetSubType())
                    {
                            case USE_POTION:
                            case USE_POTION_DELAY:
                            case USE_ABILITY_UP:
                                    bCanMove = true;
                                    break;
                    }
            }
            
            return bCanMove;
    }

    _countof or countof :

    template < typename T, size_t N >
    size_t countof( T ( & arr )[ N ] )
    {
            return std::extent< T[ N ] >::value;
    }

     

    Usefull codes.

    Kind Regards

    Ken

    Thanks a lot dude ! But how to put claws in only one special item ? (vnum 75500)

    Because with my actual system, I can put them (and only claws) in all belts and not only one

  2. Try like this:

     

    	static bool CanMoveIntoBeltInventory(LPITEM item)
    	{
    		bool canMove = false;
    
    		if (item->GetType() == ITEM_WEAPON)
    		{
    			switch (item->GetSubType())
    			{
    			case WEAPON_CLAW:
    				canMove = true;
    				break;
    			}
    		}
    		else if (item->GetType() == ITEM_USE)
    		{
    			switch (item->GetSubType())
    			{
    			case USE_POTION:
    			case USE_POTION_NODELAY:
    			case USE_ABILITY_UP:
    				canMove = true;
    				break;
    			}
    		}
    
    		return canMove;
    	}

     

    I can move claws and Potion but on all belts, not only one...

    I didn't try to use your script now because there'snt a check for the item_vnum in order to put claws only in a special belt (id 75500)

    Thanks anyway :)

  3. Hello, I want to create a special belt with only claw in it, so I decided to create a if statement in "belt_inventory_helper.h", so I created it in lot of way but without success...

    Here's the first way (belt_inventory_helper.h) :

        static bool CanMoveIntoBeltInventory(LPITEM item)
        {
            bool canMove = false;
            if (item->GetVnum() == MY ITEM)
            {
                if (item->GetType() == ITEM_WEAPON)
                {
                    switch (item->GetSubType())
                    {
                    case WEAPON_CLAW:
                        canMove = true;
                        break;
                    }
                }
            }
            else if (item->GetVnum() != MY ITEM)
            {
                if (item->GetType() == ITEM_USE)
                {
                    switch (item->GetSubType())
                    {
                    case USE_POTION:
                    case USE_POTION_NODELAY:
                    case USE_ABILITY_UP:
                        canMove = true;
                        break;
                    }
                }
            }
            return canMove;
        }
    
    
    Second way (belt_inventory_helper.h) :
    
        static bool CanMoveIntoBeltInventory(LPITEM item)
        {
            bool canMove = false;
            if (item->GetType() == ITEM_USE || item->GetType() == ITEM_WEAPON)
            {
                if (item->GetVnum() == MY ITEM)
                {
                    switch (item->GetSubType())
                    {
                        case WEAPON_CLAW:
                            canMove = true;
                            break;
                    }
                }
                else
                {
                    switch (item->GetSubType())
                    {
                        case USE_POTION:
                        case USE_POTION_NODELAY:
                        case USE_ABILITY_UP:
                            canMove = true;
                            break;
                    }
                }
            }
            return canMove;
        }
    
    Third way in order to see if I can place everything in it and then create a special function for this special belt (input_main.cpp & char_item.cpp) :
    
        if (pkItem->GetVnum() != MY ITEM && p->ItemPos.IsBeltInventoryPosition() && false == CBeltInventoryHelper::CanMoveIntoBeltInventory(pkItem))
        {
            ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<Ceintures> Vous ne pouvez pas bouger cet objet ici."));
            return;
        }
    
    
    
        if (item->GetVnum() != MY ITEM && DestCell.IsBeltInventoryPosition() && false == CBeltInventoryHelper::CanMoveIntoBeltInventory(item))
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº º§Æ® Àκ¥Å丮·Î ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
            return false;
        }
    
    

    And I can't put everything, I can only put the things declared in CanMoveIntoBeltInventory.

     

    Have a nice day, thanks :)

     

  4. Can you do this for stones?

    Yes, but you have to use IsStone

    You can do this for a GM too

    I guess this is so

    if (IsGameMaster())
    {
    	__AttachSelectEffectMonster(); // Effect Example
    }

    nice idea :) ... but like this you can't attach the horse with any of this effects .

    I guess this is so

    if (IsMounting())
    {
    	__AttachSelectEffectMonster();
     // Effect Example
    }

     

     

    Yes, I did a system like that before

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