• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Getting pearls from Sea Shells

AGS

DeathSouls Owner
Joined
Oct 29, 2007
Messages
400
Reaction score
10
Location
Mexico
A really simple script, you just use closed seashells(7552) and you may get a giant shimmering pearl, you may squeeze your fingers, or you may just not get anything.
Actions.xml
Code:
<action itemid="7552-7553" event="script" value="other/seashell.lua" />

seashell.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local CHANCES = math.random(100)
	if item.itemid == 7552 then
		if CHANCES <= 20 then
			doPlayerAddItem(cid,math.random(7632,7633),1)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a giant shimmering pearl.")
			doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
		elseif CHANCES <= 60 then
			doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -100, -200, CONST_ME_NONE)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You squeezed your fingers.")
			doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found nothing.")
			doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
		end
		doTransformItem(item.uid,item.itemid+1)
		doDecayItem(item.uid)
	elseif item.itemid == 7553 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
	end
	return true
end

And finally:
items.xml
Code:
	<item id="7552" article="a" name="large seashell">
		<attribute key="description" value="Maybe there's something inside of it."/>
	</item>
	<item id="7553" article="a" name="large seashell">
		<attribute key="description" value="It is empty."/>
		<attribute key="decayTo" value="7552"/>
		<attribute key="duration" value="86400"/>
	</item>
Code:
	<item id="7632" article="a" name="giant shimmering pearl" plural="giant shimmering pearls">
		<attribute key="weight" value="80"/>
	</item>
	<item id="7633" article="a" name="giant shimmering pearl" plural="giant shimmering pearls">
		<attribute key="weight" value="80"/>
	</item>

And that's it, hope you like it.
 
Thanks Ags. I just wanted to do it ;).

Anyway i would do it in another way. it looks like, 1 player can open every seashell on map. Not nice...

Good Script should looks like:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local timenow = os.time()
local nextday = timenow + 86400
local CHANCES = math.random(100)
	if item.itemid == 7552 then
if getPlayerStorageValue(cid,75520) < timenow then
		if CHANCES <= 20 then
			doPlayerAddItem(cid,math.random(7632,7633),1)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a giant shimmering pearl.")
			doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
		elseif (CHANCES <= 60 and CHANCES > 20) then
			doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -100, -200, CONST_ME_NONE)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You squeezed your fingers.")
			doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found nothing.")
			doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
		end
setPlayerStorageValue(cid,75520, nextday)
		doTransformItem(item.uid,item.itemid+1)
		doDecayItem(item.uid)
else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already tried to open a sea shell today.")
end
	elseif item.itemid == 7553 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
	end
	return true
end

:)
 
Last edited:
Well done AGS, you say its simple, I say its creative ;) and Id say we need more of that here :)

So keep it up! And ty you too quas for optimizing it.

+Rep to you both :thumbup:
 
Back
Top