Action Claw of the Noxious Spawn [TFS 0.3.6]

Joined
Apr 17, 2008
Messages
1,922
Best answers
0
Reaction score
181
Location
Venezuela
Hello, here i'm releasing the script for the item "Claw of the Noxious Spawn", you can see how it works here: Claw of 'The Noxious Spawn' - TibiaWiki - Quests, Items, Spells, and more

Go to data/items/items.xml and search for:
PHP:
	<item id="10309" article="a" name="claw of the noxious spawn">
		<attribute key="description" value="It's like a glove and you can't wear a ring on it. You are not sure if you should really put it on."/>
		<attribute key="weight" value="500"/>
	</item>
And replace with this:
PHP:
	<item id="10309" article="a" name="claw of the noxious spawn">
		<attribute key="description" value="It's like a glove and you can't wear a ring on it. You are not sure if you should really put it on."/>
		<attribute key="weight" value="500"/>
		<attribute key="slotType" value="ring"/>
		<attribute key="transformDeEquipTo" value="10310"/>
	</item>
	<item id="10310" article="a" name="claw of the noxious spawn">
		<attribute key="description" value="It's like a glove and you can't wear a ring on it. You are not sure if you should really put it on."/>
		<attribute key="weight" value="500"/>
		<attribute key="slotType" value="ring"/>
		<attribute key="transformEquipTo" value="10309"/>
	</item>
	<item id="10311" article="a" name="claw of the noxious spawn">
		<attribute key="weight" value="500"/>
		<attribute key="decayTo" value="10310"/>
		<attribute key="duration" value="86400"/>
		<attribute key="showduration" value="1"/>
	</item>
After it, go to data/movements/movements.xml and paste this:
PHP:
	<movevent type="Equip" itemid="10309" slot="ring" level="100" event="function" value="onEquipItem"/>
	<movevent type="DeEquip" itemid="10309" slot="ring" level="100" event="function" value="onDeEquipItem"/>
	<movevent type="Equip" itemid="10310" slot="ring" level="100" event="function" value="onEquipItem"/>
	<movevent type="DeEquip" itemid="10310" slot="ring" level="100" event="function" value="onDeEquipItem"/>
	<movevent type="Equip" itemid="10311" slot="ammo" level="100" event="function" value="onEquipItem"/>
	<movevent type="DeEquip" itemid="10311" slot="ammo" level="100" event="function" value="onDeEquipItem"/>
Now, go to data/actions/scripts/other/ and create a file called claw.lua, paste this inside:
Lua:
local config =
{
	conditionsToRemove = {CONDITION_POISON, CONDITION_CURSED}, --conditions to be removed
	timeBetweenUse = 10, --time between uses (in seconds)
	usesLimit = 60, --uses limit before transform the claw in the unuseful claw(itemid: 10311)
	usesLimitTime = 1, --if you use the claw 'usesLimit' times or (60 times) before 'usesLimitTime' hours or (1 hours) then claw will be transformed in the unuseful claw
	damage = 200, --damage if you use the claw in a non-protection zone
	timeStorage = 64500, --storage to save the time between uses (timeBetweenUse)
	usesStorage = 64501, --storage to save the times you use the claw before the 'usesLimit'
	usesLimitStorage = 64502 --storage to save the times you use the claw before 'usesLimitTime' hours
}	

function onUse(cid, item, fromPosition, itemEx, toPosition)

	if(getPlayerStorageValue(cid, config.timeStorage) < 0) then
		doPlayerSetStorageValue(cid, config.timeStorage, 0)
	end
	if(getPlayerStorageValue(cid, config.usesStorage) < 0) then
		doPlayerSetStorageValue(cid, config.usesStorage, 0)
	end
	if(os.clock() - getPlayerStorageValue(cid, config.timeStorage)) > config.timeBetweenUse then
		if(getTilePzInfo(getCreaturePosition(cid)) == true) then
			doCreatureSay(cid, "It tightens around your wrist as you take it on.", TALKTYPE_MONSTER)
		else
			doCreatureSay(cid, "Ouch! The serpent claw stabbed you.", TALKTYPE_MONSTER)
			doCreatureAddHealth(cid, -config.damage)
			doSendAnimatedText(getCreaturePosition(cid), config.damage, TEXTCOLOR_RED)
		end

		doPlayerSetStorageValue(cid, config.timeStorage, os.clock())

		if(os.clock() - (config.usesLimitTime * 3600) < getPlayerStorageValue(cid, config.usesLimitStorage)) then
			doPlayerSetStorageValue(cid, config.usesStorage, getPlayerStorageValue(cid, config.usesStorage) + 1)
		else
			doPlayerSetStorageValue(cid, config.usesStorage, 0)
		end

		if(getPlayerStorageValue(cid, config.usesStorage) >= config.usesLimit) then
			doTransformItem(item.uid, item.itemid + 2)
		end
		for i = 1, table.maxn(config.conditionsToRemove) do
			doRemoveCondition(cid, config.conditionsToRemove[i])
		end
	else
		return false
	end
	return true
end
And then, paste this in data/actions/actions.xml:
PHP:
	<action itemid="10309" event="script" value="other/claw.lua"/>
Notes:
Code:
[LIST]
[*]Well this happens to me so i post it here if someone have the same bug... edit the items.xml file with Notepad(Bloc de notas para los habla español) or XML Editor, because the WordPad give bugs.
[*]When claw is transformed to the unuseful claw (itemid: 10311), it will not add the cursed and poison conditions because i don't remember how to do that =D!
[*]When claw is transformed to the unuseful claw(itemid: 10311), you need to put the claw in your ammo slot and wait 24 hours.
[/LIST]
 

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
852
Location
Caribbean Sea
a must-have item

rep++

It cures your Poisoned state when you click on it while wearing it, you can use it once every 10~ seconds. When you move it to your ring slot, you will receive 200 damage (will be less if wearing equipment), but if you do it while standing in a protection zone you won't take any damage, once you've put it on you don't have to take it off for it to recharge. However, it's advisable to take it off and wear again after using it around 60 times, or it will be depleted for 1 day, when it happens you might get Poisoned or Cursed. If it happens you receive around 15 turns of damage, increasing from 1 until the last damage of 460+ (remove the curse eating a Hydra Tongue Salad) or asking for healing in a temple). When it happens, the message about the claw being usable only for levels 100+ disappears and the claw can't be put in ring slot (becomes a decoration object).
When you wear it, it will say "It tightens around your wrist as you take it on." and also "Ouch! The serpent claw stabbed you."
 

Sportacus

Intermediate OT User
Joined
Aug 3, 2008
Messages
720
Best answers
0
Reaction score
101
I get this when I try to use the claw. Using TFS 0.3.6

Code:
[03/01/2010 03:19:11] [Error - Action Interface] 
[03/01/2010 03:19:11] data/actions/scripts/other/claw.lua:onUse
[03/01/2010 03:19:11] Description: 
[03/01/2010 03:19:11] data/actions/scripts/other/claw.lua:3: attempt to index global 'config' (a nil value)
[03/01/2010 03:19:12] stack traceback:
[03/01/2010 03:19:12] 	data/actions/scripts/other/claw.lua:3: in function <data/actions/scripts/other/claw.lua:1>
 

Zyntax

*WannaBe Scripter*
Joined
Jan 27, 2010
Messages
533
Best answers
0
Reaction score
36
Location
Lua & XML Section
I get this when I try to use the claw. Using TFS 0.3.6

Code:
[03/01/2010 03:19:11] [Error - Action Interface] 
[03/01/2010 03:19:11] data/actions/scripts/other/claw.lua:onUse
[03/01/2010 03:19:11] Description: 
[03/01/2010 03:19:11] data/actions/scripts/other/claw.lua:3: attempt to index global 'config' (a nil value)
[03/01/2010 03:19:12] stack traceback:
[03/01/2010 03:19:12] 	data/actions/scripts/other/claw.lua:3: in function <data/actions/scripts/other/claw.lua:1>
Copy the whole code!
You missed the upper part:

local config ={...}
 

Sportacus

Intermediate OT User
Joined
Aug 3, 2008
Messages
720
Best answers
0
Reaction score
101
Copy the whole code!
You missed the upper part:

local config ={...}
... How on Earth did I skip over copying the top part. Sometimes I amaze myself with how dumb I can be...
 

Spo teh pro

New Member
Joined
Jan 3, 2008
Messages
319
Best answers
0
Reaction score
1
Wow great script!

+rep for u

Also I would like to know if it could be possible, if you wear the claw you get like 35% melee skill more?:p

Would be very nice for my server^^

Thanks in advance
 

Maniucza

~Lua~ Noob
Joined
Aug 2, 2009
Messages
86
Best answers
0
Reaction score
6
Location
Poland / Rzeszów
PHP:
local config =
{
        conditionsToRemove = {CONDITION_POISON, CONDITION_CURSED}, --conditions to be removed
        timeBetweenUse = 10, --time between uses (in seconds)
        usesLimit = 60, --uses limit before transform the claw in the unuseful claw(itemid: 10311)
        usesLimitTime = 1, --if you use the claw 'usesLimit' times or (60 times) before 'usesLimitTime' hours or (1 hours) then claw will be transformed in the unuseful claw
        damage = 200, --damage if you use the claw in a non-protection zone
        timeStorage = 64500, --storage to save the time between uses (timeBetweenUse)
        usesStorage = 64501, --storage to save the times you use the claw before the 'usesLimit'
        usesLimitStorage = 64502 --storage to save the times you use the claw before 'usesLimitTime' hours
}      

function onUse(cid, item, fromPosition, itemEx, toPosition)

        if(getPlayerStorageValue(cid, config.timeStorage) < 0) then
			return doPlayerSetStorageValue(cid, config.timeStorage, 0)
        end
		
        if(getPlayerStorageValue(cid, config.usesStorage) < 0) then
            return doPlayerSetStorageValue(cid, config.usesStorage, 0)
        end
		
        if(os.clock() - getPlayerStorageValue(cid, config.timeStorage)) > config.timeBetweenUse then
            if(getTilePzInfo(getCreaturePosition(cid)) == true) then
                return doCreatureSay(cid, "It tightens around your wrist as you take it on.", TALKTYPE_MONSTER)
            else
				doCreatureSay(cid, "Ouch! The serpent claw stabbed you.", TALKTYPE_MONSTER)
                doCreatureAddHealth(cid, -config.damage)
                doSendAnimatedText(getCreaturePosition(cid), config.damage, TEXTCOLOR_RED)
            end

                doPlayerSetStorageValue(cid, config.timeStorage, os.clock())

                if(os.clock() - (config.usesLimitTime * 3600) < getPlayerStorageValue(cid, config.usesLimitStorage)) then
                    return doPlayerSetStorageValue(cid, config.usesStorage, getPlayerStorageValue(cid, config.usesStorage) + 1)
                else
                    return doPlayerSetStorageValue(cid, config.usesStorage, 0)
                end

            if(getPlayerStorageValue(cid, config.usesStorage) >= config.usesLimit) then
				doTransformItem(item.uid, item.itemid + 2)
            end
				
            for i = 1, table.maxn(config.conditionsToRemove) do
                doRemoveCondition(cid, config.conditionsToRemove[i])
            end
        else
            return false
        end
   return true
end
 

soul4soul

Active Member
Joined
Aug 13, 2007
Messages
1,787
Best answers
0
Reaction score
43
Location
USA
done/added thanks for your work =] rep up


Wow great script!

+rep for u

Also I would like to know if it could be possible, if you wear the claw you get like 35% melee skill more?:p

Would be very nice for my server^^

Thanks in advance
Code:
		<attribute key="skillSword" value="30"/>
		<attribute key="skillClub" value="30"/>
		<attribute key="skillAxe" value="30"/>
		<attribute key="skillDist" value="30"/>
		<attribute key="skillFish" value="30"/>
		<attribute key="skillShield" value="30"/>
		<attribute key="skillFist" value="30"/>
thats really all you can do. when wearing it, it will increase each of your skills by 30. put it in items.xml under the id 10310
 
Top