• 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 Fortune Cookie

Sportacus

Intermediate OT User
Joined
Aug 3, 2008
Messages
718
Reaction score
100
This is a script that when you use a cookie, you get a fortune with it.

The fortune comes on a piece of paper.

I included 46 fortunes, feel free to add more.


You can either add it to your food script, or make a script just for the cookie.

I added it to my food script.

Lua:
local FORTUNES = { 		-- Fortunes for the Fortune Cookie
"Enjoy what you have! Never mind fame and power",
"A new outlook brightens your image and brings new friends.",
"Your careful nature will bring you financial success.",
"You are always entertaining and delightful.",
"With integrity and consistency, your credits are piling up.",
"Hone your competitive instincts.",
"Courage is the mastery of fear - not the absence of fear.",
"Constant grinding can turn an iron rod into a needle.",
"You may lack ambition, but not the ability to succeed.",
"Smile! A frown may turn others away.",
"Versatility is one of your outstanding traits.",
"You have a unique personality.",
"You will be advanced socially, without any special effort.",
"Lady luck will soon visit you.",
"You will live a long, prosperous life.",
"Soon, you'll have a chance at a profitable transaction.",
"You will attract cultured and artistic people to your home.",
"The home is the chief school of human virtues.",
"The time has come to allow your heart to guide you.",
"Assert yourself, your ideas are worthwhile.",
"The smallest deed is better than the biggest intention.",
"The two hardest things to handle in life are failure and success.",
"To understand a man's mind, listen to his words.",
"Enjoy the lighter things in life, deeper joys will follow.",
"Before you receive, you must give.",
"An hour with friends is worth more than ten with strangers.",
"Advice is like kissing. It costs nothing and is a pleasant thing to do.",
"Any activity becomes creative when the doer cares about doing it right, or better.",
"A man can fail many times, but he isn't a failure until he gives up.",
"It is better to ask some questions than to know all the answers.",
"Impossible is a word only to be found in the dictionary of fools.",
"A kiss makes the heart young again and wipes out the years.",
"A lifetime friend shall soon be made.",
"A journey must begin with a single step.",
"Before you wonder, 'Am I doing things right,' ask 'Am I doing the right things?'",
"Good luck is the result of good planning.",
"Patience is a key to joy.",
"Keep true to the dreams of your youth.",
"A focused mind is one of the most powerful forces in the universe.",
"A good beginning is half the task.",
"Sometimes traveling to a new place leads to great transformation.",
"You will move to a wonderful new home within the year.",
"Hope is the most precious treasure to a person.",
"Don't be afraid to take that big step.",
"Everywhere you choose to go, friendly faces will greet you.",
"Failure is the mother of success.",
"Bad luck and misfortune will infest your pathetic soul for all eternity."
}


function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 2687 then			-- fortune cookie script
		doSendMagicEffect(fromPosition, CONST_ME_POFF)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,  "You found a fortune inside.")
		local chance = math.random(1,#FORTUNES)
		if doRemoveItem(item.uid, 1) then
			local cookie = doPlayerAddItem(cid, 1954, 1)
			doSetItemText(cookie, FORTUNES[chance])
		end
		return true
	end
 
Last edited:
I like it very much, but you should do a small edit:

Instead of:
Lua:
local chance = math.random(1, 46)

You should change it to:

Lua:
local chance = math.random(1,#FORTUNES)
then you can add more fortunes without encreasing the math.randoms value.

Thanks, and I like the fortunes! Keep it up :)
 
Forgot a very important one:
tumblr_lhuip0smiG1qgm7odo1_500.png
 
@ Moosie

Ah you're right, it is better to do it that way. Didn't think about it when I made the script


@Ratser


hahaha, thats a good one, I will add it to the list.


Updated first post.
 
Back
Top