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

[Request] I need this Script Please ??

Status
Not open for further replies.

FabianoBN

l|¬¬"|l
Joined
Jan 23, 2009
Messages
745
Reaction score
22
Location
Goias - Brazil
Please man, I need the Script of Horestis Tomb!
{or Base script Break room in all Ornate Canopic Jar}, appears Horestis.

For TFS 0.3

Thanks!


-- Update the request --

The script will check into a room where have several jars around.
Picture of the room:
View attachment 22293

Direct Image Link:
http://img89.imageshack.us/img89/9103/ayf7.png

I want that this script check if all players around the room broken the jars and in the last jar broken, the monster will be spawned in the blue area.
At last this script will be run after 24 hours, rebuilding all broken jars again.
 
Last edited:
The script will check into a room where have several jars around.
Picture of the room:
respaw.jpg

Direct image link:
http://img89.imageshack.us/img89/9103/ayf7.png

I want that this script check if all players around the room broken the jars and in the last jar broken, the monster will be spawned in the blue area.
At last this script will be run after 24 hours, rebuilding all broken jars again.
 
@FabianoBN
The way I would do it, is create a simple action that adds to a global storage value.

You have 26 Jars.
Add this to your start.lua in Globalevents (if you don't have one make one)
Lua:
setGlobalStorageValue(storage, 26)

Then add this to the Action Script that breaks the jars:

Lua:
local count = getGlobalStorageValue(storage)
if count == 0 then
	doSummonCreature("Horestis", {x=999,y=999,z=7}, true, true)
end
setGlobalStorageValue(storage, count-1)

Just replace storage with any unused number value and set the position and it should work.
Then if you don't have a Global Server Save where the server shuts down, you'll need to make another Global Event to reset the storage value to 26 and rebuild the jars (or you could just have them Decay back into repaired jars)
 
Hmm.. Thanks for Help.
And Yes I not use Global Save.
would also use a AddEvent.
or even a globalevent make sure that if you have modified the globalStorage change to 26 again.
 
Last edited:
I tried to do the way you said, using globalStorage.
but it did not work because after that is 0.
the monster is not born because I use TFS 0.3
and arrays is stored as cache type and then goes to save the database.
 
You can do this by globalevent or only action, by checking the jars everytime someone breaks it.

But i dont know which one of these is the best solution for this ^^

I would done it in action, since i dont like a globalevent to check everytime when there is no people in the quest.
 
This is how I would do it if you're not saving global storage (don't know why you wouldn't though :D):

Code:
local config = {
	jarItemId = 13500,
	brokenJarItemId = 13495,
	storage = 21100,
	numberOfJars = 3,
	breakJarMsg = "You have broken a jar!",
	summonMsg = "The tomb of Trollmeister has been disturbed!"}
local spawns = {
	{x = 982, y = 429, z = 8},
	{x = 983, y = 429, z = 8},
	{x = 982, y = 430, z = 8}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == config.jarItemId then
		local phase = getGlobalStorageValue(config.storage) + 1
		setGlobalStorageValue(config.storage, phase)
		
		doCreatureSay(cid, config.breakJarMsg, TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, config.brokenJarItemId)
		
		if phase == config.numberOfJars - 1 then -- since unset values are initially set to -1
			broadcastMessage(config.summonMsg, MESSAGE_STATUS_WARNING)
	
			for i = 1, #spawns do
				doSummonCreature("Rat", spawns[i])
			end
		end
	end

	return TRUE
end
 
I'm also trying to do for actions through globalStorage.
but when I break the last jar, the monster does not appear.
because TFS 0.3 does not play data directly in the database.
 
Last edited:
not quite.
the issue is that the TFS 0.3, uses type a cache for everything that is done on the server, and then performing a save, when it sends the data to the database.

Example:
I broke a jar, and when I broke that won a storage jar, at the moment I see this for storage in the database, the storage is not in the database. But if I give a save and view in the database, the storage will be it.
 
Here is the code you said you were using in PM:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = 26000
local count = getGlobalStorageValue(storage)     
local options = {
      [1] = {name = "Break!"},
      [2] = {name = "Waaaaaah!"},
      [3] = {name = "You are too afraid to destroy this object."}
      }
local fazer = options[math.random(1, #options)]
if fazer.name == "Break!" then
setGlobalStorageValue(storage, count -26)
doRemoveItem(cid, itemEx.uid,1)
doPlayerSendTextMessage(cid, TEXTCOLOR_ORANGE_1, "Break!") 
else
doPlayerSendTextMessage(cid, TEXTCOLOR_ORANGE_1, ""..fazer.."")
end   
return true
end

.... Where do I start...
First of all, your script has no function for summoning a creature.
So you need to add in:
Lua:
doSummonCreature(name, pos, true, true) -- You fill in the name and position
Secondly! You have it subtracting 26 EACH time you break a vase, this means:
- Server stats up and start.lua sets global storage to 26 (for 26 vases)
- Player breaks the first vase, global storage(26) - 26 = 0 so monster will spawn on the first vase being broken
- Player breaks the second vase, now we have global storage of -26, then -52, etc.
It should look something like:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local storage = 26000
	local count = getGlobalStorageValue(storage)     
	local options = {
		[1] = {name = "Break!"},
		[2] = {name = "Waaaaaah!"},
		[3] = {name = "You are too afraid to destroy this object."}
	}
	local fazer = options[math.random(1, #options)]
	if fazer.name == "Break!" then
		count = count - 1
		setGlobalStorageValue(storage, count)
		doRemoveItem(cid, itemEx.uid,1)
		doPlayerSendTextMessage(cid, TEXTCOLOR_ORANGE_1, "Break!") 
		if count == 0 then
			doSummonCreature(CREATURENAME, POSITION, true true) -- Of course put in the creaturename and position yourself
		end
	else
		doPlayerSendTextMessage(cid, TEXTCOLOR_ORANGE_1, ""..fazer.."")
	end   
	return true
end

As long as start.lua sets the global storage value to 26 when your server starts up, this script should work.
 
not quite.
the issue is that the TFS 0.3, uses type a cache for everything that is done on the server, and then performing a save, when it sends the data to the database.

Example:
I broke a jar, and when I broke that won a storage jar, at the moment I see this for storage in the database, the storage is not in the database. But if I give a save and view in the database, the storage will be it.

Yeah, but that does not mean that the global storage is not set, just because you can't view it in your SQL-browser. You don't have to bother if it's in the servers cache or not.
 
Oh and, even though the server uses cache to save global storage values, they are COMPLETELY useable, there is no issue at all using storage values on any TFS version I have ever used.

The only time you will have an issue is if you are running SQL Database Queries and pulling information directly from SQL. Which, if you really NEEDED to, you could force the server to save right before you run the database query. Either way, Storage Values work perfectly.

- - - Updated - - -

Yeah, but that does not mean that the global storage is not set, just because you can't view it in your SQL-browser. You don't have to bother if it's in the servers cache or not.

Glad I'm not the only one that knows whats going on in this world :)
 
Status
Not open for further replies.
Back
Top