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

break weapon

foxkbt

Member
Joined
Sep 29, 2009
Messages
290
Reaction score
7
Location
Salvador
I wonder if it is possible to use a number of the name of an item in a function

if possible would like a function to return to this number

My idea is to make a weapon that breaks
I thought of using storage but there would only suffer damage to owner

EX:
08:26 You see the sword of pain - health [100/100] (Atk: 64 Def: 5)
It weighs 320.00 oz.

function getHealthWeapon(cid)
if getName(itemid) == - health then
local value = [ex/ex]
return value
end
end

remember this is just one example I know that this function does not exist
 
You cant put charges on weapon ? Like fire weapons or etc.
But that idea of script will be nice but change name - "health" to "durability"
 
Yeah nice idea. :thumbup:
And when you have 1(or more)/100 you can repair this in blacksmith for golds.

If is less durability then repair is more costly e.x.:

Code:
[COLOR="red"]90[/COLOR]/100 - [B]50[/B]gp...
[COLOR="red"]50[/COLOR]/100 - [B]300[/B]gp...
[COLOR="red"]10[/COLOR]/100 - [B]800[/B]gp...
[COLOR="red"]0[/COLOR]/100 - you can't repair it (weapon is broken)
 
good idea!
^ ^
but still have some things I would do, using this function I'm asking.
searching on "L.U.A." I found a function that can solve my problem but not know how to use

string.gsub

if someone can teach me would be very grateful
 
I don't know if this is possible:
Code:
doItemSetAttribute(item.uid, "aid", item.actionid + 1)

So it could be something like:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doItemSetAttribute(item.uid, "aid", item.actionid + 1)

	if(item.actionid == XXXX) then
		doRemoveItem(uid[, count])
	end

	return true
end
 
creaturescript onAttack (setWeapon -1 aid or what u want with a random probability if you want...)
the only problem with using aids is that then aaaaaaaaaaaaaaall weapons must have aid, so you can put more aids on them
 
  1. Why onUse: I wrongly pasted part of my WIP 'Castle Defense Cannon' script instead of another 'onAttack' script which is very similar.
  2. @Strack: doItemSetAttribute(item.uid, "aid", item.actionid) (Yes, it blends!)
 
creaturescript onAttack (setWeapon -1 aid or what u want with a random probability if you want...)
the only problem with using aids is that then aaaaaaaaaaaaaaall weapons must have aid, so you can put more aids on them

No, onAttack is executed only when you set some creature/player as your target ;/
 
@cyko
I know, onHit if you prefer... but what are the things that could make it waste? for everytime you hit with weapon it can be used with charges or the form that I said, for time (globalevent), for every hit you receive? also a creaturescript...there are many forms of doing it

@ratser
an item can have 2 aids? if so I didnt know...
 
Last edited:
true... xD I thought I've seen it seems I was wrong, in any case, are you sure onAttack will not run? instead of that also could be use onCombat but im not sure when it is applied
 
onCombat is executed on any combat, that includes spells.

That means the optimal solution is onUseWeapon (weapon script).
 
Back
Top