1
[Aporte] Tfs 10.98 update 2018 (System Item abilities via Lua) Vie Oct 12, 2018 12:49 pm
[Admin] God Maya
![[Admin] God Maya](https://2img.net/u/2712/30/40/04/avatars/1-92.jpg)
Administrador

Aqui le traigo un servidor ya compilado con un sistema mucho mejor que cualquier upgrade system realmente con este sistema volara su creatividad.
explicacion:
este sistema integrado a sources donde podran usar un objeto para cambiar cualquier atribute desde lua sin tocar item.xml ahora totalmente manejable tambien dejare los cambios en sources y los cambios por si queren usar tfs 1.2
Nuevas funciones integradas::
item:setAbility(key, value) ---> agrega una habilidad
item:getAbility(key) ----> revisa si tiene un habilidad
item:removeAbility(key) ----> remeve un habilidad especifica
total atributos habilitados:
- Código:
ITEM_ABILITY_HEALTHGAIN
ITEM_ABILITY_HEALTHTICKS
ITEM_ABILITY_MANAGAIN
ITEM_ABILITY_MANATICKS
ITEM_ABILITY_CONDITIONSUPPRESSIONS
ITEM_ABILITY_MAXHITPOINTS
ITEM_ABILITY_MAXMANAPOINTS
ITEM_ABILITY_MAGICPOINTS
ITEM_ABILITY_MAXHITPOINTSPERCENT
ITEM_ABILITY_MAXMANAPOINTSPERCENT
ITEM_ABILITY_MAGICPOINTSPERCENT
ITEM_ABILITY_SKILLFIST
ITEM_ABILITY_SKILLCLUB
ITEM_ABILITY_SKILLSWORD
ITEM_ABILITY_SKILLAXE
ITEM_ABILITY_SKILLDISTANCE
ITEM_ABILITY_SKILLSHIELD
ITEM_ABILITY_SKILLFISHING
ITEM_ABILITY_CRITICALHITCHANCE
ITEM_ABILITY_CRITICALHITAMOUNT
ITEM_ABILITY_LIFELEECHCHANCE
ITEM_ABILITY_LIFELEECHAMOUNT
ITEM_ABILITY_MANALEECHCHANCE
ITEM_ABILITY_MANALEECHAMOUNT
ITEM_ABILITY_SPEED
ITEM_ABILITY_ABSORBPHYSICAL
ITEM_ABILITY_ABSORBENERGY
ITEM_ABILITY_ABSORBEARTH
ITEM_ABILITY_ABSORBFIRE
ITEM_ABILITY_ABSORBWATER
ITEM_ABILITY_ABSORBICE
ITEM_ABILITY_ABSORBHOLY
ITEM_ABILITY_ABSORBDEATH
ITEM_ABILITY_FIELDABSORBPHYSICAL
ITEM_ABILITY_FIELDABSORBENERGY
ITEM_ABILITY_FIELDABSORBEARTH
ITEM_ABILITY_FIELDABSORBFIRE
ITEM_ABILITY_FIELDABSORBWATER
ITEM_ABILITY_FIELDABSORBICE
ITEM_ABILITY_FIELDABSORBHOLY
ITEM_ABILITY_FIELDABSORBDEATH
ITEM_ABILITY_ELEMENTTYPE
ITEM_ABILITY_ELEMENTDAMAGE
ITEM_ABILITY_MANASHIELD
ITEM_ABILITY_INVISIBLE
ITEM_ABILITY_REGENERATION
ejecutar en mysql en su base de datos:
- Código:
ALTER TABLE `player_items` ADD `abilities` BLOB NOT NULL;
ALTER TABLE `player_depotitems` ADD `abilities` BLOB NOT NULL;
ALTER TABLE `player_inboxitems` ADD `abilities` BLOB NOT NULL;
ALTER TABLE `tile_store` ADD `abilities` BLOB NOT NULL;
**Para que la regeneración funcione (HEALTHGAIN, MANAGAIN), también debe establecer ITEM_ABILITY_REGENERATION en 1.
**ITEM_ABILITY_REGENERATION, ITEM_ABILITY_MANASHIELD e ITEM_ABILITY_INVISIBLE solo se deben establecer en 1 para habilitar la habilidad.
**Si desea "establecer una capacidad en 0", también conocido como elemento: setAbility (clave, 0) no funcionará. Utilice el elemento: removeAbility (clave) en su lugar.
**Establecer una habilidad mientras se equipa un elemento no lo actualizará automáticamente y aplicará las estadísticas. Para que se actualice, debe desequidar y reequipar el elemento.
**Por ahora, esto solo funciona con TFS 1.3. Si usa 1.2 y aún desea usar este código, puede aplicar este compromiso a sus fuentes para habilidades crítical y leech skills.
**ITEM_ABILITY_ELEMENTTYPE y ITEM_ABILITY_ELEMENTDAMAGE se deben emparejar para que funcionen correctamente
** Los elementos que no se cargan a través de movement.xml no registrarán habilidades
**Las armas que se cargan a través de weapons.xml no registrarán habilidades
ejemplos para añadir critical:
- Código:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not target:isItem() then
return false
end
local position = (toPosition.x ~= 65535 and toPosition or player:getPosition())
local elements = {COMBAT_FIREDAMAGE, COMBAT_ICEDAMAGE, COMBAT_DROWNDAMAGE, COMBAT_EARTHDAMAGE, COMBAT_ENERGYDAMAGE, COMBAT_DEATHDAMAGE, COMBAT_HOLYDAMAGE}
target:setAbility(ITEM_ABILITY_ELEMENTTYPE, elements[math.random(#elements)])
target:setAbility(ITEM_ABILITY_ELEMENTDAMAGE, math.random(50, 250))
position:sendMagicEffect(CONST_ME_MAGIC_RED)
item:remove()
return true
end
para añadir mana regeneracion
- Código:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not target:isItem() then
return false
end
local position = (toPosition.x ~= 65535 and toPosition or player:getPosition())
target:setAbility(ITEM_ABILITY_MANAGAIN, math.random(1, 100))
target:setAbility(ITEM_ABILITY_MANATICKS, math.random(1, 100))
target:setAbility(ITEM_ABILITY_REGENERATION, math.random(1, 100))
position:sendMagicEffect(CONST_ME_MAGIC_RED)
item:remove()
return true
end
para añadir random elementos de demage
- Código:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not target:isItem() then
return false
end
local position = (toPosition.x ~= 65535 and toPosition or player:getPosition())
local elements = {COMBAT_FIREDAMAGE, COMBAT_ICEDAMAGE, COMBAT_DROWNDAMAGE, COMBAT_EARTHDAMAGE, COMBAT_ENERGYDAMAGE, COMBAT_DEATHDAMAGE, COMBAT_HOLYDAMAGE}
target:setAbility(ITEM_ABILITY_ELEMENTTYPE, elements[math.random(#elements)])
target:setAbility(ITEM_ABILITY_ELEMENTDAMAGE, math.random(50, 250))
position:sendMagicEffect(CONST_ME_MAGIC_RED)
item:remove()
return true
end
en actions.xml para cada scripts pueden usar una linea asi para cada scripts con diferente item id
- Código:
<action itemid="8300" script="slot.lua"/>
nota en estos ejemplos se ha usado math.random(1, 100) ustedes puede usar un numero fijo si es que lo quieren asi.
link del servidor tfs 1.3 10.98 sin store: [Tienes que estar registrado y conectado para ver este vínculo]
para las persona que quieren usar el sistema en otra tfs que no sea tfs 1.3 tienen que hacer estos cambios:
link: [Tienes que estar registrado y conectado para ver este vínculo]
Para los que tienen ya tfs 1.3 y no contiene el sistema y lo quieren añadir tienen que hacer estos cambios:
link: [Tienes que estar registrado y conectado para ver este vínculo]
listo.
creditos: Vulcanx

![[Aporte] Tfs 10.98 update 2018 (System Item abilities via Lua) YNU5B25](https://i.imgur.com/yNU5B25.png)