Arn
Member
- Joined
- Mar 8, 2010
- Messages
- 282
- Reaction score
- 18
I'm looking for a way to set a combat area position. For example, suppose I have a spell that shoots out three burst arrows. Each of these burst arrows lands in a different location, in relation to the target. So, what I need is way to set the starting position of a combat object. Is that possible?
Thank you for your time,
-Arn
P.S. TFS 0.2.12
- - - Updated - - -
As usual, I don't get any help and I found the solution on my own. For anyone who cares, heres a pretty amazing spell. Enjoy.
Thank you for your time,
-Arn
P.S. TFS 0.2.12
- - - Updated - - -
As usual, I don't get any help and I found the solution on my own. For anyone who cares, heres a pretty amazing spell. Enjoy.
Code:
local area = createCombatArea{
{0, 1, 0},
{1, 3, 1},
{0, 1, 0}
}
function bsShot(cid, count)
local target = getCreatureTarget(cid)
local randx = math.random(-2,2)
local randy = math.random(-2,2)
local newPos = getCreaturePosition(target)
newPos.x = newPos.x + randx
newPos.y = newPos.y + randy
if count > 0 then
doPlayerAddSkillTry(cid, 4, 1)
doPlayerRemoveItem(cid,2546,1)
doSendDistanceShoot(getCreaturePosition(cid), newPos, CONST_ANI_BURSTARROW)
doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, newPos, area, -5, -10, CONST_ME_FIREAREA)
count = count - 1
addEvent(bsShot, 200, cid, count)
end
end
function onCastSpell(cid, var)
local count = 6
if getPlayerItemCount(cid,2546) >= 6 then
addEvent(bsShot, 200, cid, count)
return true
else
doCreatureSay(cid, "Not enough arrows", TALKTYPE_ORANGE_1)
return false
end
end