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

Talkaction Chest

kilirt

New Member
Joined
May 11, 2009
Messages
223
Reaction score
2
Hello all ^^ i need a script where when i open a chest i win the talkaction: "!berserk"

possible? or i maybe i create a other groups "player" with acces 2 and when open box this update the player to the groups "player"?
 
data/actions/actions.xml
XML:
<action uniqueid="6001" event="script" value="chest.lua"/>

data/talkactions/talkactions.xml
XML:
<talkaction words="!berserk" event="script" value="berserk.lua"/>

data/Actions/scripts/chest.lua
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, 9876) < 1 then
   doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You won talkaction !berserk")
   setPlayerStorageValue(cid,9876,1)
else
    doPlayerSendCancel(cid, "You have already done this quest")
end
return true
end

data/talkactions/scripts/berserk.lua
LUA:
function onSay(cid, words, param)
if getPlayerStorageValue(cid,9876) > 0 then
   ------ Talkaction does???? -------
else
    doPlayerSendCancel(cid, "You dont have this talkaction")
end
return true
end
 
i've doing:
Code:
--[[
Script By mock the bear
Config
]]
function onSay(cid, words, param)
if getPlayerStorageValue(cid,9876) > 0 then
function choose(...)
   local arg = {...}
   return arg[math.random(1,#arg)]
end
local conf = {
	effectlist = {12,13,14,3,28,29,30,39,68},
	soulPerSec=0,
	soulToStart=0,
	allPercent=0,
}
---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, 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 getPlayerSoul(cid) == 0 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 getPlayerSoul(cid) > 0 and getPlayerStorageValue(cid,32481) == 1 

then
		doPlayerAddSoul(cid,-conf.soulPerSec)
		doSendMagicEffect(getCreaturePosition(cid) , 49)
		addEvent(checkBuff,1000,cid)
	else
		doRemoveCondition(cid, CONDITION_ATTRIBUTES,49)
		setPlayerStorageValue(cid,32481,-1)
		return false
	end
end
function onSay(cid, words, param, channel) --- Script by mock
	if getPlayerStorageValue(cid,32481) == 1 then
		setPlayerStorageValue(cid,32481,-1)
		doCreatureSay(cid,'BERSERK MODE OFF!',19)
		return true
	end
	if getPlayerSoul(cid) >= conf.soulToStart then
		doPlayerAddSoul(cid,-conf.soulToStart)
		setPlayerStorageValue(cid,32481,1)
		checkBuff(cid)
		rot(cid,1)
		doCreatureSay(cid,'BERSERK MODE ON!',19)
		doCombat(cid, combat, numberToVariant(cid))
	else
		doPlayerSendTextMessage(cid,25,'You need more than 25 soul!')
	end
	return true
end
else
    doPlayerSendCancel(cid, "You dont have this talkaction")
end
return true
end
but when i said berserk is ok this said you not have the talkaction but when i learn the talkaction and said berserk all server crash with error:
Code:
[21/12/2010 16:39:27] [Error - TalkAction Interface] 
[21/12/2010 16:39:27] data/talkactions/scripts/berserk.lua:onSay
[21/12/2010 16:39:27] Description: 
[21/12/2010 16:39:27] (luaSetCombatCondition) This function can only be used while loading the script


Original Berserk.lua:
LUA:
function choose(...)
   local arg = {...}
   return arg[math.random(1,#arg)]
end
local conf = {
	effectlist = {12,13,14,3,28,29,30,39,68},
	soulPerSec=1,
	soulToStart=25,
	allPercent=50,
}
---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, 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 getPlayerSoul(cid) == 0 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 getPlayerSoul(cid) > 0 and getPlayerStorageValue(cid,32481) == 1 then
		doPlayerAddSoul(cid,-conf.soulPerSec)
		doSendMagicEffect(getCreaturePosition(cid) , 49)
		addEvent(checkBuff,1000,cid)
	else
		doRemoveCondition(cid, CONDITION_ATTRIBUTES,49)
		setPlayerStorageValue(cid,32481,-1)
		return false
	end
end
function onSay(cid, words, param, channel) --- Script by mock
	if getPlayerStorageValue(cid,32481) == 1 then
		setPlayerStorageValue(cid,32481,-1)
		doCreatureSay(cid,'BERSERK MODE OFF!',19)
		return true
	end
	if getPlayerSoul(cid) >= conf.soulToStart then
		doPlayerAddSoul(cid,-conf.soulToStart)
		setPlayerStorageValue(cid,32481,1)
		checkBuff(cid)
		rot(cid,1)
		doCreatureSay(cid,'BERSERK MODE ON!',19)
		doCombat(cid, combat, numberToVariant(cid))
	else
		doPlayerSendTextMessage(cid,25,'You need more than 25 soul!')
	end
	return true
end
 
LUA:
function choose(...)
   local arg = {...}
   return arg[math.random(1,#arg)]
end
local conf = {
	effectlist = {12,13,14,3,28,29,30,39,68},
	soulPerSec=1,
	soulToStart=25,
	allPercent=50,
}
---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, 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 getPlayerSoul(cid) == 0 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 getPlayerSoul(cid) > 0 and getPlayerStorageValue(cid,32481) == 1 then
		doPlayerAddSoul(cid,-conf.soulPerSec)
		doSendMagicEffect(getCreaturePosition(cid) , 49)
		addEvent(checkBuff,1000,cid)
	else
		doRemoveCondition(cid, CONDITION_ATTRIBUTES,49)
		setPlayerStorageValue(cid,32481,-1)
		return false
	end
end
function onSay(cid, words, param)
if getPlayerStorageValue(cid,32481) == 1 then
   if getPlayerStorageValue(cid,9876) > 0 then
      setPlayerStorageValue(cid,32481,-1)
      doCreatureSay(cid,'BERSERK MODE OFF!',19)
   else
    doPlayerSendCancel(cid, "You dont have this talkaction")
   end
return true
end
	
if getPlayerSoul(cid) >= conf.soulToStart then
   if getPlayerStorageValue(cid,9876) > 0 then
      doPlayerAddSoul(cid,-conf.soulToStart)
      setPlayerStorageValue(cid,32481,1)
      checkBuff(cid)
      rot(cid,1)
      doCreatureSay(cid,'BERSERK MODE ON!',19)
      doCombat(cid, combat, numberToVariant(cid))
   else
		doPlayerSendTextMessage(cid,25,'You dont have this talkaction!')
   end
else
    doPlayerSendTextMessage(cid,25,'You do not have enough soul!')
end
return true
end
 
Try with this one...

whatever_the_name_of_Mocks_talkaction_is.lua:
LUA:
function choose(...)
   local arg = {...}
   return arg[math.random(1,#arg)]
end
local conf = {
	effectlist = {12,13,14,3,28,29,30,39,68},
	soulPerSec=1,
	soulToStart=25,
	allPercent=50,
}
---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, 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 getPlayerSoul(cid) == 0 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 getPlayerSoul(cid) > 0 and getPlayerStorageValue(cid, 32481) == 1 then
		doPlayerAddSoul(cid, -conf.soulPerSec)
		doSendMagicEffect(getCreaturePosition(cid) , 49)
		addEvent(checkBuff, 1000, cid)
	else
		doRemoveCondition(cid, CONDITION_ATTRIBUTES, 49)
		setPlayerStorageValue(cid, 32481, -1)
		return false
	end
end

function onSay(cid, words, param, channel) --- Script by mock
	if(getPlayerStorageValue(cid, 9876) > 0) then
		if(getPlayerStorageValue(cid, 32481) == 1) then
			setPlayerStorageValue(cid, 32481, -1)
			doCreatureSay(cid, 'BERSERK MODE OFF!', 19)
			return true
		end

		if(getPlayerSoul(cid) >= conf.soulToStart) then
			doPlayerAddSoul(cid, -conf.soulToStart)
			setPlayerStorageValue(cid, 32481, 1)
			checkBuff(cid)
			rot(cid, 1)
			doCreatureSay(cid, 'BERSERK MODE ON!', 19)
			doCombat(cid, combat, numberToVariant(cid))
		else
			doPlayerSendTextMessage(cid, 25, 'You need more than 25 soul!')
		end
	else
		doPlayerSendCancel(cid, 'You dont have this talkaction')
	end
	return true
end

EDIT: @santigggg: You don't necessarily have to spam with if(getPlayerStorageValue(cid, 9876) > 0) then just put it right after function onSay(cid, words, param, channel) and it'll work ^_^
 
Last edited:
LUA:
function choose(...)
   local arg = {...}
   return arg[math.random(1,#arg)]
end
local conf = {
	effectlist = {12,13,14,3,28,29,30,39,68},
	soulPerSec=1,
	soulToStart=25,
	allPercent=50,
}
---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, 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 getPlayerSoul(cid) == 0 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 getPlayerSoul(cid) > 0 and getPlayerStorageValue(cid,32481) == 1 then
		doPlayerAddSoul(cid,-conf.soulPerSec)
		doSendMagicEffect(getCreaturePosition(cid) , 49)
		addEvent(checkBuff,1000,cid)
	else
		doRemoveCondition(cid, CONDITION_ATTRIBUTES,49)
		setPlayerStorageValue(cid,32481,-1)
		return false
	end
end
function onSay(cid, words, param)
if getPlayerStorageValue(cid,32481) == 1 then
   if getPlayerStorageValue(cid,9876) > 0 then
      setPlayerStorageValue(cid,32481,-1)
      doCreatureSay(cid,'BERSERK MODE OFF!',19)
   else
    doPlayerSendCancel(cid, "You dont have this talkaction")
   end
return true
end
	
if getPlayerSoul(cid) >= conf.soulToStart then
   if getPlayerStorageValue(cid,9876) > 0 then
      doPlayerAddSoul(cid,-conf.soulToStart)
      setPlayerStorageValue(cid,32481,1)
      checkBuff(cid)
      rot(cid,1)
      doCreatureSay(cid,'BERSERK MODE ON!',19)
      doCombat(cid, combat, numberToVariant(cid))
   else
		doPlayerSendTextMessage(cid,25,'You dont have this talkaction!')
   end
else
    doPlayerSendTextMessage(cid,25,'You do not have enough soul!')
end
return true
end

Thx Work perfectly ^^

Try with this one...

whatever_the_name_of_Mocks_talkaction_is.lua:
LUA:
function choose(...)
   local arg = {...}
   return arg[math.random(1,#arg)]
end
local conf = {
	effectlist = {12,13,14,3,28,29,30,39,68},
	soulPerSec=1,
	soulToStart=25,
	allPercent=50,
}
---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, 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 getPlayerSoul(cid) == 0 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 getPlayerSoul(cid) > 0 and getPlayerStorageValue(cid, 32481) == 1 then
		doPlayerAddSoul(cid, -conf.soulPerSec)
		doSendMagicEffect(getCreaturePosition(cid) , 49)
		addEvent(checkBuff, 1000, cid)
	else
		doRemoveCondition(cid, CONDITION_ATTRIBUTES, 49)
		setPlayerStorageValue(cid, 32481, -1)
		return false
	end
end

function onSay(cid, words, param, channel) --- Script by mock
	if(getPlayerStorageValue(cid, 9876) > 0) then
		if(getPlayerStorageValue(cid, 32481) == 1) then
			setPlayerStorageValue(cid, 32481, -1)
			doCreatureSay(cid, 'BERSERK MODE OFF!', 19)
			return true
		end

		if(getPlayerSoul(cid) >= conf.soulToStart) then
			doPlayerAddSoul(cid, -conf.soulToStart)
			setPlayerStorageValue(cid, 32481, 1)
			checkBuff(cid)
			rot(cid, 1)
			doCreatureSay(cid, 'BERSERK MODE ON!', 19)
			doCombat(cid, combat, numberToVariant(cid))
		else
			doPlayerSendTextMessage(cid, 25, 'You need more than 25 soul!')
		end
	else
		doPlayerSendCancel(cid, 'You dont have this talkaction')
	return true
end

EDIT: @santigggg: You don't necessarily have to spam with if(getPlayerStorageValue(cid, 9876) > 0) then just put it right after function onSay(cid, words, param, channel) and it'll work ^_^

[21/12/2010 18:38:16] [Error - LuaScriptInterface::loadFile] data/talkactions/scripts/berserk.lua:89: 'end' expected (to close 'function' at line 68) near '<eof>'
[21/12/2010 18:38:16] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/berserk.lua)
[21/12/2010 18:38:16] data/talkactions/scripts/berserk.lua:89: 'end' expected (to close 'function' at line 68) near '<eof>'

:S
 
Ehm...forgot to close an if :facepalm: *edits post* There.
It's really not my week...I've been failing so much. I hope this doesn't ruins my trip to Norway....
 
Last edited:
EDIT: @santigggg: You don't necessarily have to spam with if(getPlayerStorageValue(cid, 9876) > 0) then just put it right after function onSay(cid, words, param, channel) and it'll work ^_^

I noe lol, I just did it fast had no time to think bout that xD
 
Back
Top