Hello!!
I have found script with catapult which is atacking players.
And everything is fine except for one detail. So when I added this script to MOD it spaming in TFS every 5 sec:
Here is script:
Can someone help me :huh:??
I will be very thankful :thumbup:!!
I have found script with catapult which is atacking players.
And everything is fine except for one detail. So when I added this script to MOD it spaming in TFS every 5 sec:
Code:
[15:59:25.765] [Error - GlobalEvent Interface]
[15:59:25.765] local config = {
[15:59:25.765] catapult = {x = 95 , y = 125 , z = 7},
[15:59:25.765] catapultmindmg = 100,
[15:59:25.765] catapultmaxdmg = 300
[15:59:25.765] }
[15:59:25.765]
[15:59:25.765] function onThink(interval, lastExecution)
[15:59:25.765] local spec = getSpectators(config.catapult, 9, 9, false)
[15:59:25.765] local damage = math.random(config.catapultmindmg, config.catapultmaxdmg)
[15:59:25.765] local target = spec[i]
[15:59:25.765] local targetpos = getCreaturePosition(target)
[15:59:25.765]
[15:59:25.765] if (target ~= nil and tragetpos ~= nil) then
[15:59:25.765] for i = 1, table.getn(spec) do
[15:59:25.765] if (isNpc(Target) == false and getCreatureStorage(cid, config.storage) == config.valuestorage and shooted == false) then
[15:59:25.765] doSendDistanceShoot(config.catapult, targetpos, CONST_ANI_LARGEROCK)
[15:59:25.765] doSendMagicEffect(targetpos, CONST_ME_BLOCKHIT)
[15:59:25.765] doCreatureAddHealth(target, -damage)
[15:59:25.765] doSendAnimatedText(targetpos, damage, TEXTCOLOR_RED)
[15:59:25.765] shooted = true
[15:59:25.765] return true
[15:59:25.765] end
[15:59:25.765] end
[15:59:25.765] return true
[15:59:25.765] end
[15:59:25.765] return true
[15:59:25.765] end
[15:59:25.765] :onThink
[15:59:25.765] Description:
[15:59:25.765] (luaGetThingPosition) Thing not found
Here is script:
Lua:
<globalevent name="Castle_Catapult" interval="5000" event="script"><![CDATA[
local config = {
catapult = {x = 95 , y = 125 , z = 7},
catapultmindmg = 100,
catapultmaxdmg = 300
}
function onThink(interval, lastExecution)
local spec = getSpectators(config.catapult, 9, 9, false)
local damage = math.random(config.catapultmindmg, config.catapultmaxdmg)
local target = spec[i]
local targetpos = getCreaturePosition(target)
if (target ~= nil and tragetpos ~= nil) then
for i = 1, table.getn(spec) do
if (isNpc(Target) == false and getCreatureStorage(cid, config.storage) == config.valuestorage and shooted == false) then
doSendDistanceShoot(config.catapult, targetpos, CONST_ANI_LARGEROCK)
doSendMagicEffect(targetpos, CONST_ME_BLOCKHIT)
doCreatureAddHealth(target, -damage)
doSendAnimatedText(TargetPos, Damage, TEXTCOLOR_RED)
shooted = true
return true
end
end
return true
end
return true
end
]]></globalevent>
Can someone help me :huh:??
I will be very thankful :thumbup:!!