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

[Solved]TFS 1.1 - Spell formula help.

RosOT

Who am i?
Joined
Feb 12, 2013
Messages
714
Reaction score
137
Location
Canada
I cannot figure out howto edit @Printer Assassin spell to have a forumala instead of its base attack :|
can someone not only do it but explain how its done so i know :p
@Limos @zbizu - If interested in helping :>

Code:
local function targetEffect(cid)
local player = Player(cid)
if not player then
return
end

local effect = CONST_ANI_REDSTAR
local orig = player:getPosition()
local d1, d2 = {z = orig.z}, {z = orig.z}

d1.x = orig.x - 5
d2.x = orig.x + 5
for i = -2, 2 do
d1.y = orig.y + i
d2.y = d1.y
orig:sendDistanceEffect(d1, effect)
orig:sendDistanceEffect(d2, effect)
end

d1.y = orig.y - 3
d2.y = orig.y + 3
for i = -4, 4 do
d1.x = orig.x + i
d2.x = d1.x
orig:sendDistanceEffect(d1, effect)
orig:sendDistanceEffect(d2, effect)
end
end

local function backOldPosition(cid, oldPosition)
local player = Player(cid)
if not player then
return
end

player:teleportTo(oldPosition)
player:setGhostMode(false)
end

local function jumpEffect(cid, target)
local player = Player(cid)
if not player then
return
end

local target = Creature(target)
if target then
player:getPosition():sendDistanceEffect(target:getPosition(), CONST_ANI_EXPLOSION)
end
end

local function jumpOnTarget(cid, target, targetCount, oldPosition)
local player = Player(cid)
if not player then
return
end

local target = Creature(target)
if target then
addEvent(targetEffect, 100, cid)
player:teleportTo(target:getPosition())
player:setGhostMode(true)
doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -1, -100, CONST_ME_ASSASSIN)
if targetCount == 0 then
addEvent(backOldPosition, 400, cid, oldPosition)
end
end
end

local function extractRandomValuesFromTable(tbl) --By Printer(This will make sure not to select a value twice from the table)
if #tbl == 0 then
return false
end
return table.remove(tbl, math.random(#tbl))
end

function onCastSpell(creature, var)
local targets = {}

local playerPos = creature:getPosition()
local spectators = Game.getSpectators(playerPos, false, false, 0, 10, 0, 10)
for i = 1, #spectators do
local specs = spectators[i]
if specs ~= creature and not specs:isNpc() then
targets[#targets+1] = specs
end
end

if #targets == 0 then
creature:sendCancelMessage('There is no targets in sight.')
playerPos:sendMagicEffect(CONST_ME_POFF)
return false
end

local targetCount = #targets
for i = 1, #targets do
local randTarget = extractRandomValuesFromTable(targets)
addEvent(jumpOnTarget, i * 400, creature:getId(), randTarget:getId(), targetCount - i, playerPos)
addEvent(jumpEffect, i * 300, creature:getId(), randTarget:getId())
end
return false
end
 
Last edited:
well there is 2 ways of doing it.
First of all you do realize the this line is making damage right?
doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -1, -100, CONST_ME_ASSASSIN)

Well as you said to me in inBox you want to use Skill values and item attack to benefit the damage.
There is 2 ways to do it. (maybe more, but i only know 2)

easier way (imo)
add these lines

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)

this will make a new combatObject what makes physical damage and makes fire effect

You sent me formula so im gone use it.
Code:
function onGetFormulaValues(cid, skill, attack, factor)
    local skillTotal, levelTotal = skill * attack, getPlayerLevel(cid) / 5
    return -(((skillTotal * 0.03) + 7) + (levelTotal)), -(((skillTotal * 0.05) + 11) + (levelTotal))
end

Now you need this line to make it work
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

to execute this combat object you use this line:
doCombat(creature, combat, var)

Use the above line instead of:
doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -1, -100, CONST_ME_ASSASSIN)


not 100% sure will it work so easily, but hope so.

Second "more advanced" solution
You get your player slot what holds weapon, get that item attack.
you get your player skillValue what you want.
you get your player level
Play with the numbers in variable. (playing = making formula)
use the variables instead of -1 and -100 you see in the doTargetCombatHealth function.
 
Bump.. Still cant figure out this annoying problem

You see
Code:
local target = Creature(target)
if target then
addEvent(targetEffect, 100, cid)
player:teleportTo(target:getPosition())
player:setGhostMode(true)
doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -1, -100, CONST_ME_ASSASSIN)
if targetCount == 0 then
addEvent(backOldPosition, 400, cid, oldPosition)
end
end
end
the -1 and -100 are the damage
re place with min/max and do your formulas above for the local variable
 
Back
Top