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

Upgrade attack/armor every hit

Status
Not open for further replies.

VirrageS

←•†ĿuĀ && ©¤¤•→
Joined
May 30, 2010
Messages
984
Reaction score
63
Location
Poland
Hello!

Like in title I looking for script which will upgrade attack/armor every hit.

1. For example I have sword and it have:
Code:
attack: [COLOR="red"]14[/COLOR]
then when I hit 5 times monster/player by this sword after that it will have:
Code:
attack: [COLOR="red"]19[/COLOR]




2. For example I have armor (it can be also shield/legs/head) and it have:
Code:
defense: [COLOR="red"]14[/COLOR]
then when I get hit 5 times from the monster/player this armor after that it will have:
Code:
defense: [COLOR="red"]19[/COLOR]



Thanks and rep for help. :thumbup:
 
Last edited:
Try this, not tested and I'm tired.

LUA:
local allowedweps = {2841,5239} -- weapon id's of allowed weapons.

function onStatsChange(cid,attacker,type,combat,value)
	if isPlayer(attacker) then
		if getPlayerIp(attacker) ~= getPlayerIp(cid) then
			if type == STATSCHANGE_HEALTHLOSS then
				if isInArray(allowedweps,getPlayerSlotItem(attacker,CONST_SLOT_RIGHT).itemid) then 
					setItemAttack(CONST_SLOT_RIGHT.uid,getItemAttack(CONST_SLOT_RIGHT.uid)+1)
				elseif isInArray(allowedweps,getPlayerSlotItem(attacker,CONST_SLOT_LEFT).itemid) then
					setItemAttack(CONST_SLOT_LEFT.uid,getItemAttack(CONST_SLOT_LEFT.uid)+1)
				end
			end
		else
			doPlayerSendCancel(cid,'Can\'t gain weapon upgrade from users with the same IP.')
		end
	end
	return true
end

@CyberM
Storage for what?
 
If you can find me a thread which has something that upgrades your weapon attack, pm the link to me and I will make it further, don't know how to upgrade attack attribute.
 
doItemSetAttribute(item.uid,"attack",bala)

and make acheck for value > 0 , just that it would be better to upgrade if your hit made damadge.
 
hmm, try this.
I tried the way mock did it, not sure what '&a+(1*(#))' does but that's what he did.

LUA:
function setItemAttack(uid,name)
	return doItemSetAttribute(uid,'attack',name)
end

local allowedweps = {2841,5239} -- weapon id's of allowed weapons.
function onStatsChange(cid,attacker,type,combat,value)
	if isPlayer(attacker) then
		if getPlayerIp(attacker) ~= getPlayerIp(cid) then
			if type == STATSCHANGE_HEALTHLOSS and value ~= 0 then
				if isInArray(allowedweps,getPlayerSlotItem(attacker,CONST_SLOT_RIGHT).itemid) then 
					setItemAttack(CONST_SLOT_RIGHT.uid,doTransform('&a+(1*(#))',CONST_SLOT_RIGHT.uid))
				elseif isInArray(allowedweps,getPlayerSlotItem(attacker,CONST_SLOT_LEFT).itemid) then
					setItemAttack(CONST_SLOT_LEFT.uid,doTransform('&a+(1*(#))',CONST_SLOT_LEFT.uid))
				end
			end
		else
			doPlayerSendCancel(cid,'Can\'t gain weapon upgrade from users with the same IP.')
		end
	end
	return true
end

Can't test myself now.
 
try this, was experimenting a bit with attributes ;s

LUA:
local weapons = {2400,2431} -- weapon id's of allowed weapons.
 
function onStatsChange(cid, attacker, type, combat, value)
	if isPlayer(attacker) and type.target == STATSCHANGE_HEALTHLOSS then
		setItemAttack(CONST_SLOT_RIGHT.uid,getItemAttack(CONST_SLOT_RIGHT.uid)+1)
	elseif isInArray(weapons,getPlayerSlotItem(attacker,CONST_SLOT_LEFT).itemid) then
		setItemAttack(CONST_SLOT_LEFT.uid,getItemAttack(CONST_SLOT_LEFT.uid)+1)
	end
	if getPlayerIp(attacker) == getPlayerIp(cid).target then
		doPlayerSendCancel(cid,'Your weapon won\'t upgrade by attacking a player with the same IP.')
	end
	end
		return true
end

@edit, 1337 posts O.O!!
 
well u have to add it to the creaturescripts.xml, but if you haven't already figured that one out.. -.-
 
Status
Not open for further replies.
Back
Top