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

Solved [TFS 1.1] onTargetCombat(target) crashes the server

zbizu

Legendary OT User
Joined
Nov 22, 2010
Messages
3,323
Solutions
26
Reaction score
2,696
Location
Poland
I'm working on slot system features and I want to add extra damage to weapons. However, function is executed twice and when I try to add any combat, the server crashes.

test function:
Code:
function Creature:onTargetCombat(target)
	print(true)
	doTargetCombatHealth(self:getId(), target:getId(), COMBAT_PHYSICALDAMAGE, 1, 10)
	return true
end
 
Wouldn't it be better off using the onUseWeapon() event in the Weapons interface for added damage and more?
Furthermore, if I'm correct, onTargetCombat() is really only for targeting creatures. It is called at the moment you target a creature.
So, using this, I could repeatedly target/untarget really fast to spam damage. It is intended to be called twice, can't remember the reason though.
 
how do I register "onUseWeapon" for all ids in game?
I could use my items parser to get all ids, but I believe there is more efficient way to do it.
 
Last edited:
I was working on something similar yesterday but the best way that I could find was using the onHealthChange function... At least your server won't crash lol.
 
Back
Top