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

[Action] The Shield Nevermourn | Claw of 'The Noxious Spawn'

Ratser

Retired // Making time for yoloswagmod
Joined
Feb 11, 2009
Messages
482
Reaction score
36
Ok, so...I was trying to create a script for The Shield Nevermourn according to its current action in Global but I've been having some errors in console:
Code:
[16/07/2010 11:17:09] [Error - Action Interface] 
[16/07/2010 11:17:09] In a timer event called from: 
[16/07/2010 11:17:09] data/actions/scripts/other/theshieldnevermourn.lua:onUse
[16/07/2010 11:17:09] Description: 
[16/07/2010 11:17:09] data/actions/scripts/other/theshieldnevermourn.lua:11: attempt to index global 'item' (a nil value)
[16/07/2010 11:17:09] stack traceback:
[16/07/2010 11:17:09] 	data/actions/scripts/other/theshieldnevermourn.lua:11: in function <data/actions/scripts/other/theshieldnevermourn.lua:10>
[Explanation]
Since itemid="10318" and itemid="10364" are both the same item I'm trying to transform 10318 to 10364 AFTER 2 seconds (I'm using 2 seconds only to test) [addEvent(onTime, 2000, a)], inmediately after it transforms it has to say a random sound from 'local SOUNDS' (it has to work ONLY if the itemid is 10364). Finally, it inmediately decays back to 10318.

Code:
local SOUNDS = {"Servant! Please call me a coach. - Yes, sir. You are a coach!", "Did your father help you do your homework? No, he did it all by himself.", "If big elephants have big trunks, do small elephants have suitcases?", "Do you want to hear a dirty joke ? A white horse fell in the mud.", "What do you call a deer with no eyes ? - I have no I-Deer!", "My friend said he knew a man with a wooden leg called Sam. So I asked him 'What was the name of his other leg?'", "Did you hear about the Lich who walked into frodo's bar? He ordered a cup of beer and a mup.", "If whistles are made of tin, what are fog horns made of?"}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 10318 then
		addEvent(onTime, 2000, a)
	end
	return true
end

function onTime(a)
	doTransformItem(item.uid, 10364)
	doDecayItem(item.uid)
	if(doTransformItem(item.uid, 10364)) then
		local random = math.random(1, table.maxn(SOUNDS))
		if(fromPosition.x ~= CONTAINER_POSITION) then
			doCreatureSay(cid, SOUNDS[random], TALKTYPE_MONSTER, false, 0, 

fromPosition)
		else
			doCreatureSay(cid, SOUNDS[random], TALKTYPE_MONSTER)
		end
	end
	return true
end
 
Last edited:
You need to include cid and item to parameter because they are not global and only for onUse

PHP:
local SOUNDS = {"Servant! Please call me a coach. - Yes, sir. You are a coach!", "Did your father help you do your homework? No, he did it all by himself.", "If big elephants have big trunks, do small elephants have suitcases?", "Do you want to hear a dirty joke ? A white horse fell in the mud.", "What do you call a deer with no eyes ? - I have no I-Deer!", "My friend said he knew a man with a wooden leg called Sam. So I asked him 'What was the name of his other leg?'", "Did you hear about the Lich who walked into frodo's bar? He ordered a cup of beer and a mup.", "If whistles are made of tin, what are fog horns made of?"}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 10318 then
		addEvent(onTime, 2000, cid, item)
	end
	return true
end

function onTime(cid, item)
	doTransformItem(item.uid, 10364)
	doDecayItem(item.uid)
	if(doTransformItem(item.uid, 10364)) then
		local random = math.random(1, table.maxn(SOUNDS))
		if(fromPosition.x ~= CONTAINER_POSITION) then
			doCreatureSay(cid, SOUNDS[random], TALKTYPE_MONSTER, false, 0, fromPosition)
		else
			doCreatureSay(cid, SOUNDS[random], TALKTYPE_MONSTER)
		end
	end
	return true
end
 
Well I've seen several scripts on teh interwebz that use AddEvent with item.uid (although I never test them). Anyways, is there any other way to do this? Because @Summ solution didn't work.
 
Code:
local SOUNDS = {"Servant! Please call me a coach. - Yes, sir. You are a coach!", "Did your father help you do your homework? No, he did it all by himself.", "If big elephants have big trunks, do small elephants have suitcases?", "Do you want to hear a dirty joke ? A white horse fell in the mud.", "What do you call a deer with no eyes ? - I have no I-Deer!", "My friend said he knew a man with a wooden leg called Sam. So I asked him 'What was the name of his other leg?'", "Did you hear about the Lich who walked into frodo's bar? He ordered a cup of beer and a mup.", "If whistles are made of tin, what are fog horns made of?"}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	doTransformItem(item.uid, 10364)
	doDecayItem(item.uid)
	doCreatureSay(cid, SOUNDS[math.random(#SOUNDS)], TALKTYPE_ORANGE_1, false, 0, fromPosition.x ~= CONTAINER_POSITION and fromPosition or getThingPos(cid))
	return true
end

Code:
	<item id="10364" article="the" name="shield Nevermourn">
		<attribute key="description" value="It is said that the wearer of Nevermourn will never mourn. What a powerful shield."/>
		<attribute key="weight" value="5200"/>
		<attribute key="defense" value="25"/>
[B]		<attribute key="decayTo" value="10318"/>
		<attribute key="duration" value="[COLOR="Red"]300[/COLOR]"/>[/B]
		<attribute key="weaponType" value="shield"/>
	</item>
 
That's how I started the script, but then I looked in TibiaWikia and it says that 'it makes a sound when used, but the delay is of several minutes.'. That's why I'm trying to put a delay in the transformation, a condition that makes the item make a sound only IF it transforms to itemid="10364" and a decay value on that itemid so that inmediately after it transforms it decays back. I only want to use itemid="10364" as the sound maker, because if I put the delay and the sound on the same item [ej. itemid="10318] when the counter reaches 0 the sound message appears but in the position where I first used the shield.

Ej.
Let's say I'm in Thais' Depot and I use the shield (the 'doCreatureSay' delay starts [in this case it works...I've already tried with AddEvent(doCreatureSay, 2000, ...)]. Then, I leave and walk towards Venore. While I'm half-way the delay counter reaches 0 and the sound "appears"...but not where I'm standing. Instead, it appears in Thais' Depot.
 
You got it all wrong, the message appears instantly after using 10318, it gets transformed to 10364. After 5 mins it goes back to 10318.
 
You got it all wrong, the message appears instantly after using 10318, it gets transformed to 10364. After 5 mins it goes back to 10318.

So...then the item Notes on TibiaWikia are wrong...?
Code:
[B]Notes:[/B]  	It makes a sound when used, but the delay is of several minutes.

Should they be:
Code:
[B]Notes:[/B]  	It makes a sound when used, after that there's a 5 minute delay before it can be used to sound again.
or something like that...?
 
Last edited:
K. One more thing...I also created a script for the Claw of 'The Noxious Spawn' (a bit more complex than this one). It works: Cures poison, then it becomes useless for 10 seconds (alternatively you can also deEquip and Equip to make it work again), when you place it on the ring slot you recieve 200 damage if you are not on PZ...but, I need help with this part:
Code:
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).
  • I made the first part using 'math.random(1, 600) == 60' so that there's a chance of 1 from 600 that the item becomes depleted.
  • On the second part I used 'math.random(1, 3)' so that there's 1 chance that the player gets Poisoned, 1 chance that it gets Cursed and 1 chance that is blank (Nothing happens)...
  1. I don't know if this is correct.
  2. I need help with the "you receive around 15 turns of damage, increasing from 1 until the last damage of 460+" part

Should I create another thread or I can just change the name and post the script?
 
Last edited:
maybe something like this? (put this before the function!)
Code:
local curse = createConditionObject(CONDITION_CURSED)
setConditionParam(curse, CONDITION_PARAM_DELAYED, true)
addDamageCondition(curse, 1, 4000, -1)
addDamageCondition(curse, 2, 4000, -2)
addDamageCondition(curse, 1, 4000, -4)
addDamageCondition(curse, 1, 4000, -6)
addDamageCondition(curse, 1, 4000, -9)
addDamageCondition(curse, 1, 4000, -14)
addDamageCondition(curse, 1, 4000, -21)
addDamageCondition(curse, 1, 4000, -21)
addDamageCondition(curse, 1, 4000, -33)
addDamageCondition(curse, 1, 4000, -52)
addDamageCondition(curse, 1, 4000, -80)
addDamageCondition(curse, 1, 4000, -124)
addDamageCondition(curse, 1, 4000, -192)
addDamageCondition(curse, 1, 4000, -298)
addDamageCondition(curse, 1, 4000, -462)

and then use it like this in function:
Code:
doAddCondition(cid, curse)
 
Ok that solves 1 problem...2 left (I just discovered a minor bug)
'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' == So as far as I understood...after using the claw 60 times (I don't know if this applies both with the 10 second recharge and the deEquip/Equip) you have to deEquip it and then Equip it again or else it will be depleted for a day and you might get Poisoned/Cursed (and also the itemid changes to 10314...then, if you take it off it changes to 10315 and can't be equipped again until 24 hours later). I was thinking to do this with 'attribute key="charges"' but I don't know if it will work since when it is used it changes its itemid to 10311, then, if you take it off while it is useless it changes to itemid="10312" (if you take it off while it can be used it changes to itemid="10310"). I don't know if:
  • There's a way to stop the charges even if there's an itemid transformation.
  • I'm using those itemids correctly

The minor bug: If I use '/i 10309' and it appears on a slot other than the "ring slot" it stays as 10309 even if I put it on the floor. It only transforms if I put it in the proper slot and then take it out.

This is the whole script (with your fix added...but still with those bugs I said):

[Action] clawofthenoxiousspawn.lua
Code:
local poison = createConditionObject(CONDITION_POISON)
setConditionParam(poison, CONDITION_PARAM_DELAYED, true)
addDamageCondition(poison, 1, 4000, -1)
addDamageCondition(poison, 2, 4000, -2)
addDamageCondition(poison, 1, 4000, -4)
addDamageCondition(poison, 1, 4000, -6)
addDamageCondition(poison, 1, 4000, -9)
addDamageCondition(poison, 1, 4000, -14)
addDamageCondition(poison, 1, 4000, -21)
addDamageCondition(poison, 1, 4000, -21)
addDamageCondition(poison, 1, 4000, -33)
addDamageCondition(poison, 1, 4000, -52)
addDamageCondition(poison, 1, 4000, -80)
addDamageCondition(poison, 1, 4000, -124)
addDamageCondition(poison, 1, 4000, -192)
addDamageCondition(poison, 1, 4000, -298)
addDamageCondition(poison, 1, 4000, -462)

local curse = createConditionObject(CONDITION_CURSED)
setConditionParam(curse, CONDITION_PARAM_DELAYED, true)
addDamageCondition(curse, 1, 4000, -1)
addDamageCondition(curse, 2, 4000, -2)
addDamageCondition(curse, 1, 4000, -4)
addDamageCondition(curse, 1, 4000, -6)
addDamageCondition(curse, 1, 4000, -9)
addDamageCondition(curse, 1, 4000, -14)
addDamageCondition(curse, 1, 4000, -21)
addDamageCondition(curse, 1, 4000, -21)
addDamageCondition(curse, 1, 4000, -33)
addDamageCondition(curse, 1, 4000, -52)
addDamageCondition(curse, 1, 4000, -80)
addDamageCondition(curse, 1, 4000, -124)
addDamageCondition(curse, 1, 4000, -192)
addDamageCondition(curse, 1, 4000, -298)
addDamageCondition(curse, 1, 4000, -462)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(fromPosition.x ~= CONTAINER_POSITION) then
		return false
	end

	if(getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == 10309) and getPlayerItemCount

(cid, 10309) == 1 then
		doSendMagicEffect(fromPosition, CONST_ME_MAGIC_GREEN)
		local random1 = math.random(1, 600)
		if(random1 == 60) then
			doTransformItem(item.uid,10314)
			local random2 = math.random(1, 3)
			if(random2 == 1) then
				doAddCondition(cid, poison)
			elseif(random2 == 2) then
				doAddCondition(cid, curse)
			end
		else
			if(getCreatureCondition(cid, CONDITION_POISON)) then
				doRemoveCondition(cid, CONDITION_POISON)
				doTransformItem(item.uid, 10311)
				doDecayItem(item.uid)
			else
				doTransformItem(item.uid, 10311)
				doDecayItem(item.uid)
			end
		end
	end
	return true
end
In actions.xml
Code:
	<action itemid="10309" event="script" value="other/clawofthenoxiousspawn.lua"/>
[Movement] clawofthenoxiousspawn.lua
Code:
local TEXT = {"It tightens around your wrist as you take it on.", "Ouch! The serpent claw stabbed you."}

function onEquip(cid, item, slot)
	local random = math.random(1, 2)
	if(getTilePzInfo(getCreaturePosition(cid)) == false) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, TEXT[random])
		doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -200, -200, CONST_ME_DRAWBLOOD)
		doTransformItem(item.uid, 10309)
	else
		doTransformItem(item.uid, 10309)
	end
	return true
end
In movements.xml
Code:
	<movevent type="Equip" itemid="10309" slot="ring" level="100" event="function" value="onEquipItem"/>
	<movevent type="DeEquip" itemid="10309" slot="ring" event="function" value="onDeEquipItem"/>
	<movevent type="Equip" itemid="10310" slot="ring" level="100" function="onEquipItem" script="clawofthenoxiousspawn.lua"/>
	<movevent type="DeEquip" itemid="10310" slot="ring" event="function" value="onDeEquipItem"/>
	<movevent type="Equip" itemid="10311" slot="ring" level="100" event="function" value="onEquipItem"/>
	<movevent type="DeEquip" itemid="10311" slot="ring" event="function" value="onDeEquipItem"/>
	<movevent type="Equip" itemid="10312" slot="ring" level="100" function="onEquipItem" script="clawofthenoxiousspawn.lua"/>
	<movevent type="DeEquip" itemid="10312" slot="ring" event="function" value="onDeEquipItem"/>
	<movevent type="Equip" itemid="10314" slot="ring" level="100" event="function" value="onEquipItem"/>
	<movevent type="DeEquip" itemid="10314" slot="ring" event="function" value="onDeEquipItem"/>
In items.xml
Code:
	<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="description" value="Its power is depleted at the moment." />
		<attribute key="weight" value="500" />
		<attribute key="slotType" value="ring" />
		<attribute key="transformDeEquipTo" value="10312" />
		<attribute key="decayTo" value="10309" />
		<attribute key="duration" value="10" />
	</item>
	<item id="10312" article="a" name="claw of 'The Noxious Spawn'">
		<attribute key="description" value="Its power is depleted at the moment." />
		<attribute key="weight" value="500" />
		<attribute key="slotType" value="ring" />
		<attribute key="transformEquipTo" value="10309" />
	</item>
	<item id="10314" article="a" name="claw of 'The Noxious Spawn'">
		<attribute key="description" value="Its power is depleted at the moment." />
		<attribute key="weight" value="500" />
		<attribute key="slotType" value="ring" />
		<attribute key="transformDeEquipTo" value="10315" />
	</item>
	<item id="10315" article="a" name="claw of 'The Noxious Spawn'">
		<attribute key="description" value="Its power is depleted at the moment." />
		<attribute key="weight" value="500" />
		<attribute key="decayTo" value="10309" />
		<attribute key="duration" value="86400" />
	</item>
 
Last edited:
Bump
Code:
Bumper: Do you want yo buy a 'bump' for 10 gold coins?
Ratser [8]: yes
Bumper: Oops, it didn't work (Hehe...I took all of his money). Do you want to buy another 'bump'?
Ratser [8]: yes
Bumper: Sorry Ratser, I can't give credit...come back when you are a little...MMMMMM...richer.
Ratser [8]: wha?---where's my money!
Bumper: Goodbye, Ratser. *NPC dissapears*
Ratser [8]: FUUUUUUUU
 
Last edited:
Give me a B!...B!
Give me a U!...U!
Give me a M!...M!
Give me a P!...P!
What’s that spell?
I dunno...ask Batman?
 
(8) Do you really want to BUMP me...do you really want to make me---OH C'MON...I'm running out of jokes here!

--BUMP
 
Chestbump_cats.jpg
 
Back
Top