Nowix93
New Member
- Joined
- Feb 25, 2017
- Messages
- 32
- Reaction score
- 0
[TFS 1.3]
Hello OTpeople,
I start my ot projekt and i will have probably a lot of questions.
Ofc i will use before ask "search" but when it doesnt help i will ask in this topic
i learning form 2 month c++ for this and now i start with lua too, i know its nothing but step by step so
i start learnig TFS source how its work, there is a lot of everything ;x
ok, lets go to the firsts questions
1)
in enums there are a lot of (example)1 << 11
that mean something? highter priority dmg In this case ? its probably not necessary but i'm curious ;x
2)
i want create simple spell with funcion (creature:getDirection) to check where the player is looking and set area dmg for that but i stuck , and i want to get 2 more options before cast, first dont atack just stay in 500ms i create for it CONDITION_CAST and second for cast animatin on me best option is the character was invisible first what functions should I use for this?
My simple ofc dont working spell
I will have many questions so I do not know if setting up a topic in good place if not please transfer
Hello OTpeople,
I start my ot projekt and i will have probably a lot of questions.
Ofc i will use before ask "search" but when it doesnt help i will ask in this topic
i learning form 2 month c++ for this and now i start with lua too, i know its nothing but step by step so
i start learnig TFS source how its work, there is a lot of everything ;x
ok, lets go to the firsts questions
1)
Code:
COMBAT_PHYSICALDAMAGE = 1 << 0, COMBAT_ENERGYDAMAGE = 1 << 1, COMBAT_EARTHDAMAGE = 1 << 2, COMBAT_FIREDAMAGE = 1 << 3, COMBAT_UNDEFINEDDAMAGE = 1 << 4, COMBAT_LIFEDRAIN = 1 << 5, COMBAT_MANADRAIN = 1 << 6, COMBAT_HEALING = 1 << 7, COMBAT_DROWNDAMAGE = 1 << 8, COMBAT_ICEDAMAGE = 1 << 9, COMBAT_HOLYDAMAGE = 1 << 10, COMBAT_DEATHDAMAGE = 1 << 11,
that mean something? highter priority dmg In this case ? its probably not necessary but i'm curious ;x
2)
i want create simple spell with funcion (creature:getDirection) to check where the player is looking and set area dmg for that but i stuck , and i want to get 2 more options before cast, first dont atack just stay in 500ms i create for it CONDITION_CAST and second for cast animatin on me best option is the character was invisible first what functions should I use for this?
My simple ofc dont working spell
Code:
-- Delay between animations.
local animationDelay = 200
local combat = {}
local north = 0
local east = 1
local south = 2
local west = 3
-- Frames (1 = Area, 2 = Player, 3 = Player + Self Damaging)
local area0 = {
{
{1, 0, 0},
{0, 2, 0},
{0, 0, 0}
},
{
{0, 1, 0},
{0, 2, 0},
{0, 0, 0}
},
{
{0, 0, 1},
{0, 2, 0},
{0, 0, 0}
}
}
local area1 = {
{
{0, 0, 1},
{0, 2, 0},
{0, 0, 0}
},
{
{0, 0, 0},
{0, 2, 1},
{0, 0, 0}
},
{
{0, 0, 0},
{0, 2, 0},
{0, 0, 1}
}
}
local area2 = {
{
{0, 0, 0},
{0, 2, 0},
{0, 0, 1}
},
{
{0, 0, 0},
{0, 2, 0},
{0, 1, 0}
},
{
{0, 0, 0},
{0, 2, 0},
{1, 0, 0}
}
}
local area3 = {
{
{0, 0, 0},
{0, 2, 0},
{1, 0, 0}
},
{
{0, 0, 0},
{1, 2, 0},
{0, 0, 0}
},
{
{1, 0, 0},
{0, 2, 0},
{0, 0, 0}
}
}
local x
local cDir = creature:getDirection()
if cDir == north then
x = area0
elseif cDir == east then
x = area1
elseif cDir == south then
x = area2
elseif cDir == west then
x = area3
end
local area = x
for i = 1, #area do
combat[i] = Combat()
combat[i]:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
end
for x, _ in ipairs(area) do
combat[x]:setArea(createCombatArea(area[x]))
end
function executeCombat(p, i)
if not p.player then
return false
end
if not p.player:isPlayer() then
return false
end
p.combat[i]:execute(p.player, p.var)
end
function onCastSpell(player, var)
local p = {player = player, var = var, combat = combat}
-- Damage formula
local level = player:getLevel()
local maglevel = player:getMagicLevel()
local min = (level / 5) + (maglevel * 1.4) + 8
local max = (level / 5) + (maglevel * 2.2) + 14
for i = 1, #area do
combat[i]:setFormula(COMBAT_FORMULA_LEVELMAGIC, 0, -min, 0, -max)
if i == 1 then
combat[i]:execute(player, var)
else
addEvent(executeCombat, (animationDelay * i) - animationDelay, p, i)
end
end
return true
end
I will have many questions so I do not know if setting up a topic in good place if not please transfer
Last edited: