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

onAreaCombat TFS 1.2

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
Hi everyone, I got a problem with onAreaCombat. The code didn't return false then you cast it like the image below

xHrOOlS.png


Code:
function Creature:onAreaCombat(tile, isAggressive)
   if self:isPlayer() and self:isInWar() then
     return RETURNVALUE_YOUMAYNOTATTACKINWARMODE
   end
  return true
end

The main idea is if you're in warmode then you can't cast spells what use onAreaCombat.

Thanks.
 
I think the better solution would be to just cancel the damage to their war enemies. The way you set it up now, or wish to set it, makes it cancel just for being in war mode. Which means they can't even hunt with area spells outside of war.

Try:
Use tile:getCreatures() to get a list of all players/monsters on tile.
Use a for loop to go through the creatures, find out which is a player, and check if that player is an enemy guild.
Then only if all the circumstances are true then you can cancel the damage for that player.
 
Hmm after testing Creature:onAreaCombat(tile, isAggressive) it seems to be that it's purpose is to do something after the damage has already been done.

I could be wrong, but that's the conclusion I came up with after playing with it. If I'm wrong I hope someone can correct me.

You could try with onHealthChange or onManaChange though. :)
 
Back
Top