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

Storage Value on Effects

Winnerandy

Experienced Web Design'er
Joined
Oct 23, 2008
Messages
2,251
Reaction score
51
Location
Tellus.
Hello there!

I need a script that shows the effects, for example on a chest with a arrow,
and if the player has the storage value 0, then the arrow shows, but after using or moves on x item, the effects that was on that place/item removes,
could be nice with some send text message too..

Also, could be nice if you made one on movement, for example for stairs, and one for globalevents, for items, like chests,
furnitures, ect..
xD

Rep for the one who makes the script :peace:
 
I don't think it's possible to show effects for just some players (in your case, with storage value 0)

Aff, I said storage value because so the effects removes after using.. xD

for example like the queststatus.. but in this case for effects..xD

PHP:
        queststatus = getPlayerStorageValue(cid,xxxx)
        setPlayerStorageValue(cid,xxxx,1)
 
globalevent every __how_long_does_it_take_for_effect_to_disappear__ seconds,
getSpectators, loop getPlayerStorageValue and doSendMagicEffect(pos, effect, cid)
 
globalevent every __how_long_does_it_take_for_effect_to_disappear__ seconds,
getSpectators, loop getPlayerStorageValue and doSendMagicEffect(pos, effect, cid)

aff, xD, I'am not a good scripter, so could you just explain how I would set this up? ^^.. (the whole script?)
 
umm, will it work?
Code:
local pos ={x=, y=, z=}
local storage =
local effect=

function onThink(cid, interval, lastExecution)
local spec=getSpectators(pos, false, false, 7, 7, 7, 7)
for i=1, #spec do
	if isPlayer(spec[i]) and getPlayerStorageValue(storage)>0 then
		doSendMagicEffect(pos, effect, spec[i])
	end
end
return TRUE
end
(not sure about the booleans in getSpectators and how big is tibia screen:D)
 
Code:
local t = {
	pos = { x = 1000, y = 1000, z = 7 },
	storage = 10000,
	effect = CONST_ME_TUTORIALARROW
}
function onThink(interval, lastExecution, thinkInterval)
	local spec = getSpectators(t.pos, 8, 6, true)
	for i = 1, #spec do
		if isPlayer(spec[i]) and getPlayerStorageValue(spec[i], t.storage) > 0 then
			doSendMagicEffect(t.pos, t.effect, spec[i])
		end
	end
	return true
end
 
Code:
local t = {
	pos = { x = 1000, y = 1000, z = 7 },
	storage = 10000,
	effect = CONST_ME_TUTORIALARROW
}
function onThink(interval, lastExecution, thinkInterval)
	local spec = getSpectators(t.pos, 8, 6, true)
	for i = 1, #spec do
		if isPlayer(spec[i]) and getPlayerStorageValue(spec[i], t.storage) > 0 then
			doSendMagicEffect(t.pos, t.effect, spec[i])
		end
	end
	return true
end

I had this script on globalevents, but, I can't see the arrow O_O
 
so I was close ;d
I was to lazy to go to luascript to check parameters, tried to make it liek here
Code:
	g_game.getSpectators(list, pos, false, true, maxX + Map::maxViewportX, maxX + Map::maxViewportX,
		maxY + Map::maxViewportY, maxY + Map::maxViewportY);
:D

btw multifloor can be useful sometimes
 
Weel, I copied ur script, I have the pos where the arrow should be, and storage value is at the same as yours..

I got this error in console:

PHP:
[20/02/2010 00:17:29] [Error - GlobalEvent Interface] 
[20/02/2010 00:17:29] data/globalevents/scripts/quest.lua:onThink
[20/02/2010 00:17:29] Description: 
[20/02/2010 00:17:29] data/globalevents/scripts/quest.lua:8: attempt to get length of local 'spec' (a nil value)
[20/02/2010 00:17:29] stack traceback:
[20/02/2010 00:17:29] 	data/globalevents/scripts/quest.lua:8: in function <data/globalevents/scripts/quest.lua:6>
[20/02/2010 00:17:29] [Error - GlobalEvents::think] Couldn't execute event: quest
 
Code:
local t = {
	pos = { x = 1000, y = 1000, z = 7 },
	storage = 10000,
	effect = CONST_ME_TUTORIALARROW
}
function onThink(interval, lastExecution, thinkInterval)
	local spec = getSpectators(t.pos, 8, 6, true)
	if spec then
		for i = 1, #spec do
			if isPlayer(spec[i]) and getPlayerStorageValue(spec[i], t.storage) > 0 then
				doSendMagicEffect(t.pos, t.effect, spec[i])
			end
		end
	end
	return true
end
 
i STILL Can't see the arrow..
I have the script in globalevents..

GLOBALEVENTS.XML:

PHP:
<globalevent name="quest" interval="1" event="script" value="quest.lua"/>

SCRIPT:

PHP:
local t = {
	pos = { x = 998, y = 995, z = 6 },
	storage = 10000,
	effect = CONST_ME_TUTORIALARROW
}
function onThink(interval, lastExecution, thinkInterval)
	local spec = getSpectators(t.pos, 8, 6, true)
	if spec then
		for i = 1, #spec do
			if isPlayer(spec[i]) and getPlayerStorageValue(spec[i], t.storage) > 0 then
				doSendMagicEffect(t.pos, t.effect, spec[i])
			end
		end
	end
	return true
end

BTW, could you have this effect on grounds/levers/furnitures? because I'am testing it on a lever xD
 
Back
Top