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

CreatureEvent Upgrade weapon by killing monsters!

yeah that might be cool I guess. I don't know if I'd use it though. I'd definitely like the elemental damage added. And I'd like to see a description function. So it tells you how many of the monster you've killed with it, when you look at it. And works for multiple monsters like "You see a xxxx. It weighs xx.xx oz. It has slain 16 demons and 34 dragons."
Anyone feelin' me? ^_^
 
Yes but what if i use it for multiple monsters, and it says it has slain x demons and x rats and x dragons and x monsters and x monsters and x monsters lol, that wouldn't work :p
 
maybe delete weapon from array and add to script function to check if is weapon, then add additional points :)
 
Yes but what if i use it for multiple monsters, and it says it has slain x demons and x rats and x dragons and x monsters and x monsters and x monsters lol, that wouldn't work :p

Well I assume this kinda thing wouldn't be for a million weapons with a million monsters. It'd be something where like you kill a special monster or two a certain number of times with a special custom weapon xD
 
que significa TFS 0.3?

TFS 0.3 significa que el script es para The Forgotten Server 0.3+

The Forgotten Server es una distribucion de Open Tibia, te lo puedes descargar en la seccion "Downloads > Distributions" de este foro.

Saludos.

@Ontopic:

Hey slawkens.. could you do like, 70% chances that you get +1 but also 30% that you get -1 attack :p hope you understand. That weapon with +20 attack would be like a real rare then. But it won't work when you finally get 20 attack points, then you'll keep loosing 1 and getting 1 again, that sucks. So instead of getting attack points for killing, make getting some gems after killing x monsters, that gives 70% attack +1 and 30% attack -1, so if you want to use u use, if u don't want u don't ;)

That'd be FANTASTIC! Dont know if its easy or hard to make for slawkens, but he makes it, it would be something Id definitely use for my upcoming project.

Great idea klek!
 
I've added extraDefense

To anyone who wants the extra defense added, I've gone ahead and added it. So here it is.

Code:
--[[
	** Monster weapon upgrader by slawkens **
        ** Extra Defense added by Cocoamonkey **


	kills - how much monsters must be killed
	extraAttack - how much extraAttack points will this weapon get
	extraAttackLimit - you can set limit of extraAttack points added
	extraDefense - how much extraDefense points will this weapon get
	extraDefenseLimit - you can set limit of extraDefense points added
]]--

local monsters = {
	["demon"] = {
		[7382] = {
			kills = 1,
			extraAttack = 50,
			extraAttackLimit = 800,
			extraDefense = 50,
			extraDefenseLimit = 800,
			storage = 34000
	},
			[2400] = {
			kills = 30,
			extraAttack = 1,
			extraAttackLimit = 25,
			extraDefense = 50,
			extraDefenseLimit = 800,
			storage = 34001
		}
	},
	["dragon"] = {
		[7407] = {
			kills = 2,
			extraAttack = 2,
			extraAttackLimit = 20,
			extraDefense = 2,
			extraDefenseLimit = 30,
			storage = 34003
		}
	}
}

function onKill(cid, target)
	if(isPlayer(target) == TRUE) then
		return TRUE
	end

	local monster = monsters[string.lower(getCreatureName(target))]
	if(not monster) then
		return TRUE
	end

	local playerWeapon = getPlayerWeapon(cid, TRUE)
	if(playerWeapon.itemid == 0) then
		return TRUE
	end

	local weapon = monster[playerWeapon.itemid]
	if(not weapon) then
		return TRUE
	end

	local killedMonsters = getPlayerStorageValue(cid, weapon.storage)
	if(killedMonsters == -1) then
		killedMonsters = 1
	end

	local currentExtraAttack = getItemExtraAttack(playerWeapon.uid)
	if(killedMonsters % weapon.kills == 0 and currentExtraAttack < weapon.extraAttackLimit) then
		setItemExtraAttack(playerWeapon.uid, currentExtraAttack + weapon.extraAttack)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.extraAttack .. " attack points and now have total extra damage of +" .. getItemExtraAttack(playerWeapon.uid) .. " points!")
	end
	
		local currentExtraDefense = getItemExtraDefense(playerWeapon.uid)
		if(killedMonsters % weapon.kills == 0 and currentExtraDefense < weapon.extraDefenseLimit) then
		setItemExtraDefense(playerWeapon.uid, currentExtraDefense + weapon.extraDefense)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.extraDefense .. " defense points and now have total extra defense of +" .. getItemExtraDefense(playerWeapon.uid) .. " points!")
	end
	setPlayerStorageValue(cid, weapon.storage, killedMonsters + 1)
	return TRUE
end

I have already tested it. The weapons on there in order are demonrage sword, magic sword and haunted blade. Enjoy :) Rep++ if you love me ^_^
 
I'm going to put myself to work and I'm going to add all the elemental damages as well as speed and attack speed.
 
Can u do something with wands? to give ml..

If you mean a wand that gives magic lvl to the player when worn, you just need to add the attribute in items.xml and the item in movements.xml.

Example (using TFS 0.3.2), wand of inferno giving +3 magic lvls when worn:

In items.xml add the line:

PHP:
	<item id="2187" article="a" name="wand of inferno">
		<attribute key="description" value="It unleashes the very fires of hell."/>
		<attribute key="weight" value="2700"/>
		<attribute key="weaponType" value="wand"/>
		<attribute key="shootType" value="fire"/>
		<attribute key="range" value="3"/>

		<attribute key="magiclevelpoints" value="3"/> -- this line
	</item>

("magiclevelpoints" is the attribute for giving magic lvl points)

In movements.xml add this:

PHP:
<movevent type="Equip" itemid="2187" slot="shield" event="function" value="onEquipItem"/>		-- Wand Of Inferno +3 ML
	<movevent type="DeEquip" itemid="2187" slot="shield" event="function" value="onDeEquipItem"/>

Then just restart the server and when you wear the wand of inferno in any hand it will give +3 magic level and work as usual.

Btw thanks Cocoa for the extraDef one, elemental damages would be fantastic keep it up ;) +Repped
 
What happen if I throw the sword? I mean if another one take it then the damage should be as it was..

Nothing, if you gained +3 attack already with this weapon, it stays +3 forever. Correct me if i'm wrong.
 
Ty but im talking about with the script if u kill
a certain type of monster amount of times..
it gives u +1 ml.
 
I'm not sure that's possible. I will cook something up and test it when I get my laptop back on Tuesday. Till then I'll be monitoring this thread from my iPod touch. Keep the comments flowing! Don't forget to rep+ slawkens and myself :D
Ciao
 
Back
Top