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

[TFS 1.2/1.3] Free scripting service

Status
Not open for further replies.
hi, i need talkaction
Change the colors of the characters party, but not the looktype
Lua:
function onSay(player, words, param)
    local party = player:getParty()
    if not party then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You are not in a party.")
        return false
    end
    if not (party:getLeader() == player) then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You are not the leader of the party.")
        return false
    end
    local outfit = player:getOutfit()
    local members = party:getMembers()
    for i = 1, #members do
        local newOutfit = members[i]:getOutfit()
        newOutfit.lookHead = outfit.lookHead
        newOutfit.lookBody = outfit.lookBody
        newOutfit.lookLegs = outfit.lookLegs
        newOutfit.lookFeet = outfit.lookFeet
        members[i]:setOutfit(newOutfit)
        members[i]:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    end
    return false
end
XML:
<talkaction words="!poutfit" script="party outfit.lua"/>
 
Last edited:
Hey,
I need action script with an easy way to change/add sacrificedItems and rewardItems,
two of the same items will be removed and replaced by award (20% chance for rewardItem from list) or 20% chance for each trash item (4 trash items). Screen is only for example id of items can be any.
28twf1v.jpg


I would be very grateful!
Thanks for Help =]
Lua:
local basin = Position(1022, 997, 7) -- position of the reward basin
local leftAltar = Position(1020, 1000, 7) -- position of the left altar
local rightAltar = Position(1024, 1000, 7) -- position of the right altar

local combinations = {
    [2173] = {id = 2148, count = 20} -- [sacrifice id] = {id = reward id, count = reward count}
}

local trash = {2676, 2223, 2675, 2506} -- change these

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local leftItem = Tile(leftAltar):getTopDownItem()
    local rightItem = Tile(rightAltar):getTopDownItem()
    local reward = leftItem and combinations[leftItem:getId()]
    if (not leftItem) or (not rightItem) or (not combinations[leftItem:getId()]) or (not combinations[rightItem:getId()]) then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid combination.")
        return item:transform(item:getId() == 1945 and 1946 or 1945)
    end
    local reward = combinations[leftItem:getId()]
    if math.random(100) <= 20 then
        Game.createItem(reward.id, reward.count, basin)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have successfully sacrificed your items.")
        leftAltar:sendMagicEffect(CONST_ME_MAGIC_RED)
        rightAltar:sendMagicEffect(CONST_ME_MAGIC_RED)
        basin:sendMagicEffect(CONST_ME_MAGIC_GREEN)
        leftItem:remove()
        rightItem:remove()
    else
        for i = 1, #trash do
            if math.random(100) <= 20 then
                Game.createItem(trash[i], 1, basin)
            end
        end
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have failed to sacrifice your items.")
        leftAltar:sendMagicEffect(CONST_ME_POFF)
        rightAltar:sendMagicEffect(CONST_ME_POFF)
        leftItem:remove()
        rightItem:remove()
    end
    return item:transform(item:getId() == 1945 and 1946 or 1945)
end
XML:
<action actionid="8884" script="sacrifice.lua"/>
 
Last edited:
hi @Xeraphus i need a function on kill. (most damage killer)
how it work?

if you kill xxx monster you get xxx experience and xxx money. (money added to bank directly)
but if you are o an party you get only the 50% of the xxx experience and 10% extra for each party member.
also the script need to have something like :

local monsters = {
[1] = { name = "rat", min_gold = 1, max_gold = 10, exp = 1000 },
[2] = { name = "cave rat", min_gold = 10, max_gold = 20, exp = 10000 },
[3] = { name = "rotworm", min_gold = 20, max_gold = 30, exp = 1000000 }
}
thanks in advance
 
ops i already made something
Code:
function onKill(player, target, mostDamageKiller)
       
if not player == mostDamageKiller or isSummon(target) then

return true
end
   
local monsters = {
        [1] = { name = "rat",      min_gold = 1, max_gold = 10, exp = 1000 },
        [2] = { name = "cave rat", min_gold = 10, max_gold = 20, exp = 10000 },
        [3] = { name = "rotworm",  min_gold = 20, max_gold = 30, exp = 1000000 }
    }

    for i = 1, #monsters do
        if monsters[i].name == target:getName():lower() then
            local value = math.random(monsters[i].min_gold, monsters[i].max_gold)
            local exp = (monsters[i].exp)
        player:setBankBalance(player:getBankBalance() + value)
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, string.format('You have gained %d coins in this battle.', value))
       
    break
end
    return true
end
 
One script if Konkeror (boss from pvp arena) Die appear at differents positions mushrooms on the ground.

I have other script if player eat this mushroom receive -500 damage.
Its for custom quest Arena with levels (copy paste from mortal kombat with modifications)

Thnx anyway
 
Hello, I'm here to make a request, and thank you for the thread and the amazing work.

Map pic (just made a quick one to explain: http://prntscr.com/e595o1

The thing is a hunting arena, where there are X rooms. (8 rooms on the screenshot)
Each room type there's a monster. (4 types on the screenshot)
The teleport outside the room would bring the player to the room, once they've entered, no one else can enter, the room would auto summon the monster that it's inside (there would be no spawn on the map, just a script that summons the monster once it's dead)
If the player enters the teleport inside the room (to exit) or dies, the monster would be removed and the room would be avaliable again.
I have no idea how to keep summoning monster and check if it's alive or there's someone there, but i can help with the rest.
Hope you can help me, if you need more information, I can give you!
Thanks for your time.

edit.
If can be tables to add more rooms would be nice.
Some movement (?) that i add the actionid to each teleport, then add a globalstorage and a monster name?
just some ideas, don't know the best way it can be done.
 
Hello, I'm here to make a request, and thank you for the thread and the amazing work.

Map pic (just made a quick one to explain: http://prntscr.com/e595o1

The thing is a hunting arena, where there are X rooms. (8 rooms on the screenshot)
Each room type there's a monster. (4 types on the screenshot)
The teleport outside the room would bring the player to the room, once they've entered, no one else can enter, the room would auto summon the monster that it's inside (there would be no spawn on the map, just a script that summons the monster once it's dead)
If the player enters the teleport inside the room (to exit) or dies, the monster would be removed and the room would be avaliable again.
I have no idea how to keep summoning monster and check if it's alive or there's someone there, but i can help with the rest.
Hope you can help me, if you need more information, I can give you!
Thanks for your time.

edit.
If can be tables to add more rooms would be nice.
Some movement (?) that i add the actionid to each teleport, then add a globalstorage and a monster name?
just some ideas, don't know the best way it can be done.
i think this is what you want
it should be self explanatory how to add more rooms, edit positions, etc
but if you need help ask
(keep in mind these are separate scripts, globalevent and movement)
there is a better solution rather than onthink, but i just whipped this up in like 5-6 mins to see if it would work, if you would like to me to create a fully optimized script let me know
also untested
Lua:
monsters = {
    [4000] = {teleportPos = Position(1, 1, 1), spawnPos = Position(1, 1, 1), name = "Dragon"}
}

function onThink(interval)
    for k, v in pairs(monsters) do
        local monsterSpawned = false
        local playerInside = false
        local specs = Game.getSpectators(v, false, false, 7, 7, 7, 7)
        for s = 1, #specs do
            if specs[i]:isMonster() then
                monsterSpawned = specs[i]
            end
            if specs[i]:isPlayer() then
                playerInside = true
            end
        end
        if not playerInside and monsterSpawned then
            monsterSpawned:addHealth(monsterSpawned:getMaxHealth())
        end
        if not monsterSpawned then
            Game.createMonster(v.name, v.spawnPos)
        end
    end
    return true
end

function onStepIn(creature, item, toPosition, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end
    local tp = monsters[item:getActionId()]
    if not tp then
        return true
    end
    local specs = Game.getSpectators(tp.teleportPos, false, true, 7, 7, 7, 7)
    if #specs > 0 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "There is already a player in there.")
        return addEvent(function(cid) Player(cid):teleportTo(fromPosition) end, 5, player:getId())
    end
    player:teleportTo(tp.teleportPos)
    return true
end
 
Last edited:
i think this is what you want
it should be self explanatory how to add more rooms, edit positions, etc
but if you need help ask
(keep in mind these are separate scripts, globalevent and movement)
there is a better solution rather than onthink, but i just whipped this up in like 5-6 mins to see if it would work, if you would like to me to create a fully optimized script let me know
also untested
[/code]
Thanks so much for your time and the fast job, I'm at work right now and will test as soon as I get home, if you have some free time to optimize would be nice, because all the checks and everything with a few rooms can be really heavy, no? Anyway, will check and report anything I find. Just one thing i got doubt by reading the script, the tp to enter is the actionid on the table, what about the exit teleport?
Thanks!
 
Thanks so much for your time and the fast job, I'm at work right now and will test as soon as I get home, if you have some free time to optimize would be nice, because all the checks and everything with a few rooms can be really heavy, no? Anyway, will check and report anything I find. Just one thing i got doubt by reading the script, the tp to enter is the actionid on the table, what about the exit teleport?
Thanks!
it wouldn't be really heavy, still fast (if you have doubts you can test it by saving time at the top of the function and subtract current time with the time saved using os.mtime())
although not as fast as it could be if it were a creature event
as for the exit teleport, just make it a regular teleport, you don't need a script for that
 
Lua:
local basin = Position(1022, 997, 7) -- position of the reward basin
local leftAltar = Position(1020, 1000, 7) -- position of the left altar
local rightAltar = Position(1024, 1000, 7) -- position of the right altar

local combinations = {
    [2173] = {id = 2148, count = 20} -- [sacrifice id] = {id = reward id, count = reward count}
}

local trash = {2676, 2223, 2675, 2506} -- change these

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local leftItem = Tile(leftAltar):getTopDownItem()
    local rightItem = Tile(rightAltar):getTopDownItem()
    local reward = leftItem and combinations[leftItem:getId()]
    if (not leftItem) or (not rightItem) or (not combinations[leftItem:getId()]) or (not combinations[rightItem:getId()]) then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid combination.")
        return item:transform(item:getId() == 1945 and 1946 or 1945)
    end
    local reward = combinations[leftItem:getId()]
    if math.random(100) <= 20 then
        Game.createItem(reward.id, reward.count, basin)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have successfully sacrificed your items.")
        leftAltar:sendMagicEffect(CONST_ME_MAGIC_RED)
        rightAltar:sendMagicEffect(CONST_ME_MAGIC_RED)
        basin:sendMagicEffect(CONST_ME_MAGIC_GREEN)
        leftItem:remove()
        rightItem:remove()
    else
        for i = 1, #trash do
            if math.random(100) <= 20 then
                Game.createItem(trash[i], 1, basin)
            end
        end
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have failed to sacrifice your items.")
        leftAltar:sendMagicEffect(CONST_ME_POFF)
        rightAltar:sendMagicEffect(CONST_ME_POFF)
        leftItem:remove()
        rightItem:remove()
    end
    return item:transform(item:getId() == 1945 and 1946 or 1945)
end
XML:
<action actionid="8884" script="sacrifice.lua"/>

\o/ Epic! thanks! \o/
~~
Sometimes player got two trash items or nothing, weird ;o
 
Last edited:
Hi!
I need a script (not sure if this should be global event or what?) that would randomize the forest. The bullet points:
-the forest is made of chunks 10x10 tiles big
-every x time if there are no players near a chunk it re-randomizes itself
-when re-randomizing chunk removes all non-ground items from itself then spawns random forest elements on itself
-items can not be spawned on or removed from non-walkable tiles
-each type of spawned item (grass tufts, bushes, trees etc) density is controllable by parameter
-please use Ab'dendriel tileset

I hope you like the challenge ;)
 
\o/ Epic! thanks! \o/
~~
Sometimes player got two trash items or nothing, weird ;o
it doesnt guarantee 1 trash item, each one has a 20% chance
you didn't really specify so i went with what you wrote and guessed

Hi!
I need a script (not sure if this should be global event or what?) that would randomize the forest. The bullet points:
-the forest is made of chunks 10x10 tiles big
-every x time if there are no players near a chunk it re-randomizes itself
-when re-randomizing chunk removes all non-ground items from itself then spawns random forest elements on itself
-items can not be spawned on or removed from non-walkable tiles
-each type of spawned item (grass tufts, bushes, trees etc) density is controllable by parameter
-please use Ab'dendriel tileset

I hope you like the challenge ;)
i'll think about working on this, not really interested in working on a forest generator though
 
i'll think about working on this, not really interested in working on a forest generator though

ok. Could you guide me if this should be global event or some other kind of script? I want it to happen with regular interval.
 
Status
Not open for further replies.
Back
Top