the little guy
New Member
- Joined
- May 30, 2013
- Messages
- 8
- Reaction score
- 0
Hello, i have been trying to convert one of Mock the bears great scripts http://otland.net/f81/berserker-mode-91551/
Into a spell that consumes Hp per second instead of a Chat command that takes soul.
i got the thing pretty much working i think, gives the effects and turns on/off but it says (luaDoCombat) Combat not found and it does not take my hp Or give me the skills D: think someone can help me out?
( the original script was made by mock the bear so all rights to him)
Into a spell that consumes Hp per second instead of a Chat command that takes soul.
i got the thing pretty much working i think, gives the effects and turns on/off but it says (luaDoCombat) Combat not found and it does not take my hp Or give me the skills D: think someone can help me out?
( the original script was made by mock the bear so all rights to him)
Code:
--[[
Script By mock the bear
Config
]]
local function getPlayerHealth(cid)
if isPlayer(cid) then
return getCreatureHealth(cid)
end
end
function choose(...)
local arg = {...}
return arg[math.random(1,#arg)]
end
local conf = {
effectlist = {29},
healthPerSec=150,
HealthToStart=25,
allPercent=150,
}
---Load combat
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition, CONDITION_PARAM_SUBID, 49)
local cond = {
CONDITION_PARAM_STAT_MAXHEALTHPERCENT = 31,
CONDITION_PARAM_STAT_MAXMANAPERCENT = 32,
CONDITION_PARAM_STAT_MAGICLEVELPERCENT = 34,
CONDITION_PARAM_SKILL_MELEEPERCENT = 35,
CONDITION_PARAM_SKILL_FISTPERCENT = 36,
CONDITION_PARAM_SKILL_CLUBPERCENT = 37,
CONDITION_PARAM_SKILL_SWORDPERCENT = 38,
CONDITION_PARAM_SKILL_AXEPERCENT = 39,
CONDITION_PARAM_SKILL_DISTANCEPERCENT = 40,
CONDITION_PARAM_SKILL_SHIELDPERCENT = 41,
}
for i,b in pairs(cond) do
setConditionParam(condition, b, 100+conf.allPercent)
end
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, var, condition)
local function rot(cid,n) --- Script by mock
local tb_rot = {{0,2},{6,5},{1,3},{7,4},false}
if not isPlayer(cid) or tb_rot[n] == nil or getPlayerHealth(cid) == 1 or getPlayerStorageValue(cid,32481) == -1 then
return false
end
if tb_rot[n] == false then
doSendMagicEffect(getPosByDir(getCreaturePosition(cid), tb_rot[1][1]) , choose(unpack(conf.effectlist)))
doSendMagicEffect(getPosByDir(getCreaturePosition(cid), tb_rot[1][2]) ,choose(unpack(conf.effectlist)))
addEvent(rot, 200,cid,2)
return false
end
doSendMagicEffect(getPosByDir(getCreaturePosition(cid), tb_rot[n][1]) , choose(unpack(conf.effectlist)))
doSendMagicEffect(getPosByDir(getCreaturePosition(cid), tb_rot[n][2]) , choose(unpack(conf.effectlist)))
n = n+1
addEvent(rot, 200,cid,n)
end
function checkBuff(cid)
if not isPlayer(cid) then return end
if getPlayerHealth(cid) > 1 and getPlayerStorageValue(cid,32481) == 1 then
doCreatureAddHealth(cid,-conf.healthPerSec)
doSendMagicEffect(getCreaturePosition(cid) , 49)
addEvent(checkBuff,1000,cid)
else
doRemoveCondition(cid, CONDITION_ATTRIBUTES,49)
setPlayerStorageValue(cid,32481,-1)
return false
end
end
function onCastSpell(cid, var, words, parameters) --- Script by mock
if getPlayerStorageValue(cid,32481) == 1 then
setPlayerStorageValue(cid,32481,-1)
doCreatureSay(cid,'off',19)
return true
end
if getPlayerHealth(cid) >= conf.HealthToStart then
doCreatureAddHealth(cid,-conf.HealthToStart)
setPlayerStorageValue(cid,32481,1)
checkBuff(cid)
rot(cid,1)
doCreatureSay(cid,'on',19)
doCombat(cid, combat, var, parameters, numberToVariant(cid))
else
doPlayerSendTextMessage(cid,25,'You need more than 1 hp')
end
return true
end