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

Missing lua functions >.<

nas939

New Member
Joined
Mar 1, 2010
Messages
12
Reaction score
0
Hey guys i was searching through the forums and i came across a cool skill http://otland.net/f82/omnislash-49942/ but im using TFS 0.2.3 mystic spirit so i was hoping if there was any other way to get this cool skill on my server without upgrading such as like adding lua functions to my global.lua ? cause i'm missing just the doCreatureSetNoMove and doComparePositions lua functions >.<
 
Add this into your global.lua:
Code:
doCreatureSetNoMove = mayNotMove

function doComparePositions(position, positionEx)
	return position.x == positionEx.x and position.y == positionEx.y and position.z == positionEx.z
end

Also, the script will have to be modified because 0.2 uses numbers, not booleans.

Edit: You're missing a lot more functions, and some of them are in source which means you won't be able to get this working in Lua.
 
Last edited:
i posted here to dont post another one ._. but ok ill post ill run server and copy the errors and put at least one script ._.
 
damn ...... is there any way i can get it to work? like if i upgrade my server to 0.2.7 ?
That wouldn't be enough.

In fact, you're only missing 2 functions that couldn't be done Lua (at least not practically)
 
Last edited:
you're right i got this

[24/03/2010 13:43:14] Lua Script Error: [Spell Interface]
[24/03/2010 13:43:14] in a timer event called from:
[24/03/2010 13:43:14] data/spells/scripts/custom/omnislash.lua:onCastSpell

[24/03/2010 13:43:14] luaMayNotMove(). Player not found

[24/03/2010 13:43:14] Lua Script Error: [Spell Interface]
[24/03/2010 13:43:14] in a timer event called from:
[24/03/2010 13:43:14] data/spells/scripts/custom/omnislash.lua:onCastSpell

[24/03/2010 13:43:14] data/global.lua:724: attempt to call global 'getDirectionTo' (a nil value)
[24/03/2010 13:43:14] stack traceback:
[24/03/2010 13:43:14] data/global.lua:724: in function 'getOppositeSidePos'
[24/03/2010 13:43:14] data/spells/scripts/custom/omnislash.lua:17: in function <data/spells/scripts/custom/omnislash.lua:6>
 
luaMayNotMove(). Player not found
that's strange
oh, it's probably because you're using booleans, and not numbers.

Edit:
main script:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1.0, 0, 1.0, 0)

function OmnislashStrike(cid,combat,var,times,opos,Target)
	if isCreature(cid) == FALSE then
		doCreatureSetNoMove(Target, FALSE)
		return TRUE
	end
	if isCreature(Target) == FALSE then
		doCreatureSetNoMove(cid, FALSE)
		return TRUE
	end
	doCreatureSetNoMove(Target, TRUE)
	doCreatureSetNoMove(cid, TRUE)
	local newPos = getOppositeSidePos(cid, getThingPos(Target))
	if times == 15 then
		if not doComparePositions(getThingPos(cid), opos) then
			doTeleportThing(cid, opos)
			doSendDistanceShoot(newPos, opos, CONST_ANI_WEAPONTYPE)
		end
		doCreatureSetNoMove(Target, FALSE)
		doCreatureSetNoMove(cid, FALSE)
		return doCombat(cid, combat, var)
	else
		if isWalkable(cid,newPos) and not doComparePositions(newPos, getThingPos(cid)) then
			local fromPos = getThingPos(cid)
			doTeleportThing(cid, newPos)
			doSendDistanceShoot(fromPos, newPos, CONST_ANI_WEAPONTYPE)
		end
		doCombat(cid, combat, var)
		return addEvent(OmnislashStrike, 333, cid, combat, var, times+1, opos, Target)
	end
end

function onCastSpell(cid, var)
	return addEvent(OmnislashStrike, 0, cid, combat, var, 0, getThingPos(cid), getCreatureTarget(cid))
end
global.lua (along with 3 other functions from that thread):
Code:
doCreatureSetNoMove = mayNotMove
doTileQueryAdd = queryTileAddThing

function doComparePositions(position, positionEx)
	return position.x == positionEx.x and position.y == positionEx.y and position.z == positionEx.z
end

function getDirectionTo(pos1, pos2)
	local dir = NORTH
	if(pos1.x > pos2.x) then
		dir = WEST
		if(pos1.y > pos2.y) then
			dir = NORTHWEST
		elseif(pos1.y < pos2.y) then
			dir = SOUTHWEST
		end
	elseif(pos1.x < pos2.x) then
		dir = EAST
		if(pos1.y > pos2.y) then
			dir = NORTHEAST
		elseif(pos1.y < pos2.y) then
			dir = SOUTHEAST
		end
	else
		if(pos1.y > pos2.y) then
			dir = NORTH
		elseif(pos1.y < pos2.y) then
			dir = SOUTH
		end
	end
	return dir
end

function getPosByDir(fromPosition, direction, size)
	local n = size or 1

	local pos = fromPosition
	if(direction == NORTH) then
		pos.y = pos.y - n
	elseif(direction == SOUTH) then
		pos.y = pos.y + n
	elseif(direction == WEST) then
		pos.x = pos.x - n
	elseif(direction == EAST) then
		pos.x = pos.x + n
	elseif(direction == NORTHWEST) then
		pos.y = pos.y - n
		pos.x = pos.x - n
	elseif(direction == NORTHEAST) then
		pos.y = pos.y - n
		pos.x = pos.x + n
	elseif(direction == SOUTHWEST) then
		pos.y = pos.y + n
		pos.x = pos.x - n
	elseif(direction == SOUTHEAST) then
		pos.y = pos.y + n
		pos.x = pos.x + n
	end

	return pos
end
 
Last edited:
well now i got this 0.o sorry for bothering you >.< but i do think maybe u have to rescript isWalkable and getOppositeSidePos from his original thread .... Sorry !!!!

[24/03/2010 23:16:19] Lua Script Error: [Spell Interface]
[24/03/2010 23:16:19] in a timer event called from:
[24/03/2010 23:16:19] data/spells/scripts/custom/omnislash.lua:onCastSpell

[24/03/2010 23:16:19] luaMayNotMove(). Player not found

[24/03/2010 23:16:19] Lua Script Error: [Spell Interface]
[24/03/2010 23:16:19] in a timer event called from:
[24/03/2010 23:16:19] data/spells/scripts/custom/omnislash.lua:onCastSpell

[24/03/2010 23:16:19] data/global.lua:694: attempt to call global 'getThingFromPos' (a nil value)
[24/03/2010 23:16:19] stack traceback:
[24/03/2010 23:16:19] data/global.lua:694: in function 'isWalkable'
[24/03/2010 23:16:19] data/global.lua:727: in function 'getOppositeSidePos'
[24/03/2010 23:16:19] data/spells/scripts/custom/omnislash.lua:16: in function <data/spells/scripts/custom/omnislash.lua:5>
 
cool it works now XD though i dont see the slash effects :p o and i still get errors but everything else works :p

[25/03/2010 00:36:33] Lua Script Error: [Spell Interface]
[25/03/2010 00:36:33] in a timer event called from:
[25/03/2010 00:36:33] data/spells/scripts/custom/omnislash.lua:onCastSpell

[25/03/2010 00:36:33] luaMayNotMove(). Player not found

[25/03/2010 00:36:33] Lua Script Error: [Spell Interface]
[25/03/2010 00:36:33] in a timer event called from:
[25/03/2010 00:36:33] data/spells/scripts/custom/omnislash.lua:onCastSpell

[25/03/2010 00:36:33] luaMayNotMove(). Player not found
 
Back
Top