endziu2222
Active Member
- Joined
- Nov 2, 2010
- Messages
- 168
- Solutions
- 1
- Reaction score
- 44
Whenever I have more than 2 monsters on the screen and I use exeta amp res, server crashes. Canary 13.20 client, revsript based.
log:
spell:
creature.lua:
I have been trying to fix this for long time now and nothing been solved, anybody can help?
log:
Lua:
2023-10-09 04:50:18 - callbackId:/scripts\spells\support\chivalrous_challenge.lua:canChain]
2023-10-09 04:50:18 - function: []
2023-10-09 04:50:18 - error [Stack size changed!]
2023-10-09 04:50:18 - [2023-09-10 04:50:18.496] [debug] Combat::pickChainTargets: closestSpectator: Frost Flower Asura
2023-10-09 04:50:18 - [2023-09-10 04:50:18.496] [debug] Combat::pickChainTargets: currentTarget: Frost Flower Asura, spectators: 4
2023-10-09 04:50:18 - [2023-09-10 04:50:18.496] [debug] Combat: God Tester -> Frost Flower Asura
2023-10-09 04:50:18 - [2023-09-10 04:50:18.496] [error] Lua script error:
2023-10-09 04:50:18 - scriptInterface: [Event Interface]
2023-10-09 04:50:18 - scriptId: [data/events/scripts/creature.lua:Creature@onTargetCombat]
2023-10-09 04:50:18 - timerEvent: []
2023-10-09 04:50:18 - callbackId:[]
2023-10-09 04:50:18 - function: []
2023-10-09 04:50:18 - error []
2023-10-09 04:50:18 - [2023-09-10 04:50:18.496] [debug] Combat: Frost Flower Asura -> Frost Flower Asura
spell:
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_CHAIN_EFFECT, CONST_ME_CHIVALRIOUS_CHALLENGE)
function canChain(creature, target)
if target:isMonster() then
if target:getType():isRewardBoss() then
return false
elseif target:getMaster() == nil and target:getType():getTargetDistance() > 1 then
return true
end
end
return false
end
combat:setCallback(CALLBACK_PARAM_CHAINPICKER, "canChain")
function getChainValue(creature)
local targets = 5
local player = creature:getPlayer()
if creature and player then
targets = targets + player:getWheelSpellAdditionalTarget("Chivalrous Challenge")
end
return targets, 6, false
end
combat:setCallback(CALLBACK_PARAM_CHAINVALUE, "getChainValue")
function onChain(creature, target)
local duration = 12000
local player = creature:getPlayer()
if creature and player then
duration = duration + (player:getWheelSpellAdditionalDuration("Chivalrous Challenge") * 1000)
end
if target and target:isMonster() then
doChallengeCreature(player, target:getMonster(), 12000)
target:changeTargetDistance(1, duration)
end
return true
end
combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onChain")
local spell = Spell("instant")
function spell.onCastSpell(creature, variant)
local spectators = Game.getSpectators(creature:getPosition(), false, false)
for _, spectator in pairs(spectators) do
if spectator:isMonster() then
if spectator:getType():isRewardBoss() then
creature:sendCancelMessage("You can't use this spell if there's a boss.")
creature:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
end
end
if not combat:execute(creature, variant) then
creature:sendCancelMessage("There are no ranged monsters.")
creature:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
return true
end
spell:group("support")
spell:id(237)
spell:name("Chivalrous Challenge")
spell:words("exeta amp res")
spell:castSound(SOUND_EFFECT_TYPE_SPELL_CHIVALROUS_CHALLENGE)
spell:level(150)
spell:mana(80)
spell:isAggressive(false)
spell:isPremium(true)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000)
spell:vocation("knight;true", "elite knight;true")
spell:needLearn(false)
spell:register()
creature.lua:
Code:
local function removeCombatProtection(cid)
local player = Player(cid)
if not player then
return true
end
local time = 0
if player:isMage() then
time = 10
elseif player:isPaladin() then
time = 20
else
time = 30
end
player:setStorageValue(Global.Storage.CombatProtectionStorage, 2)
addEvent(function(cid)
local player = Player(cid)
if not player then
return
end
player:setStorageValue(Global.Storage.CombatProtectionStorage, 0)
player:remove()
end, time * 1000, cid)
end
picIf = {}
function Creature:onTargetCombat(target)
if not self then
return true
end
if not picIf[target.uid] then
if target:isMonster() then
target:registerEvent("RewardSystemSlogan")
picIf[target.uid] = {}
end
end
if target:isPlayer() then
if self:isMonster() then
local protectionStorage = target:getStorageValue(Global.Storage.CombatProtectionStorage)
if target:getIp() == 0 then -- If player is disconnected, monster shall ignore to attack the player
if target:isPzLocked() then return true end
if protectionStorage <= 0 then
addEvent(removeCombatProtection, 30 * 1000, target.uid)
target:setStorageValue(Global.Storage.CombatProtectionStorage, 1)
elseif protectionStorage == 1 then
self:searchTarget()
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
end
return true
end
if protectionStorage >= os.time() then
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
end
end
end
if ((target:isMonster() and self:isPlayer() and target:getMaster() == self)
or (self:isMonster() and target:isPlayer() and self:getMaster() == target)) then
return RETURNVALUE_YOUMAYNOTATTACKTHISCREATURE
end
if not IsRetroPVP() or PARTY_PROTECTION ~= 0 then
if self:isPlayer() and target:isPlayer() then
local party = self:getParty()
if party then
local targetParty = target:getParty()
if targetParty and targetParty == party then
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
end
end
end
end
if not IsRetroPVP() or ADVANCED_SECURE_MODE ~= 0 then
if self:isPlayer() and target:isPlayer() then
if self:hasSecureMode() then
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
end
end
end
self:addEventStamina(target)
return true
end
function Creature:onChangeOutfit(outfit)
if self:isPlayer() then
local familiarLookType = self:getFamiliarLooktype()
if familiarLookType ~= 0 then
for _, summon in pairs(self:getSummons()) do
if summon:getType():familiar() then
if summon:getOutfit().lookType ~= familiarLookType then
summon:setOutfit({ lookType = familiarLookType })
end
break
end
end
end
end
return true
end
function Creature:onDrainHealth(attacker, typePrimary, damagePrimary,
typeSecondary, damageSecondary, colorPrimary, colorSecondary)
if (not self) then
return typePrimary, damagePrimary, typeSecondary, damageSecondary, colorPrimary, colorSecondary
end
if (not attacker) then
return typePrimary, damagePrimary, typeSecondary, damageSecondary, colorPrimary, colorSecondary
end
return typePrimary, damagePrimary, typeSecondary, damageSecondary, colorPrimary, colorSecondary
end
I have been trying to fix this for long time now and nothing been solved, anybody can help?