function Creature:onTargetCombat(target)
if not self then
return true
end
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
return true
end
function Creature:onTargetCombat(target)
if not self then
return true
end
if target:isPlayer() then
if target:getStorageValue(STORAGENUMBER) == 1 then
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
end
end
return true
end
<event class="Creature" method="onTargetCombat" enabled="0" />
<event class="Creature" method="onTargetCombat" enabled="1" />
dofile('data/lib/events/BATTLEFIELD_lib.lua')
function Creature:onTargetCombat(target)
if not self then
return true
end
if self:isPlayer() and target:isPlayer() then
if (self:getStorageValue(bf.teamOne.storage) > 0 and target:getStorageValue(bf.teamOne.storage) > 0) or
(self:getStorageValue(bf.teamTwo.storage) > 0 and target:getStorageValue(bf.teamTwo.storage) > 0) then
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
end
end
return true
end
The codes that the sailor cat provided are for 1.x...Tfs 1.0 don't support these events :s i try to update my source but without sucess... U have any tutorial for me to update my source with this event to work?
Yeap i know this, but i have updated my source to work "onGainExperience" i think isn't so hard to make these others events work..The codes that the sailor cat provided are for 1.x...
@Edit: Nvm, I think that those events were introduced in 1.1 or 1.2. Sorry.
@Edit2: You can take that code and make an onhealthchange/onmanachange script.