you can use this functionas if it were a reward from a quest,
Player:addCustomEquipment(equipId)
local group = itemType:getGroup()
. I can't find anything about getGroup()
regarding items anywhere to update my files so instead have this check commented out as it doesn't seem important and won't let the script load.I have no idea why you wouldn't have itemType:getGroup() but if you really don't, then you can remove that check, as it is for safety purposes only. You will need to make sure you don't accidentally put an item in the xml that isn't an actual item you can equip, such as a potion, food, trees, bushes, buildings ect.Trying to implement this with my server now, I'm a little outdated (1.3) and 7.6 fyi. Closest public distro to mine would be nekiros old 7.72 downgrade for reference.
One error I can't solve is your checklocal group = itemType:getGroup()
. I can't find anything aboutgetGroup()
regarding items anywhere to update my files so instead have this check commented out as it doesn't seem important and won't let the script load.
Equipping custom items has weird behaviour:
- Helmet/Weapons/Legs/Shields all work in their respective slots but also work in hands slot
- Armour does not work in armour slot but works in hand slots
- Boots do not work in boots slot but work in hands slot
Regular items on my server don't have this issue.
I haven't tested every custom attribute yet but the one's I have tested have all worked and the looting works too . I really enjoy using this system, thanks for sharing it with us
local itemType = ItemType(properties.baseItem)
local weaponType = itemType:getWeaponType()
if weaponType == WEAPON_WAND then
print("Error item " ..properties.attributes["name"].. " is a wand, wand's are currently not supported, was not added to CustomEquipment!")
end
if weaponType == WEAPON_AMMO then
print("Error item " ..properties.attributes["name"].. " is a type of ammo, ammo type's are not supported, was not added to CustomEquipment!")
end
if not table.contains(baseItemList, properties.baseItem) then
table.insert(baseItemList, properties.baseItem)
end
customEquipment[properties.equipId] = properties
end
Thank youAs for boots not equipping to boots , but equipping on hands, ect, ect, that is very odd indeed, this will need further investigation on my part.
I'm still trying to figure out why it happened(albeit slowly), must be something quirky with my sources. Thank you for the link, I'm going to implement this asap.I don't have those problems @Silba , but at any rate, this system pretty much is not necessary anymore, really only benefit from this is droploot, and being able to use same id again, since everything else was pretty much added with this commit
Adding new item attributes (#2807) · otland/forgottenserver@a14f1fb
from #998, for more details, refer to the PR #2807 itselfgithub.com
I may remake the parts of this system that are still beneficial from scratch for 1.5 revscripts one day, but for now, this system is obsolete.
you are using this version?@Codinablack
I have been testing it, but it seems the mana regeneration does not apply.
Not sure why not, still testing it what is going on.
you are using this version?
last I knew everything had worked fine, and mana generation had never even been on the list of issues, but if you aren't using the latest version make sure to switch to it, but like I said, support for this is dropped due to most of all of this being directly in the items.xml now on the master branch.
local equipConditions = {
["healthgain"] = {type = CONDITION_REGENERATION, param = CONDITION_PARAM_HEALTHGAIN,},
["managain"] = {type = CONDITION_REGENERATION, param = CONDITION_PARAM_MANAGAIN,},
if key.type == CONDITION_REGENERATION then
if key.param == CONDITION_PARAM_HEALTHGAIN then
condition:setParameter(key.param, _value)
condition:setParameter(CONDITION_PARAM_HEALTHTICKS, healthTicks)
self:addCondition(condition)
end
if key.param == CONDITION_PARAM_MANAGAIN then
condition:setParameter(key.param, _value)
condition:setParameter(CONDITION_PARAM_MANATICKS, manaTicks)
self:addCondition(condition)
end
end
Excellent find and fix my friend! Absolutely love itYep, but i fixed it for myself now.
See the code in the attached file.
Basically I changed the type like here:
LUA:local equipConditions = { ["healthgain"] = {type = CONDITION_REGENERATION, param = CONDITION_PARAM_HEALTHGAIN,}, ["managain"] = {type = CONDITION_REGENERATION, param = CONDITION_PARAM_MANAGAIN,},
and then I adjusted the processing here:
LUA:if key.type == CONDITION_REGENERATION then if key.param == CONDITION_PARAM_HEALTHGAIN then condition:setParameter(key.param, _value) condition:setParameter(CONDITION_PARAM_HEALTHTICKS, healthTicks) self:addCondition(condition) end if key.param == CONDITION_PARAM_MANAGAIN then condition:setParameter(key.param, _value) condition:setParameter(CONDITION_PARAM_MANATICKS, manaTicks) self:addCondition(condition) end end
I hope it's clear
Boots on boots slot = no buff
for key , id in pairs(baseItemList) do
local equipEvent = MoveEvent()
local deEquipEvent = MoveEvent()
equipEvent:id(id)
deEquipEvent:id(id)
for key , id in pairs(baseItemList) do
local equipEvent = MoveEvent()
local deEquipEvent = MoveEvent()
local slot = ItemType(id):getSlotPosition()
equipEvent:id(id)
deEquipEvent:id(id)
equipEvent:slot(slot)
deEquipEvent:slot(slot)
if eq.requirements["vocation"] then
local vocation = Vocation(eq.requirements["vocation"])
if vocation then
if vocation ~= (player:getVocation() or player:getVocation():getDemotion()) then
player:sendTextMessage(MESSAGE_INFO_DESCR,"You don't have the proper vocation to equip that item!")
return false
end
end
end
local vocationMatch = false
if eq.requirements["vocation"] then
for word in string.gmatch(eq.requirements["vocation"], '([^,]+)') do
local vocation = Vocation(word)
if vocation == (player:getVocation() or player:getVocation():getDemotion()) then
vocationMatch = true
end
end
if vocationMatch == false then
player:sendTextMessage(MESSAGE_INFO_DESCR,"You don't have the proper vocation to equip that item!")
return false
end
end
Aún no lo he probado, acabo de terminarlo. Hay algunas impresiones que podrían eliminarse y algunas limpiezas que hacer, pero sé que ha pasado mucho tiempo desde que actualicé, así que las compartiré de inmediato con cualquiera que haya estado esperando. Creo que abordé todas las cuestiones. Ahora solo queda 1 evento en HealthChange, y las condiciones se controlan con mayor precisión, todo debería funcionar, si algo no funciona, posiblemente sea el escudo de maná, si ese es el caso, avíseme, podría ser por el uso. de la identificación única.
De todos modos, aquí tenéis chicos.
https://gist.github.com/Codinablack/156f5d9febbaa296b525bc3353c94ac0
[autofusión]1641966815[/autofusión]
Actualizaré la publicación principal si la gente prueba esta versión sin más problemas.
[autofusión]1641970509[/autofusión]
puedes usar esta función
LUA:Jugador:addCustomEquipment(equipId)
en una acción o algún otro tipo de script para agregar un elemento de equipo personalizado al inventario de un jugador. Sólo necesitas usar el equipId del archivo xml.
Error de secuencia de comandos de Lua: [Interfaz de secuencias de comandos]
C:\Users\Martin\Downloads\ProjectoKabo\Server Baiak-Kabo\baiakthunder-master\data\scripts\Custom Equpiment\customequpiment.lua
...master\data\scripts\Custom Equpiment\customequpiment.lua:73: intento de indexar el 'equipmentFile' local (un valor nulo)
rastreo de pila:
[C]: en la función '__index'
...master\data\scripts\Custom Equpiment\customequpiment.lua:73: en el fragmento principal
[QUOTE] equipopersonalizado.lua [error][/QUOTE]
^[/CÓDIGO]
en la version 1.5