Tofame
Intermediate OT User
Yo,
The anime OT that existed 10 years ago had interesting system in which you had training weapons that allowed you to get more skill tries than usually and I just wanted to bring it to modern tfs (old version should work on any tfs 1.x, new one requires revscript system so its 1.3-1.5)
example behavior: club weapons give few skill_club tries as usual.
club weapon with certain id will be giving few skill_club tries + additional skill_club tries (configured in the script).
preview:
Installing:
Thanks to Xikini kindness we now have revscript version that requires only uploading file to data/scripts and that's all to do!
data/scripts/skillTries.lua
Notes:
edit: admin add please [1.4] in title, I forgot and there are no options for editing it
The anime OT that existed 10 years ago had interesting system in which you had training weapons that allowed you to get more skill tries than usually and I just wanted to bring it to modern tfs (old version should work on any tfs 1.x, new one requires revscript system so its 1.3-1.5)
example behavior: club weapons give few skill_club tries as usual.
club weapon with certain id will be giving few skill_club tries + additional skill_club tries (configured in the script).
preview:
Watch AAAFilmikOBS_2022-08-27 12-14-49 | Streamable
Watch "AAAFilmikOBS_2022-08-27 12-14-49" on Streamable.
streamable.com
Installing:
Thanks to Xikini kindness we now have revscript version that requires only uploading file to data/scripts and that's all to do!
data/scripts/skillTries.lua
Lua:
local configBands = {
[26433] = { -- item id that increases skill tries
bonusTry = 8, -- how much it increases tries by
xeffect = 40 -- what effect to send on creature
},
[26435] = {
bonusTry = 4,
xeffect = 40
},
[26436] = {
bonusTry = 106,
xeffect = 40
},
[26437] = {
bonusTry = 50,
xeffect = 40
}
}
local ec = EventCallback
ec.onGainSkillTries = function(self, skill, tries)
local target = self:getTarget()
local whatBand = 0
-- if you want to enable only for certain monster than change line below for:
-- if target and target:getName() == "Train" then
if target then
if self:getSlotItem(CONST_SLOT_LEFT):getId() then
whatBand = configBands[self:getSlotItem(CONST_SLOT_LEFT):getId()]
if not whatBand then
return tries
end
tries = tries + whatBand.bonusTry -- increased tries by config
target:getPosition():sendMagicEffect(whatBand.xeffect)
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Using training weapon. Skilling is increased!")
end
end
return tries
end
ec:register(1) -- 1 is indicating execution order of scripts.
data\creaturescripts\skillTries.lua
(local bands is basically configuration where you configure everything)
creaturescripts.xml
Add to the monster that you want to script work with this part
data\monster\monsters\YourMonsterName.xml:
(local bands is basically configuration where you configure everything)
Lua:
-- specific weapons giving more skill tries than usually.
-- (while attacking some monsters like "Train". Depends to whom you added this event to..)
--[[
(SKILL_FIST) | (SKILL_CLUB) | (SKILL_SWORD)
(SKILL_AXE) (SKILL_DISTANCE) (SKILL_SHIELD)
(SKILL_FISHING) (SKILL_MAGLEVEL) (SKILL_LEVEL)
(CONST_SLOT_HEAD)
(CONST_SLOT_NECKLACE)
(CONST_SLOT_BACKPACK)
(CONST_SLOT_ARMOR)
(CONST_SLOT_RIGHT)
(CONST_SLOT_LEFT)
(CONST_SLOT_LEGS)
(CONST_SLOT_FEET)
(CONST_SLOT_RING)
(CONST_SLOT_AMMO)
]]--
local bands = {
[26433] = { -- item id
tries = 10, -- bonus skill tries
skillz = SKILL_CLUB, -- look commented area above for more
xeffect = 40 -- what effect to send on attacked creature
},
[26435] = { -- Wooden band
tries = 10,
skillz = SKILL_FISHING,
xeffect = 40
},
[26436] = { -- Critical Band
tries = 10,
skillz = SKILL_CLUB,
xeffect = 40
},
[26437] = { -- Attack Speed Band
tries = 10,
skillz = SKILL_FIST,
xeffect = 40
}
}
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
local whatBand = 0
if creature:isMonster() and attacker:isPlayer() then
if attacker:getSlotItem(CONST_SLOT_LEFT) then
whatBand = bands[attacker:getSlotItem(CONST_SLOT_LEFT):getId()]
if not whatBand then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
creature:getPosition():sendMagicEffect(whatBand.xeffect)
attacker:addSkillTries(whatBand.skillz, whatBand.tries)
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
creaturescripts.xml
XML:
<event type="healthchange" name="skillTries" script="skillTries.lua"/>
Add to the monster that you want to script work with this part
data\monster\monsters\YourMonsterName.xml:
XML:
<script>
<event name="skillTries"/>
</script>
Notes:
- NOTE FOR OLD VERSION: If you have for example weaponType = "club" and in script this weapon adds different skill tries than club then you are getting those bonus skill tries to your skill + few skill_tries to club. If you want fist tries + bonus fist tries (script) then you don't put weaponType at all in items.xml
- NOTE FOR OLD VERSION: The script will work only with monsters that have part above copied.
- I got huge help with error fixing in this script on otacademy for what im grateful ;3
- Huge help from Xikini here too
- Revscript (new version) bonus tries are now given based on weaponType from items.xml as usual. No longer config for setting which skill to add tries to.
edit: admin add please [1.4] in title, I forgot and there are no options for editing it
Last edited: