• 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!

New weapon in OEN423 upgrade system

Dran Ryszard

Active Member
Joined
Apr 25, 2023
Messages
136
Reaction score
30
Location
Poland
Hi, im using that upgrade system - CreatureEvent - [TFS 1.3 / 1.4] Upgrade System (https://otland.net/threads/tfs-1-3-1-4-upgrade-system.264672/)

And i have added FIST weapons in my ot, but that system wont work with it.. Not possible to add slot to weapon fist.
Weapon FIST it added i think 100% good, couse when i check weapon type by script it was FIST..
I edited little that system, to have only 2 slots (start item is without any), then i have item what add a slot to any item

Code:
elseif item.itemid == US_CONFIG[1][ITEM_SLOT_CRYSTAL] then
  local rarityId = target:getRarityId()
  if rarityId < EPIC then
    local newRarity = rarityId + 1
    target:setRarity(newRarity)
    player:sendTextMessage(MESSAGE_INFO_DESCR, "Dodano SLOT do przedmiotu: " .. target:getName() .. ".")
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    item:remove(1)
  else
    player:sendTextMessage(MESSAGE_STATUS_WARNING, "Przedmiot " .. target:getName() .. " posiada juz maksymalna ilosc slotow!")
    player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
  end

but when i tried add slot to fist weapon its not possible :(
1750164340311.webp

I check by print for "isUpgradable"
and is not..
isUpgradable: false Profas Gloves 49251

tried add it to items type

Code:
US_ITEM_TYPES = {
  ALL = 1,
  WEAPON_MELEE = 2,
  WEAPON_DISTANCE = 4,
  WEAPON_WAND = 8,
  SHIELD = 16,
  HELMET = 32,
  ARMOR = 64,
  LEGS = 128,
  BOOTS = 256,
  RING = 512,
  NECKLACE = 1024,
  WEAPON_FIST = 2048,
  WEAPON_ANY = 14 + 2048
}

but still nothing
 
Update function Item.getItemType(self), function ItemType.isUpgradable(self) and function ItemType.canHaveItemLevel(self) to include fist.
 
Update function Item.getItemType(self), function ItemType.isUpgradable(self) and function ItemType.canHaveItemLevel(self) to include fist.

Ye, i think i added it but still print show false when i tried use it on fist weapon

LUA:
function ItemType.isUpgradable(self)
  if self:isStackable() or self:getTransformEquipId() > 0 then
    return false
  end
  local slot = self:getSlotPosition() - SLOTP_LEFT - SLOTP_RIGHT

  local weaponType = self:getWeaponType()
  if weaponType > 0 then
    if weaponType == WEAPON_AMMO then
      return false
    end
    if
      weaponType == WEAPON_SHIELD or weaponType == WEAPON_DISTANCE or weaponType == WEAPON_WAND or weaponType == WEAPON_FIST or
        isInArray({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, weaponType)
     then
      return true
    end
  else
    if slot == SLOTP_HEAD or slot == SLOTP_ARMOR or slot == SLOTP_LEGS or slot == SLOTP_FEET or slot == SLOTP_NECKLACE or slot == SLOTP_RING then
      return true
    end
  end
  return false
end

LUA:
function Item.getItemType(self)
  local itemType = self:getType()
  local slot = itemType:getSlotPosition() - SLOTP_LEFT - SLOTP_RIGHT

  local weaponType = itemType:getWeaponType()
  if weaponType > 0 then
    if weaponType == WEAPON_SHIELD then
      return US_ITEM_TYPES.SHIELD
    end
    if weaponType == WEAPON_DISTANCE then
      return US_ITEM_TYPES.WEAPON_DISTANCE
    end
    if weaponType == WEAPON_WAND then
      return US_ITEM_TYPES.WEAPON_WAND
    end
    if weaponType == WEAPON_FIST then
      return US_ITEM_TYPES.WEAPON_FIST
    end
    if isInArray({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, weaponType) then
      return US_ITEM_TYPES.WEAPON_MELEE
    end
  else
    if slot == SLOTP_HEAD then
      return US_ITEM_TYPES.HELMET
    end
    if slot == SLOTP_ARMOR then
      return US_ITEM_TYPES.ARMOR
    end
    if slot == SLOTP_LEGS then
      return US_ITEM_TYPES.LEGS
    end
    if slot == SLOTP_FEET then
      return US_ITEM_TYPES.BOOTS
    end
    if slot == SLOTP_NECKLACE then
      return US_ITEM_TYPES.NECKLACE
    end
    if slot == SLOTP_RING then
      return US_ITEM_TYPES.RING
    end
  end
  return US_ITEM_TYPES.ALL
end

I tried do something like that

LUA:
if not target then
  return false
end

if target:getId() == 49251 then
  return true
elseif not target:isItem() or not target:getType():isUpgradable() then
  return false
end

But it wont work too :/

LUA:
if not target:isItem() or not target:getType():isUpgradable() then
  print("ItemID: " .. target:getId() .. " item is item?: " .. tostring(target:isItem()) .. " is upgradable?: " .. tostring(target:isItem() and target:getType():isUpgradable()))
  return false
end

ItemID: 49251 item is item?: true is upgradable?: false

16:43 Weapon Type: Fist Type ID: 8
 
Last edited:
The upgrade system scripts seem to be correct, but apparently your TFS source does not support the "fist" weapon type. You need to add support for the "fist" type in your server source (see Feature - WeaponType Fist TFS 1.0 (https://otland.net/threads/weapontype-fist-tfs-1-0.210206/) for a guide) so the system works with "fist" weapons.

I have already FIST weapons ;D
I found problem, but i don't understand why it not know what is WEAPON_FIST
But when i change weaponType == WEAPON_FIST to type id what i get when i check getWeaponType (8), then it work without any problem

So i forgott add any change in sources or what? I was check all WEAPON_SWORD in sources and added in same lines a WEAPON_FIST, type in items.xml work, dmg about fist skill work, so why that not work?

Btw its not big problem if i check it like that? weaponType == 8
 
Back
Top