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

update script to tfs 1.2

jurass

New Member
Joined
Jul 7, 2015
Messages
98
Reaction score
3
Location
Poland
function onDeath(cid, corpse, deathList)
if(isPlayer(cid) == true) then
for _, pos in pairs(getArea(getCreaturePosition(cid), 0, 0)) do
doSendMagicEffect(pos, 65)
end
doCreatureSay(cid, getCreatureName(cid) .. " killed by " .. getCreatureName(deathList[1]) .. " [DEATH]", TALKTYPE_ORANGE_1)
end
return true
end

when player kill someone = effect and text

need Update this script to tfs 1.2
 
function onDeath(cid, corpse, deathList)
if(isPlayer(cid) == true) then
for _, pos in pairs(getArea(getCreaturePosition(cid), 0, 0)) do
doSendMagicEffect(pos, 65)
end
doCreatureSay(cid, getCreatureName(cid) .. " killed by " .. getCreatureName(deathList[1]) .. " [DEATH]", TALKTYPE_ORANGE_1)
end
return true
end

when player kill someone = effect and text

need Update this script to tfs 1.2
Let me give you a hint on how to convert a script to another distribution.

If its an entire script I want to convert I start with the interface in this case function onDeath(cid, corpse, deathList), so I copy just the word onDeath and paste in the tfs search box on github.
https://github.com/otland/forgottenserver

After I search for it, I find this.
Code:
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
Then I go to the next line of code isPlayer(cid), since we aren't using cid anymore in 1.2 I only select isPlayer, again i go the tfs on github and search isPlayer
Code:
player:isPlayer()
Awesome 2 for 2
Next line of code getCreaturePosition(cid), again we are not using cid so I just select getCreaturePosition, the search turned up.
Code:
getCreaturePosition(cid)
However since cid is not used in our script in 1.2 I would have to have some advanced knowledge of tfs 1.2 in order to resolve this, but since I don't I break up the word get Creature Position. Which returns something which makes more sense.
Code:
creature:getPosition()
Then I look at the next function doSendMagicEffect(pos, effect), in this case I omit the arguments and just do a search for doSendMagicEffect, I see that it does exist however it is not a true tfs function but what is defined within the function is and makes sense, so i choose
Code:
Position(pos):sendMagicEffect(magicEffect)

Now you know how to convert any script from whatever distribution to tfs 1.2

So give it a shot and if you get stuck post your issues in support or this thread.
 
Last edited:
Upload what? Lol
I think he wants us to send him a sexy picture. heres a picture of my cock
maxresdefault.jpg
 
Code:
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    if isPlayer(player) then
        target_player = Player(killer:getId())
        if target_player then
            player:getPosition():doSendMagicEffect(65)
            player:say(player:getName().. " killed by " ..target_player:getName().. " [DEATH]", TALKTYPE_ORANGE_1, 0, 1, player:getPosition())
        end
    end
return true
end
 
Code:
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    if isPlayer(player) then
        target_player = Player(killer:getId())
        if target_player then
            player:getPosition():doSendMagicEffect(65)
            player:say(player:getName().. " killed by " ..target_player:getName().. " [DEATH]", TALKTYPE_ORANGE_1, 0, 1, player:getPosition())
        end
    end
return true
end
You are missing the point of my post :(
 
Code:
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    if isPlayer(player) then
        target_player = Player(killer:getId())
        if target_player then
            player:getPosition():doSendMagicEffect(65)
            player:say(player:getName().. " killed by " ..target_player:getName().. " [DEATH]", TALKTYPE_ORANGE_1, 0, 1, player:getPosition())
        end
    end
return true
end
player:getPosition():doSendMagicEffect(65)
Code:
player:getPosition():sendMagicEffect(65)
;)
doSend is old, used when you don't use the metamethod also use parameters like this
Code:
doSendMagicEffect(pos, 65)
 
There is no idea, to check if it's player who is dieing. Since you register the event on the player anyway.


Code:
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    player:say(("%s killed by %s [DEATH]"):format(player:getName(), killer:getName()), TALKTYPE_MONSTER_SAY)
    player:getPosition():sendMagicEffect(CONST_ME_YALAHARIGHOST)
    return true
end
 
me too need help update for tfs 1.2

Lua Script Error: [Action Interface]
data/actions/scripts/wielkanoc/zielone jajko pro.lua:eek:nUse
data/actions/scripts/wielkanoc/zielone jajko pro.lua:19: attempt to call global 'getCreatureMaxMana' (a nil value)
stack traceback:
[C]: in function 'getCreatureMaxMana'
data/actions/scripts/wielkanoc/zielone jajko pro.lua:19: in function <data/actions/scripts/wielkanoc/zielone jajko pro.lua:11>

Lua Script Error: [Action Interface]
data/actions/scripts/wielkanoc/niebieskie jajko.lua:eek:nUse
data/actions/scripts/wielkanoc/niebieskie jajko.lua:12: attempt to call global 'getCreatureMaxMana' (a nil value)
stack traceback:
[C]: in function 'getCreatureMaxMana'
data/actions/scripts/wielkanoc/niebieskie jajko.lua:12: in function <data/actions/scripts/wielkanoc/niebieskie jajko.lua:7>

Script:

FIRST

Code:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 600000)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, 5100)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 120)
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEEPERCENT, 150)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANAPERCENT, 120)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVELPERCENT, 150)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELDPERCENT, 150)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)

function onUse(cid, item, fromPosition, itemEx, toPosition)
    doRemoveItem(item.uid,1)
    doCreatureSay(cid, "+20% zycia i many!", TALKTYPE_ORANGE_1)
    doCreatureSay(cid, "+50% mlvl, melee dmg i shielding!", TALKTYPE_ORANGE_1)
    doCreatureSay(cid, "+500% fist!", TALKTYPE_ORANGE_1)
    doAddCondition(cid, condition)
    local maxhealth = getCreatureMaxHealth(cid)
    doCreatureAddHealth(cid, maxhealth)
    local mana = getCreatureMaxMana(cid)
    doPlayerAddSpentMana(cid, mana)
    doCreatureAddMana(cid, mana)
    return true
end

SECOND

Code:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 600000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANAPERCENT, 120)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVELPERCENT, 150)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)

function onUse(cid, item, fromPosition, itemEx, toPosition)
    doRemoveItem(item.uid,1)
    doCreatureSay(cid, "+20% many!", TALKTYPE_ORANGE_1)
    doCreatureSay(cid, "+50% mlvl!", TALKTYPE_ORANGE_1)
    doAddCondition(cid, condition)
    local mana = getCreatureMaxMana(cid)
    doPlayerAddSpentMana(cid, 50)
    doCreatureAddMana(cid, 50)
    return true
end
 
Code:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 600000)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, 5100)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 120)
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEEPERCENT, 150)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANAPERCENT, 120)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVELPERCENT, 150)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELDPERCENT, 150)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    item:remove()
    player:say("+20% zycia i many!", TALKTYPE_ORANGE_1, 0, 1, player:getPosition())
    player:say("+50% mlvl, melee dmg i shielding!", TALKTYPE_ORANGE_1, 0, 1, player:getPosition())
    player:say("+500% fist!", TALKTYPE_ORANGE_1, 0, 1, player:getPosition())
    player:addCondition(condition)
    local maxhealth = player:getMaxHealth()
    player:addHealth(maxhealth)
    local mana = player:getMaxMana()
    doPlayerAddSpentMana(player, mana)
    player:addMana(mana)
    return true
end

Code:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 600000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANAPERCENT, 120)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVELPERCENT, 150)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    item:remove()
    player:say("+20% many!", TALKTYPE_ORANGE_1, 0, 1, player:getPosition())
    player:say("+50% mlvl!", TALKTYPE_ORANGE_1, 0, 1, player:getPosition())
    player:addCondition(condition)
    doPlayerAddSpentMana(player, 50)
    doCreatureAddMana(cid, 50)
    return true
end

Lazy ass, here you go.
 
Back
Top