• 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:
humm , i understand nothng :p

tryed to look at your thing but really made no sense
Lua:
function onDeath(cid, corpse, deathList)
	if(isMonster(cid) and isInArray({"The Noxious Spawn"}, getCreatureName(cid):lower())) then
		reward = doAddContainerItem(corpse.uid, 10310, 1)
		getStorage(5000) == value
		if(doSetStorage(5000, value + 1)) then
			getStorage(5000) == value
			doItemSetAttribute(reward, "aid", getStorage(5000) / 10)
		end
	end
 
	return true
end
 
Psst, dude, we can use storageValues lol!
If this are playerStorage values the it will only affect the player right?
Or im kinda confused or im doing it right, btw no more decay shit with 10 seconds, I added exhaustion time for the 10 seconds stuff and also for the 1 day stuff, so check it out, im pretty sure this shud work like this:
Lua:
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 cursed = 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)
 
local storage = 8900

local config = {
exhaustionInSeconds = 10,
storage = 34534,
exhaustionInDaySeconds = 86400,
Daystorage = 35534
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
q = getPlayerStorageValue(cid, storage)
if q <= 0 then
j = 1 
else
j = q
end

if(exhaustion.check(cid, config.storage) == TRUE) then
doPlayerSendCancel(cid, "You can use this item per " .. config.exhaustionInSeconds .. " seconds.")
return true
end

if(exhaustion.check(cid, config.Daystorage) == TRUE) then
doPlayerSendCancel(cid, "The item has been depleted, you will be able to use it again in 1 day.")
return true
end

if item.itemid >= 10309 and item.itemid < 10310 then
   if getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == 10309 then
      if getPlayerLevel(cid) >= 100 then
         if getPlayerStorageValue(cid, storage) < 60 then
            doRemoveCondition(cid,poison)
            setPlayerStorageValue(cid,storage,0+j)
            exhaustion.set(cid, config.storage, config.exhaustionInSeconds)
         elseif getPlayerStorageValue(cid,storage) >= 60 and getPlayerStorageValue(cid,storage) < 120 then
                if (math.random(1,600) == 60) then
                   if (math.random(1,2) == 1) then
                      doAddCondition(cid,poison)
                      doTransformItem(item.uid,10311)
                      exhaustion.set(cid,config.Daystorage, config.exhaustionInDaySeconds)
                   else
                       doAddCondition(cid,cursed)
                       doTransformItem(item.uid,10311)
                       exhaustion.set(cid,config.Daystorage, config.exhaustionInDaySeconds)
                   end
                else
                    doRemoveCondition(cid,poison)
                    setPlayerStorageValue(cid,storage,0+j)
                    exhaustion.set(cid,config.storage, config.exhaustionInSeconds)
                end
         elseif getPlayerStorageValue(cid,storage) == 120 then
                if (math.random(1,2) == 1) then
                   doAddCondition(cid,poison)
                   doTransformItem(item.uid,10311)
                   exhaustion.set(cid,config.Daystorage, config.exhaustionInDaySeconds)
                else
                   doAddCondition(cid,cursed)
                   doTransformItem(item.uid,10311)
                   exhaustion.set(cid,config.Daystorage, config.exhaustionInDaySeconds)
                end
         else
             doPlayerSendCancel(cid, "You need to be level 100 or more in order to use this item")
         end
   else
       doPlayerSendCancel(cid, "You can only use this item while wearing it")
   end
end
return true
end
end

And movements, why dont we only do one script, something like this
Lua:
function onEquip(cid, item, slot)
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
end

function onDeEquip(cid, item, slot)
local storage = 8900
if getPlayerStorageValue(cid,storage) > 0 then
   setPlayerStorageValue(cid,storage)
   doTransformItem(item.uid,10310)
else
    doTransformItem(item.uid,10310)
end
return true
end
 
humm , i understand nothng :p

tryed to look at your thing but really made no sense
Lua:
function onDeath(cid, corpse, deathList)
	if(isMonster(cid) and isInArray({"The Noxious Spawn"}, getCreatureName(cid):lower())) then
		reward = doAddContainerItem(corpse.uid, 10310, 1)
		getStorage(5000) == value
		if(doSetStorage(5000, value + 1)) then
			getStorage(5000) == value
			doItemSetAttribute(reward, "aid", getStorage(5000) / 10)
		end
	end
 
	return true
end

That was an example on could it be done.

@santigggg: But if someone gives the claw to another player then the usage count would restart and he/she can use it, even if the last player "depleted" the item.

Ugh...that's why we need storage values for items.
 
Last edited:
That was an example on could it be done.

@santigggg: But if someone gives the claw to another player then the usage count would restart and he/she can use it, even if the last player "depleted" the item.

Ugh...that's why we need storage values for items.

Uhm, you mean that if I give you the item depleted you can still use it?
I think not, since the item depleted is just a deco item? And the seconds of the exhaustion thing will still go on?
 
My bad...I mean "use" the item

And no, the exhaustion only affects the player (cid). If the player who depleted the item is not holding it when the exhaustion ends, then the claw will remain as a decoration item. That's why I used decay.
 
Back
Top