Elgenady
Veteran OT User
- Joined
- Aug 5, 2011
- Messages
- 1,683
- Solutions
- 36
- Reaction score
- 388
i work now in script to transmutation damage from player x to player y
this spell for knight knight can block his friend damage i need when knight protected his friend the damage transmutation to this knight
example
if knight protect mage or whatever vocation and i attack mage need the damage transmutation to knight and mage will be save
this part talkaction for knight protect x player damge now need transmutation damge
im use 0.4 and sorry about my english
Bump
this spell for knight knight can block his friend damage i need when knight protected his friend the damage transmutation to this knight
example
if knight protect mage or whatever vocation and i attack mage need the damage transmutation to knight and mage will be save
this part talkaction for knight protect x player damge now need transmutation damge
Code:
local c = {
storage = 40902,
time = 4
}
--
local cfg = {
fromPosition = {x = 32346, y = 32347, z = 13}, -- top left cornor of the playground
toPosition = {x = 32445, y = 32431, z = 13}, -- bottom right cornor of the playground
}
--
--
local function Back(cid)
if(isPlayer(cid)) then
doSendMagicEffect(getThingPos(cid), 31)
doCreatureSetStorage(cid, 17027, 0)
end
return true
end
local function Animation(cid, param, damage, count)
if((not isPlayer(cid)) or (not isPlayer(param))) then
return false
end
if(count > 0) then -- animations
local cid_pos = getPlayerPosition(param)
local VL = {x=cid_pos.x-1, y=cid_pos.y-1, z=cid_pos.z}
local NL = {x=cid_pos.x-1, y=cid_pos.y+1, z=cid_pos.z}
local VP = {x=cid_pos.x+1, y=cid_pos.y-1, z=cid_pos.z}
local NP = {x=cid_pos.x+1, y=cid_pos.y+1, z=cid_pos.z}
doSendDistanceShoot(VL, VP, CONST_ANI_HOLY)
addEvent(doSendDistanceShoot, 250, VP, NP, CONST_ANI_HOLY)
addEvent(doSendDistanceShoot, 500, NP, NL, CONST_ANI_HOLY)
addEvent(doSendDistanceShoot, 750, NL, VL, CONST_ANI_HOLY)
addEvent(Animation, 1000, cid, param, damage, count - 1)
end
end
--
local function doBlockEffect(param)
doSendAnimatedText(getPlayerPosition(param), "Protected !", COLOR_YELLOW)
return
end
--
function onSay(cid, words, param)
if isInRange(getPlayerPosition(cid), cfg.fromPosition, cfg.toPosition) then
return doPlayerSendCancel(cid, "You can't use this spell in event.")
end
--
local param = getPlayerByName(param)
if not isPlayer(param) then
doPlayerSendCancel(cid, "You must writte name.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return false
end
--
if exhaustion.check(param, c.storage) then
local n = param == cid and "You are" or getPlayerName(param).." is"
doPlayerSendCancel(cid, n.." already blocking attacks.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return false
end
--
if getPlayerStorageValue(cid, 200648) == -1 then
exhaustion.set(param, c.storage, c.time)
Animation(cid, param, damage, 4)
doCreatureSetStorage(cid, 17027, 1)
addEvent(Back,5000,cid)
doSendAnimatedText(getPlayerPosition(param), "Protected!", COLOR_YELLOW)
doCreatureSay(cid,'protected '..getCreatureName(param)..' ',TALKTYPE_ORANGE_1)
doPlayerSendTextMessage(param,5,'You are protection by {'..getCreatureName(cid)..'}.')
local cid_pos = getCreaturePosition(cid)
--local effects = {28,29,30,35,40,14,10,3,4}
local positions = {{x = cid_pos.x + 1, y = cid_pos.y + 1, z = cid_pos.z}, {x = cid_pos.x + 1, y = cid_pos.y, z = cid_pos.z}, {x = cid_pos.x, y = cid_pos.y+1, z = cid_pos.z}, {x = cid_pos.x-1, y = cid_pos.y, z = cid_pos.z}, {x = cid_pos.x + 1, y = cid_pos.y-1, z = cid_pos.z}, {x = cid_pos.x - 1, y = cid_pos.y+1, z = cid_pos.z}, {x = cid_pos.x - 1, y = cid_pos.y - 1, z = cid_pos.z}, {x = cid_pos.x, y = cid_pos.y - 1, z = cid_pos.z}}
local effects = {37,30,37,30}
for i = 1, #positions do
doSendDistanceShoot(positions[i], getCreaturePosition(param), effects[math.random(1,4)])
end
for x = 1, c.time do
addEvent(doBlockEffect, x * 1000, param)
end
else
doPlayerSendCancel(cid," you must learn spell first.")
end
return true
end
Bump
Last edited by a moderator: