• 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.3/OTX3 Party + Task

freaked1

Active Member
Joined
Jan 30, 2008
Messages
486
Solutions
5
Reaction score
29
Location
Sweden
Hello! I have tried for a while in the support board but maybe I can post this as a request instead?

I want this creaturescript to give all party members within a certain range the kill too, and not only most damage/lasthitter.

Thanks in advance!

Lua:
function onKill(cid, target, lastHit)
local started = getPlayerStartedTasks(cid)

if isPlayer(target) then return true end

if started and #started > 0 then
for _, id in ipairs(started) do
if isInArray(tasks[id].creatures, getCreatureName(target):lower()) then
if getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) < 0 then
setPlayerStorageValue(cid, KILLSSTORAGE_BASE + id, 0)
end
if getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) < tasks[id].killsRequired then
setPlayerStorageValue(cid, KILLSSTORAGE_BASE + id, getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) .. "/" .. tasks[id].killsRequired .. " " .. tasks[id].raceName .. " already killed.")
end
end
end
end
return true
end
 
Try this:
Lua:
function onKill(cid, target, lastHit)
    if isPlayer(target) then return true end
        local started = getPlayerStartedTasks(cid)
    if started and #started > 0 then
    if isInParty(cid) then
        local memberCIDs = {}
        local partymembs = getPartyMembers(getPlayerParty(cid))
        for i=1,#partymembs do
            table.insert(memberCIDs,partymembs.i.cid)
        end
    else
        local memberCIDs = {cid}
    end
    for _, id in ipairs(started) do
        for n, i in ipairs(memberCIDs) do
            if isInArray(tasks[id].creatures, getCreatureName(target):lower()) then
                if getPlayerStorageValue(i, KILLSSTORAGE_BASE + id) < 0 then
                    setPlayerStorageValue(i, KILLSSTORAGE_BASE + id, 0)
                end
                if getPlayerStorageValue(i, KILLSSTORAGE_BASE + id) < tasks[id].killsRequired then
                    setPlayerStorageValue(i, KILLSSTORAGE_BASE + id, getPlayerStorageValue(i, KILLSSTORAGE_BASE + id) + 1)
                    doPlayerSendTextMessage(i, MESSAGE_STATUS_CONSOLE_ORANGE, getPlayerStorageValue(i, KILLSSTORAGE_BASE + id) .. "/" .. tasks[id].killsRequired .. " " .. tasks[id].raceName .. " already killed.")
                end
                end
            end
        end
    end
    return true
end
No guarantee though
 
Try this:
Lua:
function onKill(cid, target, lastHit)
    if isPlayer(target) then return true end
        local started = getPlayerStartedTasks(cid)
    if started and #started > 0 then
    if isInParty(cid) then
        local memberCIDs = {}
        local partymembs = getPartyMembers(getPlayerParty(cid))
        for i=1,#partymembs do
            table.insert(memberCIDs,partymembs.i.cid)
        end
    else
        local memberCIDs = {cid}
    end
    for _, id in ipairs(started) do
        for n, i in ipairs(memberCIDs) do
            if isInArray(tasks[id].creatures, getCreatureName(target):lower()) then
                if getPlayerStorageValue(i, KILLSSTORAGE_BASE + id) < 0 then
                    setPlayerStorageValue(i, KILLSSTORAGE_BASE + id, 0)
                end
                if getPlayerStorageValue(i, KILLSSTORAGE_BASE + id) < tasks[id].killsRequired then
                    setPlayerStorageValue(i, KILLSSTORAGE_BASE + id, getPlayerStorageValue(i, KILLSSTORAGE_BASE + id) + 1)
                    doPlayerSendTextMessage(i, MESSAGE_STATUS_CONSOLE_ORANGE, getPlayerStorageValue(i, KILLSSTORAGE_BASE + id) .. "/" .. tasks[id].killsRequired .. " " .. tasks[id].raceName .. " already killed.")
                end
                end
            end
        end
    end
    return true
end
No guarantee though
I'll try this when I get home after work, thanks! :)
 
I have tried the above code but can't get it to work, I have upgraded to TFS 1.3/OTX 3 now tho, is there anyone who can make it work for that? :)
Thanks in advance!
 
Hello! I have tried for a while in the support board but maybe I can post this as a request instead?

I want this creaturescript to give all party members within a certain range the kill too, and not only most damage/lasthitter.

Thanks in advance!

Lua:
function onKill(cid, target, lastHit)
local started = getPlayerStartedTasks(cid)

if isPlayer(target) then return true end

if started and #started > 0 then
for _, id in ipairs(started) do
if isInArray(tasks[id].creatures, getCreatureName(target):lower()) then
if getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) < 0 then
setPlayerStorageValue(cid, KILLSSTORAGE_BASE + id, 0)
end
if getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) < tasks[id].killsRequired then
setPlayerStorageValue(cid, KILLSSTORAGE_BASE + id, getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) .. "/" .. tasks[id].killsRequired .. " " .. tasks[id].raceName .. " already killed.")
end
end
end
end
return true
end
were you able to solve it?
 
Back
Top