• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Combination Two Handed Item with shield

alvaro007

New Member
Joined
Jun 15, 2012
Messages
35
Reaction score
2
Hi Community of otland, we want to ask that if someone know to how doing on my ot how can i combinate a two handed item with shield but through script, only to remove the slottype through script not through items.xml
 
Solution
You can do it with movements perfectly, you only need conditions.
Friend if you can not understand what the boy wants, then do not say it's possible. because that is not true.
It's not about 2 articles.
it is about that all items have to meet the conditions and interact with the weapon.
if you do it with only 1 code, nothing will prevent the item from being used regardless of the weapon, unless it has a code with such conditions.
bro.. i did not write that....

that last "return true" at #17...

Thats saying that nomatter what you do, you can equip it...
If you copy, at least copy it right.
 
The problem bro is that with your return false, i can never equip the weapon, if im <55 skill level i want to equip the weapon like a two handed, but with your script i cant equip never, if i skill shield level 30 for example and i havent got anyitem in my slot left and right, i cant equip my weapon, because this return false, it affects all the function
 
Code:
function onEquip(cid, item, slot)
if getPlayerSlotItem(cid, CONST_SLOT_LEFT) then
  weapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
elseif getPlayerSlotItem(cid, CONST_SLOT_RIGHT) then
  weapon = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid
elseif weapon and weapon == 2392 and getPlayerSkillLevel(cid, SKILL_SHIELD) >= 55  then
  return true
elseif getPlayerSlotItem(cid, CONST_SLOT_LEFT) == false and getPlayerSlotItem(cid, CONST_SLOT_RIGHT) == false then
  return true
else
   if getPlayerSkillLevel(cid, SKILL_SHIELD) < 55 then
       doPlayerSendCancel(cid, 'You need 55 shielding skill to equip this')
   return false
   end
   if weapon ~= 2392 then
      doPlayerSendCancel(cid, 'You need both hands free to equip this.')
      return false
   end
end
end
 
Can you explain what you want exactly? with which items and which not?

Explain yourself. Anyway, I mostly gave you the solution. With minor changes you should be able to get it done yourself.
 
Yes, The script work but if i have equip my weapon 2393 and then i equip for example a shield, i can put th shield but shouldnt equip if u are skill shield < 55, i dont know why?
 
I want that a weapon that have slottype two-handed can combinate with shield at skill level >=55, but if you are skill level shield < 55 your weapon cant combinate with a shield or with anyitem, because it a two-handed weapon
 
you will not be able to do it using 'movements' script!
Example of what you are looking for:

n4FJ2345SVaOPolKEd7vtg.png
NHNSrSvmTNOCo1qx-Lbvgw.png
iK2LtmziTZCMJYSOhVogVg.png
t7sOIXtBQ8e2kClUgaRE4g.png

That works like this with all objects!
regards ;D
 
If dont possible to do through movements, will be through source code right?, i havent no idea about scripting through source code, What have i edit in my source?
 
I recommend you use, 'creaturescript' - if you use TFS 0.3.6 <0.4 ( function onMoveItem() )
but if you use TFS 1.x+ you use, 'events' - method="onMoveItem"
It's the only thing I can tell you!
 
Code:
function onEquip(cid, item,slot)
if getPlayerSlotItem(cid, CONST_SLOT_LEFT) then
    weapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
    elseif getPlayerSlotItem(cid, CONST_SLOT_RIGHT) then
    weapon = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid
    end
    local it = ItemType(weapon):getWeaponType()

if (getPlayerSlotItem(cid, CONST_SLOT_LEFT) and it ~= 5 and getPlayerSkillLevel(cid, SKILL_SHIELD) < 55) or (getPlayerSlotItem(cid, CONST_SLOT_RIGHT) and it ~= 5 and getPlayerSkillLevel(cid, SKILL_SHIELD) < 55) then -- If it has a weapon already equiped on any of the hands, cant equip.
      player:sendCancelMessage('You need both hands free to equip this.')
      return false
elseif (getPlayerSlotItem(cid, CONST_SLOT_LEFT) and it == 5 and getPlayerSkillLevel(cid, SKILL_SHIELD) < 55) or (getPlayerSlotItem(cid, CONST_SLOT_RIGHT) and it == 5 and getPlayerSkillLevel(cid, SKILL_SHIELD) < 55) then -- If it has a shieldalready equiped on any of the hands, cant equip sword.
      player:sendCancelMessage('You need both hands free to equip this.')
      return false
   else
     return true
   end
end

Put this code on any shield and weapon you want to use it. If player has a weapon (onehanded) equiped, and the player has less than 55 skill, it wont be able to equip.
So now, change your giant sword or any twohanded weapon you want to use in items.xml to be one handed. trying to put a shield, will simulate as it is a two handed.

It working. Tested.
 
If you want to do it on source:
Player.cpp:
In function
Code:
queryAdd
Change:
Code:
if (slotPosition & SLOTP_TWO_HAND)
To:
Code:
if ((slotPosition & SLOTP_TWO_HAND) && getSkillLevel(SKILL_SHIELD) < 55)
Then in switch after:
Code:
case CONST_SLOT_RIGHT:
Change:
Code:
if (slotPosition & SLOTP_TWO_HAND)
To:
Code:
if ((slotPosition & SLOTP_TWO_HAND) && getSkillLevel(SKILL_SHIELD) < 55)
Change:
Code:
if (leftItem->getSlotPosition() & SLOTP_TWO_HAND)
To:
Code:
if ((leftItem->getSlotPosition() & SLOTP_TWO_HAND) && getSkillLevel(SKILL_SHIELD) < 55)
After:
Code:
case CONST_SLOT_RIGHT:
Change:
Code:
if (slotPosition & SLOTP_TWO_HAND)
To:
Code:
if ((slotPosition & SLOTP_TWO_HAND) && getSkillLevel(SKILL_SHIELD) < 55)
Change:
Code:
if (rightItem->getSlotPosition() & SLOTP_TWO_HAND)
To:
Code:
if ((rightItem->getSlotPosition() & SLOTP_TWO_HAND) && getSkillLevel(SKILL_SHIELD) < 55)
This way you can achieve what you want without link movements to every two-handed weapons and shields.
29ftuh1.jpg
 
Your script not be that i search because with your script i would have put on my movements.xml all the items of one hand of my server
 
You can do it with movements perfectly, you only need conditions.
Friend if you can not understand what the boy wants, then do not say it's possible. because that is not true.
It's not about 2 articles.
it is about that all items have to meet the conditions and interact with the weapon.
if you do it with only 1 code, nothing will prevent the item from being used regardless of the weapon, unless it has a code with such conditions.
 
Solution
Back
Top