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

Lua Xikini's Free Scripting Service TFS 1.4.2

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,830
Solutions
586
Reaction score
5,410
Request whatever you want, within reason.

Please do not request for things that require source editing or database queries.

------------------------------------
If I've reacted to your post, it means I've read it. 👍😍🤣😲🙁😡🤔😉

------------------------------------
Completed Requests

A boss that randomly creates effects on tiles, that when stepped on, gives the player increased damage/mitigation to that boss.
Kill monster and gain X% extra loot chance or Y% extra experience for Z minutes
A pack of 6 useful simple scripts.
-> (1) Simple quest npc
-> (2,3,4,5) use levers in specific order / stand with 4 players / use 4 objects / place items -> to open wall
-> (6) use lever to add/remove/replace objects
Wave type spell, with multiple effects
-> Same spell, but with default combat system
House market system. (owner places price on blackboard and object on the ground, other players buy with a lever)
Respawn System (closest anchor (like darks souls bonfire) / tavern / temple)
Vocation Death Protection (protect the noobs!)
Spell that shows area it will damage, before it strikes.
RAID SYSTEM - rebuilt in Lua, with some more features.
Modal Window - Teleport Item with saving/deleting of positions
Show top 3 Online Players (outfit, name, level) (as monsters, in set positions)
onLook function showing kill count of player.
Modal Window - Use Item -> choose reward.
Talkaction - !backpacks - to buy backpacks (or single items) anywhere. uses bank & current money on players
Quest/Event? Turn a bunch of objects with a monster, spawn portal.
Spawn Monsters, after they've all been killed, give global increased experience/loot in specific area's
Evolving Weapons - Kill X amount of specific creatures, evolve weapon and gain extra damage to those creatures.
Random Portals spawn at XX:XX time(s). (can exit 'off' portals, if you have the storage.)
Monster that adjusts speed based on target
Monster that increases damage output based on # of players nearby
Experience recovery Item. Die -> Use Item -> gain % of lost experience
Character Snapshot - Keeps track of all skills & level, for resetting later.
Fire Dagger - Physical Damage Melee Weapon, with % added damage
Players in specific level ranges don't lose skills/loot/experience, when they die.
Multiclient Limit Check - with admin account not being counted towards limit
Capacity Increasing Items
Upgradeable Protection Amulet - 10% to all elements
-> upgrade amulet, but for all items.
onKill - give reward to all players who dealt damage
-> example: give reward based on damage contribution
Quest Book - Record your quest progress into a book.
Stat System, using modal windows
Holy Tible (POI) - Require Item to use teleport tiles
Item Upgrade System
Skill Stages
-> individual stages for each skill type
-> talkaction to check rates (by @Extrodus)
Random Reward Item - gives different rewards based on vocation
Bounty Hunter System
NPC & Player Walk System (Follow Nodes to destination)
Health/Mana gain permanent - limited use items

------------------------------------
Support

If you have an issue with one of my scripts, I will attempt to help you, but not in this thread.
Make a thread in the support board.
Ensure to follow all rules of the support board.
Without all necessary information it's impossible to help you.

------------------------------------
I will only be scripting for TFS 1.4.2

Not TFS 1.1 / 1.2
Not OTServBR / OTX
and certainly not TFS 0.4

When requesting a script, don't ask for "this script I saw on super popular OT".

I don't care where the idea came from.
I don't want to see a video of the script in action.

Just describe what the script is supposed to do, and I'll try to make it.

Any script that I make in response to a request from this thread will be shared publicly, here, in this thread.

I'm not going to make anything in private, so post your request in this thread only.
Please, for the love of god, don't pm me asking to make a script.
I will actually add you to my ignore list if you do that.
--------------

Anyways!

Thanks for coming by and checking the thread out.
If you think there is a better way to script something, feel free to let me know.
I'm here to learn.

Cheers,

Xikini
---------

P.S.
I've been doing free scripting service's on/off for awhile.
And if you want to see the previous threads, go check them here.

 
Last edited by a moderator:
View attachment 81898

data/script/evolvingWeapons.lua
Lua:
local evolvingWeapons = {
    [2376] = {
        ["Gobblin' These Nuts"] = {
            evolve = {
                killsRequired = 20,
                newDescription = "With your wanton cravings out of whack, you gobble up all the nuts and deal increased damage.",
                monsters = {
                    ["goblin lord"] = {value = 20},
                    ["goblin"] = {value = 1},
                    ["goblin assassin"] = {value = 1}
                }
            },
            bonuses = {
                increasedDamagePercent = 100,
                affectedMonsters = {"goblin", "goblin assassin"}
            }
        },
        ["Dragon Poker"] = {
            evolve = {
                killsRequired = 20,
                newDescription = "Poking dragons bum for increased damage. :D",
                monsters = {
                    ["demodras"] = {value = 20},
                    ["dragon"] = {value = 1},
                    ["dragon lord"] = {value = 2}
                }
            },
            bonuses = {
                increasedDamagePercent = 100,
                affectedMonsters = {"dragon", "dragon lord"}
            }
        }      
    }
}

-- END OF CONFIG

local affectedMonsters = {}

for itemId, weapons in pairs(evolvingWeapons) do
    for weaponName, weaponDetails in pairs(weapons) do
        -- recreate monster table with lowercase letters
        local newMonsters = {}
        for monsterName, monsterDetails in pairs(weaponDetails.evolve.monsters) do
            newMonsters[monsterName:lower()] = monsterDetails
        end
        weaponDetails.evolve.monsters = newMonsters
        -- update all affected monster with lowercase letters
        if weaponDetails.bonuses and weaponDetails.bonuses.affectedMonsters then
            for i, monsterName in ipairs(weaponDetails.bonuses.affectedMonsters) do
                weaponDetails.bonuses.affectedMonsters[i] = monsterName:lower()
                affectedMonsters[weaponDetails.bonuses.affectedMonsters[i]] = 0
            end
        end
    end
end

local function sendDelayedMessage(creatureId, message)
    local creature = Creature(creatureId)
    if not creature then
        return
    end
    creature:sendTextMessage(MESSAGE_INFO_DESCR, message)
end


local creatureevent = CreatureEvent("onKill_evolvingWeapons")

function creatureevent.onKill(creature, target)
    if not target:isMonster() then
        return true
    end
  
    local weapon = creature:getSlotItem(CONST_SLOT_LEFT)
    if not weapon then
        return true
    end
  
    if weapon:getCustomAttribute("EVOLVED_WEAPON") then
        return true
    end
  
    local index = evolvingWeapons[weapon:getId()]
    if not index then
        return true
    end
  
    local monsterName = target:getName():lower()  
    local evolveEvents = {
        -- {evolveName = "", totalKills = 0}
    }
  
    for k, v in pairs(index) do
        local totalKills = weapon:getCustomAttribute(k)
        totalKills = totalKills and totalKills or 0
        if v.evolve.monsters[monsterName] then
            totalKills = totalKills + v.evolve.monsters[monsterName].value
            weapon:setCustomAttribute(k, totalKills)
        end
        if totalKills >= v.evolve.killsRequired then
            evolveEvents[#evolveEvents + 1] = {evolveName = k, totalKills = totalKills}
        end
    end
  
    table.sort(evolveEvents, function(a, b) return a.totalKills > b.totalKills end)
  
    if not evolveEvents[1] or evolveEvents[2] and evolveEvents[1].totalKills == evolveEvents[2].totalKills then
        return true
    end
  
    for k, _ in pairs(index) do
        if weapon:getCustomAttribute(k) then
            weapon:removeCustomAttribute(k)
        end
    end
  
    local itemName = ItemType(weapon:getId()):getName()
    local text = string.format("Your %s evolved into %s!", itemName, evolveEvents[1].evolveName)
    addEvent(sendDelayedMessage, 0, creature:getId(), text)
    weapon:setAttribute(ITEM_ATTRIBUTE_NAME, evolveEvents[1].evolveName)
    weapon:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, index[evolveEvents[1].evolveName].evolve.newDescription)
    weapon:setCustomAttribute("EVOLVED_WEAPON", evolveEvents[1].evolveName)
    return true
end

creatureevent:register()


local creatureevent = CreatureEvent("onLogin_evolvingWeapons")

function creatureevent.onLogin(player)
    player:registerEvent("onKill_evolvingWeapons")
    return true
end

creatureevent:register()



local creatureevent = CreatureEvent("onHealthChange_evolvingWeapons")

function creatureevent.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not isPlayer(attacker) then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
  
    local weapon = attacker:getSlotItem(CONST_SLOT_LEFT)
    if not weapon then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
  
    local evolvedWeapon = weapon:getCustomAttribute("EVOLVED_WEAPON")
    if not evolvedWeapon then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
  
    local index = evolvingWeapons[weapon:getId()][evolvedWeapon].bonuses
    if not table.contains(index.affectedMonsters, creature:getName():lower()) then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
  
    primaryDamage = primaryDamage * ((index.increasedDamagePercent + 100) / 100)
    secondaryDamage = secondaryDamage * ((index.increasedDamagePercent + 100) / 100)
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

creatureevent:register()



local eventCallback = EventCallback

function eventCallback.onSpawn(creature, position, startup, artificial)
    if affectedMonsters[creature:getName():lower()] then
        creature:registerEvent("onHealthChange_evolvingWeapons")
    end
    return true
end

eventCallback:register(-666)
is it possible to put a talkaction to this or something to see how many mobs left etc?
 
is it possible to put a talkaction to this or something to see how many mobs left etc?
That would be tough, since each weapon can evolve in multiple different ways, depending on the monsters you are hunting..

mm alright, I think got something cooking.

Untested.
Put into same file.

Lua:
local talkaction = TalkAction("!checkEvolution")

function talkaction.onSay(player, words, param, type)
	local slotItem = player:getSlotItem(CONST_SLOT_LEFT)
	if not slotItem then
		player:sendTextMessage(MESSAGE_STATUS_SMALL, "No weapon equipped in left hand.")
		return false
	end
	
	local slotItem_itemId = slotItem:getId()
	local weaponIndex = evolvingWeapons[slotItem_itemId]
	if not weaponIndex then
		player:sendTextMessage(MESSAGE_STATUS_SMALL, "This weapon has no evolutions.")
		return false
	end
	
	if slotItem:getCustomAttribute("EVOLVED_WEAPON") then
		player:sendTextMessage(MESSAGE_STATUS_SMALL, "This weapon has already evolved.")
        return false
    end
	
	local text = ""
	for k, v in pairs(weaponIndex) do
		local totalKills = slotItem:getCustomAttribute(k)
        totalKills = totalKills and totalKills or 0
		if text ~= "" then
			text = text .. "\n\n"
		end
		text = text .. "Evolution: " .. k .. "\n"
		text = text .. "Requirement: " .. v.evolve.killsRequired .. "\n"
		text = text .. "Current: " .. totalKills
	end
	
	player:showTextDialog(slotItem_itemId, text)
	return false
end

talkaction:separator(" ")
talkaction:register()
 
That would be tough, since each weapon can evolve in multiple different ways, depending on the monsters you are hunting..

mm alright, I think got something cooking.

Untested.
Put into same file.

Lua:
local talkaction = TalkAction("!checkEvolution")

function talkaction.onSay(player, words, param, type)
    local slotItem = player:getSlotItem(CONST_SLOT_LEFT)
    if not slotItem then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "No weapon equipped in left hand.")
        return false
    end
   
    local slotItem_itemId = slotItem:getId()
    local weaponIndex = evolvingWeapons[slotItem_itemId]
    if not weaponIndex then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "This weapon has no evolutions.")
        return false
    end
   
    if slotItem:getCustomAttribute("EVOLVED_WEAPON") then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "This weapon has already evolved.")
        return false
    end
   
    local text = ""
    for k, v in pairs(weaponIndex) do
        local totalKills = slotItem:getCustomAttribute(k)
        totalKills = totalKills and totalKills or 0
        if text ~= "" then
            text = text .. "\n\n"
        end
        text = text .. "Evolution: " .. k .. "\n"
        text = text .. "Requirement: " .. v.evolve.killsRequired .. "\n"
        text = text .. "Current: " .. totalKills
    end
   
    player:showTextDialog(slotItem_itemId, text)
    return false
end

talkaction:separator(" ")
talkaction:register()
it works but there are some stuff missing, it doesnt show what mobs to kill also when i finish the first tier on weapon then it wont upgrade it to next tier etc.

so this script works but for 1 upgrade only not for multiple upgrades if i wanted so.
 
it works but there are some stuff missing, it doesnt show what mobs to kill also when i finish the first tier on weapon then it wont upgrade it to next tier etc.

so this script works but for 1 upgrade only not for multiple upgrades if i wanted so.
correct.
 
so this script is just for 1 upgrade and not more and the idea is to maybe choose witch upgrade i am going to make?
The original idea as far as I can remember, was to have hidden evolutions for weapons for the players to find.
It was a very rpg server.

But yes, it's built that only a single transformation can take place, per item.
 
The original idea as far as I can remember, was to have hidden evolutions for weapons for the players to find.
It was a very rpg server.

But yes, it's built that only a single transformation can take place, per item.
i see then this idea with talkaction is unnecessary as i taught that it was possible to upgrade 1 wep many stages.

doesnt it take much to convert it to many stages and maybe even put some extra attributes to it as fire, earth and ice so on as extra attack?
 
Back
Top