• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Party member hit only 5% to party member

wesoly136

Member
Joined
Jul 30, 2009
Messages
562
Reaction score
9
Hi!
I don't know how to do it that.
When player X and player Y are in the same party and when they use area spells they hit themselves only some percents of the whole hit.
I think you understand and you know how to do it :D
Thanks
 
Something like this:
PHP:
function onStatsChange(cid, attacker, type, combat, value)
	local percent = 5
	if combat == 128 then
		return true
	end
	if attacker ~= cid and isPlayer(attacker) then
		if getPlayerParty(cid) ~= getPlayerParty(attacker) or (getPlayerParty(attacker) == nil or getPlayerParty(cid) == nil) then
			return true
		end
		local damage = math.ceil((value * percent / 100))
		doTargetCombatHealth(attacker, cid, 128, -damage, -damage, CONST_ME_POFF)
		return false
	end
	
	return true
end
But the effect won't work right..
 
Something like this:
PHP:
function onStatsChange(cid, attacker, type, combat, value)
    local percent = 5
    if combat == 128 then
        return true
    end
    if attacker ~= cid and isPlayer(attacker) then
        if getPlayerParty(cid) ~= getPlayerParty(attacker) or (getPlayerParty(attacker) == nil or getPlayerParty(cid) == nil) then
            return true
        end
        local damage = math.ceil((value * percent / 100))
        doTargetCombatHealth(attacker, cid, 128, -damage, -damage, CONST_ME_POFF)
        return false
    end
    
    return true
end
But the effect won't work right..

that will become a infinite script

instead targetcombat you should take the hp directly from cid, or find another way to take the hp using targetcombat that its actually possible ^^


edit: didnt notice about combat 128, good work A_A
 
Sure
LUA:
function onStatsChange(cid, attacker, type, combat, value)  
    if combat == 128 then 
        return true 
    end 
    if attacker ~= cid and isPlayer(attacker) then 
        if getPlayerParty(cid) ~= getPlayerParty(attacker) or (getPlayerParty(attacker) == nil or getPlayerParty(cid) == nil) then 
            return true 
        end 
        local damage = math.ceil(value/20)
        doTargetCombatHealth(attacker, cid, 128, -damage, -damage, CONST_ME_POFF) 
		doSendAnimatedText(getCreaturePosition(cid),damage,27)
        return false 
    end 
     
    return true 
end
 
Back
Top