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

Great Destroy Field Rune

Launian

Tsuki~
Joined
Jul 7, 2008
Messages
34
Reaction score
1
As the tile says, I'd like it very much if someone could point me on the right direction to do something like this. I remember I did it, once, when the latest version of Tibia was 7.9 or something (the latest city was Svargrond :p), and I think the normal destroy field (and the one I made) used actions, not spells. Anyways, I can't seem to figure out how I should go about it, so if any experienced scripter would be so kind as to give me some advice... :D I'm sure God'll pay you with lots of children. I don't really care if it's done as either a spell or an action script. As for the area, something like the GFB area of effect would be nice. Altho, I'm sure I'll be able to change it once someone does the hard part xD

I'm using TFS 0.2.14 Mystic Spirit (9.6). by the way. And well... I guess I'll just wait :D
 
I'm sorry but if you did make it once, you would know the rough way to do it again, then seek help rather than ask fo the full script. The fact you havent tried is why we wont just give you the script. But rather help your attempts. Hinting that you should post your attempt and we will guide you to fix it :)
 
As I said, I did this rune once. Somewhere around 2007. So yeah, not really sure how I did it, anymore.

I said I made it once just so people wouldn't say it's not possible. The problem is, knowing it can be done and knowing how to do it are two different things. But well, since you asked, here're my attempts at it. I didn't bother positing them because they were useless, and everything it amounted to was pasting parts of the polymorph rune (for the area effect) and the destroy field rune (for the effect). Needless to say, it didn't work. If I just pasted the stuff, it'd work as a destroy field rune, and if I changed the parameters (I couldn't think of anything except changing the pos parameter for area), then it'd say something about area being a number value.

Here's the "script", such as it is:

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)

local area = createCombatArea( { {1, 1, 1}, {1, 3, 1}, {1, 1, 1} } )
setCombatArea(combat, area)

local function doRemoveField(cid, area)
	area.stackpos = 254
	local field = getThingfromPos(area)
	local playerPos = getPlayerPosition(cid)

	if(field.uid > 0 and isInArray(FIELDS, field.itemid) == TRUE) then
		doRemoveItem(field.uid)
		doSendMagicEffect(area, CONST_ME_POFF)
		return LUA_NO_ERROR
	end

	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	doSendMagicEffect(playerPos, CONST_ME_POFF)
	return LUA_ERROR
end

function onCastSpell(cid, var)
	local pos = variantToPosition(var)
	if(area.x ~= 0 and area.y ~= 0 and area.z ~= 0) then
		return doRemoveField(cid, area)
	end

	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	return LUA_ERROR
end

Here's the console msg I got when trying to use it:

Code:
[31/08/2012 22:31:43] Lua Script Error: [Spell Interface] 
[31/08/2012 22:31:43] data/spells/scripts/custom/great destroy field.lua:onCastSpell
[31/08/2012 22:31:43] data/spells/scripts/custom/great destroy field.lua:25: attempt to index upvalue 'area' (a number value)
[31/08/2012 22:31:43] stack traceback:
[31/08/2012 22:31:43] 	[C]: in function '__index'
[31/08/2012 22:31:43] 	data/spells/scripts/custom/great destroy field.lua:25: in function <data/spells/scripts/custom/great destroy field.lua:23>

So, yeah. Not sure where to go from here.
 
Back
Top