• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Request help (Only Experts) Custom spells

darknelson

Member
Joined
Jun 19, 2011
Messages
190
Solutions
1
Reaction score
15
Hi, im making custom spells with custom effect etc, the thing is i already put into my spr and dat the sprites, and in compilation sources, i follow this steeps to add my effects. I compile Const.h in this way

Code:
MAGIC_EFFECT_DRAGONHEAD = 0x45, //69
MAGIC_EFFECT_ORCSHAMAN = 0x46, //70
MAGIC_EFFECT_LAST = MAGIC_EFFECT_ORCSHAMAN,

And tools.cpp
Code:
{"insects",        MAGIC_EFFECT_INSECTS},
    {"dragonhead",        MAGIC_EFFECT_DRAGONHEAD},
    {"orcshaman",        MAGIC_EFFECT_ORCSHAMAN}
};

Then on constant lib

Code:
CONST_ME_DRAGONHEAD = 69
CONST_ME_ORCSHAMAN = 70
CONST_ME_NONE = 255
CONST_ME_LAST = CONST_ME_ORCSHAMAN

And in the spell

local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_ORCSHAMAN)

But still show me nothing, When i start to making that, DRAGONHEAD effect was not working and on that way i fix it, so Whats is happening? i left something without edition? Please, must be a rookie issue if someone can help me, ill be greatfull


Also a shootype

const.h

Code:
SHOOT_EFFECT_CAKE        = 0x29, //41
    SHOOT_EFFECT_GLADIATOR    = 0x2A, //42
    SHOOT_EFFECT_LAST        = SHOOT_EFFECT_GLADIATOR,

tools.cpp

Code:
   {"explosion",        SHOOT_EFFECT_EXPLOSION},
    {"cake",           SHOOT_EFFECT_CAKE},
    {"gladiator",        SHOOT_EFFECT_GLADIATOR}
};

Constant lib

Code:
CONST_ANI_CAKE = 41
CONST_ANI_GLADIATOR = 42
CONST_ANI_WEAPONTYPE = 254
CONST_ANI_NONE = 255
CONST_ANI_LAST = CONST_ANI_GLADIATOR

PD: The spell and spr dat edition is perfect.

The compilation is perfect, no errors, No nothing.

Im using Crying Damson 8.60 v2 Sources

This was the spell:

Area effect Spell:

2hs9994.gif



And Distance shoot type (My favorite for my god of war spell)

33e7d3s.gif


Also here is the script for the second spell xD
 
Last edited:
Code:
--Darknelson GOW Spell


local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{0, 0, 1, 0, 0},
{0, 1, 1, 1, 0},
{1, 1, 2, 1, 1},
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0},
{0, 0, 1, 0, 0}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {42,-1,2,-2,1,1,2,0,-2,2,0,2,1,1,1,1,0,-1,0,-1,-1,-1,1,0,2,-2,0,0,1,0,-1,1,-1,0,3}


local combat26_Brush = createCombatObject()
setCombatParam(combat26_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat26_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat26_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat26_Brush,createCombatArea({{2},
{1}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat26_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat26_Brush = {42,0,1}


local combat24_Brush = createCombatObject()
setCombatParam(combat24_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat24_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat24_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat24_Brush,createCombatArea({{1, 1, 1},
{1, 2, 1},
{1, 0, 1},
{1, 1, 1}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat24_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat24_Brush = {42,0,2,1,2,1,1,1,0,1,-1,0,-1,-1,-1,-1,0,-1,1,-1,2}


local combat22_Brush = createCombatObject()
setCombatParam(combat22_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat22_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat22_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat22_Brush,createCombatArea({{0, 1, 1, 1, 0},
{1, 0, 0, 0, 1},
{1, 0, 2, 0, 1},
{1, 0, 0, 0, 1},
{1, 0, 0, 0, 1},
{0, 1, 1, 1, 0}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat22_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat22_Brush = {42,1,3,2,2,2,1,2,0,2,-1,1,-2,0,-2,-1,-2,-2,-1,-2,0,-2,1,-2,2,-1,3,0,3}


local combat19_Brush = createCombatObject()
setCombatParam(combat19_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat19_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat19_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat19_Brush,createCombatArea({{2, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 1}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat19_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat19_Brush = {42,2,3}


local combat16_Brush = createCombatObject()
setCombatParam(combat16_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat16_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat16_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat16_Brush,createCombatArea({{0, 2},
{0, 0},
{0, 0},
{1, 0}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat16_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat16_Brush = {42,-1,3}


local combat14_Brush = createCombatObject()
setCombatParam(combat14_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat14_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat14_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat14_Brush,createCombatArea({{0, 0, 2},
{1, 0, 0}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat14_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat14_Brush = {42,-2,1}


local combat12_Brush = createCombatObject()
setCombatParam(combat12_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat12_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat12_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat12_Brush,createCombatArea({{1, 0},
{0, 0},
{0, 2}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat12_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat12_Brush = {42,-1,-2}


local combat10_Brush = createCombatObject()
setCombatParam(combat10_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat10_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat10_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat10_Brush,createCombatArea({{0, 1},
{0, 0},
{2, 0}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat10_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat10_Brush = {42,1,-2}


local combat8_Brush = createCombatObject()
setCombatParam(combat8_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat8_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat8_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat8_Brush,createCombatArea({{2, 0, 1}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat8_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat8_Brush = {42,2,0}


local combat6_Brush = createCombatObject()
setCombatParam(combat6_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat6_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat6_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat6_Brush,createCombatArea({{2, 0},
{0, 0},
{0, 1}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat6_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat6_Brush = {42,1,2}


local combat4_Brush = createCombatObject()
setCombatParam(combat4_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat4_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat4_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat4_Brush,createCombatArea({{0, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 2, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 1, 1, 0, 0}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat4_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat4_Brush = {42,3,1,3,0,1,-3,0,-3,-1,-3,-3,0,-3,1,-1,4,0,4,1,4}


local combat2_Brush = createCombatObject()
setCombatParam(combat2_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat2_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANY_GLADIATOR)
setCombatParam(combat2_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat2_Brush,createCombatArea({{0, 0, 1, 0, 0},
{0, 1, 1, 1, 0},
{1, 1, 3, 1, 1},
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0},
{0, 0, 1, 0, 0}}))
function getDmg_Brush(cid, level, maglevel)
    return (15000)*-1,(2000)*-1
end
setCombatCallback(combat2_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat2_Brush = {42,0,-2,0,-1,1,-1,1,0,2,0,2,1,1,1,1,2,0,2,0,3,-1,2,-1,1,-2,1,-2,0,-1,0,0,0,0,1,-1,-1}

local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
    if (isCreature(cid)) then
        doCombat(cid, c, var)
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
                i = i + 2
            end    
        end
    end
end

function onCastSpell(cid, var)
  if getPlayerStorageValue(cid, 85987) >= 4 then
    local startPos = getCreaturePosition(cid)
    RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
    addEvent(RunPart,2600,combat26_Brush,cid,var,dfcombat26_Brush,startPos)
    addEvent(RunPart,2400,combat24_Brush,cid,var,dfcombat24_Brush,startPos)
    addEvent(RunPart,2200,combat22_Brush,cid,var,dfcombat22_Brush,startPos)
    addEvent(RunPart,1900,combat19_Brush,cid,var,dfcombat19_Brush,startPos)
    addEvent(RunPart,1600,combat16_Brush,cid,var,dfcombat16_Brush,startPos)
    addEvent(RunPart,1400,combat14_Brush,cid,var,dfcombat14_Brush,startPos)
    addEvent(RunPart,1200,combat12_Brush,cid,var,dfcombat12_Brush,startPos)
    addEvent(RunPart,1000,combat10_Brush,cid,var,dfcombat10_Brush,startPos)
    addEvent(RunPart,800,combat8_Brush,cid,var,dfcombat8_Brush,startPos)
    addEvent(RunPart,600,combat6_Brush,cid,var,dfcombat6_Brush,startPos)
    addEvent(RunPart,400,combat4_Brush,cid,var,dfcombat4_Brush,startPos)
    addEvent(RunPart,200,combat2_Brush,cid,var,dfcombat2_Brush,startPos)
   
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You Need 4 Rebirth")
end
return true
end
 
Last edited:
Hmm, hard to say whats happens. But try a simple debug. First - any other effects work? If yes, try to make a simple spell with you new effect. (without using them in large script). If effect sucess - problem in you spell. If not - try to check sendMagicEffect code in player.cpp, game.cpp, protocol.cpp (dont think so, but probably something can be incorrect for example with if(type >= MAGIC_EFFECT_LAST || !canSee(pos)) retun; blablabla (only this problem can be in theory from code, if any other effects works fine)). If sendMagicEffect works correctly - and this (new effect) wont work with very simple script try re-check everything. Number of effect in .dat should be equivalent in const.h blah blah blah.... - you know what need todo =)
 
Every Magic effect is working fine, It works fine just at dragonhead, Then, its get fcked also here is my code magic effect !cansee

void ProtocolGame::sendMagicEffect(const Position& pos, uint8_t type)
{
if(type > MAGIC_EFFECT_LAST || !canSee(pos))
return;

NetworkMessage_ptr msg = getOutputBuffer();
if(msg)
{
TRACK_MESSAGE(msg);
AddMagicEffect(msg, pos, type);
}
}


I tried with a simply spell and it dont work, for example a hur target:

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GLADIATOR)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal / 3 + levelTotal), -(skillTotal + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end

2j4cbrm.png



about dat and spr here is the edition

Distance type:

1zyk1hf.png


Area Type:

2usbv61.png




Also a question:

There is a way to use a spell trough an item: for example "Exevo gran mas tree" and it summons a item who disspaear it is possible?

bump

bump

bump

BRINGING UP

MY POST :D:D:D PLEASE SOMEONE HELP
 
Last edited by a moderator:
Back
Top