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

change magic effect after level up.

maciekslawny

New Member
Joined
Jul 10, 2012
Messages
23
Reaction score
0
Hello! I use TFS 0.4 .
When I level up my character getting magic efect. like in the pictrue below :
efektjpg_wnernpx.jpg


How can I change this effect for another?
PLEASE HELP ME :):) rep +++
 
Player.cpp:

Code:
if(prevLevel != level)
    {
        updateBaseSpeed();
        g_game.changeSpeed(this, 0);
        if(g_config.getBool(ConfigManager::HEAL_PLAYER_ON_LEVEL))
        {
            health = healthMax;
            mana = manaMax;
        }

        g_game.addCreatureHealth(this);
        if(party)
            party->updateSharedExperience();

        char advMsg[60];
        sprintf(advMsg, "Gratz You advanced from %d to Level %d.", prevLevel, level);
        sendTextMessage(MSG_EVENT_ADVANCE, advMsg);

        CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE);
        for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it)
            (*it)->executeAdvance(this, SKILL__LEVEL, prevLevel, level);
    }
 
Last edited:
Do you want to add this effect or do you have this effect atm that you want to change?
If it's not added, you can just add it to an advance Lua script, check for "skill == SKILL__LEVEL" so it won't happen when players advance in other skills.
Code:
doSendMagicEffect(getThingPosition(cid), CONST_ME_FIREWORK_YELLOW)
doSendAnimatedText(getThingPosition(cid), "Level Up", COLOR_YELLOW)
 
I have this in creaturescript but it dont work ;/ :

Code:
--[[
-- this is here just for reference
COLOR_BLACK = 0
COLOR_BLUE = 5
COLOR_GREEN = 18
COLOR_TEAL = 35
COLOR_LIGHTGREEN = 66
COLOR_DARKBROWN = 78
COLOR_LIGHTBLUE = 89
COLOR_DARKPURPLE = 112
COLOR_BROWN = 120
COLOR_GREY = 129
COLOR_DARKRED = 144
COLOR_DARKPINK = 152
COLOR_PURPLE = 154
COLOR_DARKORANGE = 156
COLOR_RED = 180
COLOR_PINK = 190
COLOR_ORANGE = 192
COLOR_DARKYELLOW = 205
COLOR_YELLOW = 210
COLOR_WHITE = 215
COLOR_NONE = 255

]]

function useRandomColor()
    local colors = {0, 5, 18, 35, 66, 78, 89, 112, 120, 129, 144, 152, 154, 156, 180, 190, 192, 205, 210, 215, 255}
    return colors[math.random(1, #colors)]
end

local config = {
    [0] = "Fist skill UP",
    [1] = "Club skill UP",
    [2] = "Sword skill UP",
    [3] = "Axe skill UP",
    [4] = "Distance skill UP",
    [5] = "Shield skill UP",
    [6] = "Fishing skill UP",
    [7] = "Magic level UP",
    [8] = "Level UP"
}


function onAdvance(cid, skill, oldlevel, newlevel)
    local pos = getThingPosition(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}
    }
    doSendAnimatedText(pos, config[skill], useRandomColor())
    for _, ePos in ipairs(effectPositions) do
        doSendDistanceShoot(pos, ePos, CONST_ANI_SMALLHOLY)
        doSendMagicEffect(pos, ePos, CONST_ME_FIREWORK_YELLOW)
    end
    return true
end
 
Last edited:
Instead of "dont work", explain what the problem is. I assume this is not the full script, since it's missing the end under return true to close function onAdvance.
You also have to register it in login.lua.
 
Its working good with me But i've got only one problem when my character level up skill like Distance ,the full message do not appear i mean it's appear like Distance sk and on script there is Distance Skill up << So why there is limit for these words? and please how can i add more effects?
TFS 0.3.6
 
Back
Top Bottom