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

Help with "Level Effect".

Ryxy

SYN - Morta8.6
Joined
Jul 23, 2013
Messages
97
Reaction score
7
Location
Spain (Barcelona)
I have a problem with this script. Normally its works 100% but when someone login to the server for the first time it doenst work. He have to relogg for make it works. :/ I'm using TFS 0.4 (8.6)
Code:
local config =
{
--message, distance shoot effect
[0] = {'+Fist', 38},
[1] = {'+Mace', 26},
[2] = {'+Swrd', 24},
[3] = {'+Axe', 25},
[4] = {'+Dist', 2},
[5] = {'+Def', 11},
[6] = {'+Fish', 12},
[7] = {'+ML', 35},
[8] = {'+LvL', 37}
}

function onAdvance(cid, skill, oldlevel, newlevel)
if skill == SKILL__LEVEL then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
end

local p = getThingPos(cid)
local positions =
{ --do not touch
[1] = {
{x=p.x+1,y=p.y,z=p.z}, 100, 900
},
[2] = {
{x=p.x+1,y=p.y+1,z=p.z}, 200, 980
},
[3] = {
{x=p.x,y=p.y+1,z=p.z}, 300, 1060
},
[4] = {
{x=p.x-1,y=p.y+1,z=p.z}, 400, 1140
},
[5] = {
{x=p.x-1,y=p.y,z=p.z}, 500, 1220
},
[6] = {
{x=p.x-1,y=p.y-1,z=p.z}, 600, 1300
},
[7] = {
{x=p.x,y=p.y-1,z=p.z}, 700, 1380
},
[8] = {
{x=p.x+1,y=p.y-1,z=p.z}, 800, 1460
}
}

for i = 1, 8 do
addEvent(doSendDistanceShoot, positions[2], positions[1], p, config[skill][2])
addEvent(doSendDistanceShoot, positions[3], positions[1], p, config[skill][2])
end

addEvent(doSendMagicEffect, 900, p, 49)
doSendAnimatedText(p, config[skill][1]..'['..newlevel..']', math.random(255))
doPlayerSave(cid, true)
return true
end

XML:
Code:
Xml:<event type="advance" name="Advanced" event="script" value="advanceeffect.lua"/>
Login:
Code:
registerCreatureEvent(cid, "Advanced")
 
Nop :(

Thanks for you fast answer,

I think I find it, and I'm sure is about Save player. He is online (almost level 35) but on website he still being level 8 "Last Login: Never logged in."
I have to make /save to make it work. How can I fix it?
 
Last edited by a moderator:
Auto-save when advanced to next lvl/skill or change the time when server saves automatically. If i'm not mistaken, it's in config.lua file. Or it was.
 
It still doesnt work. I maked /save and !save everything. And it still doenst work, to make it works he have to relogg.
Can someone help me with that? Thanks.
 
try this script
Code:
local config = {
    [0] = { "Fist skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [1] = { "Club skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [2] = { "Sword skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [3] = { "Axe skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [4] = { "Distance skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [5] = { "Shield skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [6] = { "Fishing skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [7] = { "Magic level UP", 30}, -- 30 = variable[2]  -- Animation effect
    [8] = { "Level UP", 30} -- 30 = variable[2]  -- Animation effect
}


function onAdvance(cid, skill, oldlevel, newlevel)

local pos = getPlayerPosition(cid)
local effectPositions = {
{x = pos.x, y = pos.y - 3, z = pos.z},
{x = pos.x, y = pos.y + 3, z = pos.z},
{x = pos.x - 3, y = pos.y, z = pos.z},
{x = pos.x + 3, y = pos.y, z = pos.z},
{x = pos.x - 2, y = pos.y - 2, z = pos.z},
{x = pos.x + 2, y = pos.y - 2, z = pos.z},
{x = pos.x + 2, y = pos.y + 2, z = pos.z},
{x = pos.x - 2, y = pos.y + 2, z = pos.z}
}

       
    for type, variable in pairs(config) do
        if skill == type then
            doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
    for _, ePos in ipairs(effectPositions) do
        doSendDistanceShoot(pos, ePos, CONST_ANI_SUDDENDEATH)
        doSendMagicEffect(ePos, CONST_ME_MORTAREA)
            end

           
        end
    end   
return TRUE
end--Script made by Pitufo/Haifurer, edited by figaro!
local config = {
    [0] = { "Fist UP", 30}, -- 30 = variable[2]  -- Animation effect
    [1] = { "Club UP", 30}, -- 30 = variable[2]  -- Animation effect
    [2] = { "Sword UP", 30}, -- 30 = variable[2]  -- Animation effect
    [3] = { "Axe UP", 30}, -- 30 = variable[2]  -- Animation effect
    [4] = { "Distance UP", 30}, -- 30 = variable[2]  -- Animation effect
    [5] = { "Shield UP", 30}, -- 30 = variable[2]  -- Animation effect
    [6] = { "Fishing UP", 30}, -- 30 = variable[2]  -- Animation effect
    [7] = { "Magic UP", 30}, -- 30 = variable[2]  -- Animation effect
    [8] = { "Level UP", 30} -- 30 = variable[2]  -- Animation effect
}


function onAdvance(cid, skill, oldlevel, newlevel)

local pos = getPlayerPosition(cid)
local effectPositions = {
{x = pos.x, y = pos.y - 1, z = pos.z},
{x = pos.x, y = pos.y + 1, z = pos.z},
{x = pos.x - 1, y = pos.y, z = pos.z},
{x = pos.x + 1, y = pos.y, z = pos.z},
{x = pos.x - 1, y = pos.y - 1, z = pos.z},
{x = pos.x + 1, y = pos.y - 1, z = pos.z},
{x = pos.x + 1, y = pos.y + 1, z = pos.z},
{x = pos.x - 1, y = pos.y + 1, z = pos.z}
}

       
    for type, variable in pairs(config) do
        if skill == type then
            doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
        for _, ePos in ipairs(effectPositions) do
                doSendDistanceShoot(pos, ePos, CONST_ANI_SMALLHOLY)
                doSendMagicEffect(ePos, CONST_ME_FIREWORK_BLUE)
            end

           
        end
    end   
return TRUE
end
 
Thanks @heba for you answer. It works normally like my old script, but when players create the account and login to the game for the first time it doenst work. They have to relogg to make it works.
Any solution? Maybe login.lua? I dont know.
 
Back
Top