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

Lua [HELPING] Post here your lua errors for help

Mokerhamer

Retired Global Mod
Senator
Joined
Aug 6, 2007
Messages
1,767
Reaction score
36
Hello,

I'v made this thread because i noticed that many people wont help others with error's so i made this thread so i can help people.

How to report:
1. What the script should do (Important)
2. Post script (Important)
3. Post error (Important)
4. What distro you use. (Important)
4. What do u think it's wrong with it (NOT important)


P.s)
Dont expect me to know everything i can only help you on my own knownlege


Thread that could help with Lua actions (2 post):
http://otland.net/showthread.php?t=571


Yours,
Mokerhamer
 
Last edited by a moderator:
Code:
<movevent event="AddItem" tileitem="1" actionid="3001" script="stone.lua" /> -- 1 komnata
<movevent event="AddItem" tileitem="1" actionid="3002" script="stone.lua" /> -- 2 komnata
<movevent event="AddItem" tileitem="1" actionid="3003" script="stone.lua" /> -- 3 komnata
<movevent event="AddItem" tileitem="1" actionid="3004" script="stone.lua" /> -- 4 komnata
<movevent event="AddItem" tileitem="1" actionid="3005" script="stone.lua" /> -- 5 komnata
<movevent event="AddItem" tileitem="1" actionid="3006" script="stone.lua" /> -- 6 komnata
<movevent event="AddItem" tileitem="1" actionid="3007" script="stone.lua" /> -- 7 komnata
<movevent event="AddItem" tileitem="1" actionid="3008" script="stone.lua" /> -- 8 komnata
<movevent event="AddItem" tileitem="1" actionid="3009" script="stone.lua" /> -- 9 komnata
<movevent event="AddItem" tileitem="1" actionid="3010" script="stone.lua" /> -- 10 komnata
<movevent event="StepIn" actionid="2004" script="stone.lua" /> -- wejscie
<movevent event="StepIn" actionid="2005" script="stone.lua" /> -- 1 komnata
<movevent event="StepIn" actionid="2006" script="stone.lua" /> -- 2 komnata
<movevent event="StepIn" actionid="2007" script="stone.lua" /> -- 3 komnata
<movevent event="StepIn" actionid="2008" script="stone.lua" /> -- 4 komnata
<movevent event="StepIn" actionid="2009" script="stone.lua" /> -- 5 komnata
<movevent event="StepIn" actionid="2010" script="stone.lua" /> -- 6 komnata
<movevent event="StepIn" actionid="2011" script="stone.lua" /> -- 7 komnata
<movevent event="StepIn" actionid="2012" script="stone.lua" /> -- 8 komnata
<movevent event="StepIn" actionid="2013" script="stone.lua" /> -- 9 komnata
<movevent event="StepIn" actionid="2014" script="stone.lua" /> -- 10 komnata

First is checking monster when dying and action tile on arena rooms.
Second is action id of tile under teleport!

Now script:
Code:
-- Svargrond Arena by Szuwar 
-- Thanks to Noxitu for help

local stone1pos = {x=585,y=742,z=7,stackpos=1}
local stone2pos = {x=568,y=742,z=7,stackpos=1}
local stone3pos = {x=551,y=742,z=7,stackpos=1}
local stone4pos = {x=534,y=742,z=7,stackpos=1}
local stone5pos = {x=543,y=727,z=7,stackpos=1}
local stone6pos = {x=560,y=727,z=7,stackpos=1}
local stone7pos = {x=577,y=727,z=7,stackpos=1}
local stone8pos = {x=569,y=712,z=7,stackpos=1}
local stone9pos = {x=552,y=712,z=7,stackpos=1}
local stone10pos = {x=561,y=697,z=7,stackpos=1}

function onStepIn(cid, item, pos)

local function doCheckLvl(cid, storage)
	if getPlayerStorageValue(cid, storage) == 1 then -- Greenhorn
		monsters = {"Frostfur", "Bloodpaw", "Bovinus", "Achad", "The Hairy One", "Colerian The Barbarian", "Axeitus Headbanger", "Rocky", "Cursed Gladiator", "Orcus The Cruel"} 
	elseif getPlayerStorageValue(cid, storage) == 2 then -- Scrapper
		monsters = {"Avalanche", "Kreebosh the Exile", "The Dark Dancer", "The Hag",  "Slim", "Grimgor Guteater", "Drasilla", "Spirit of Earth", "Spirit of Water", "Spirit of Fire"} 
	elseif getPlayerStorageValue(cid, storage) == 3 then -- Warlord
		monsters = {"Webster", "Darakan the Executioner", "Norgle Glacierbeard", "The Pit Lord", "Svoren the Mad", "The Masked Marauder", "Gnorre Chyllson", "Fallen Mooh'tah Master Ghar", "Deathbringer", "The Obliverator"}
	end
end

local function doChange(cid, pos, creature, tpos)
	local stone = getThingfromPos(pos)
	doSetItemActionId(stone.uid,6000)
	doTeleportThing(cid,tpos)
	doSendMagicEffect(pos,10)
	local pos = getThingPos(stone.uid)
	monster = doSummonCreature(creature, pos)
	doSendAnimatedText(tpos,"Fight!",198)
end

local function doCheckStone(stonepos)
	local stone = getThingfromPos(stonepos)
	if stone.actionid ~= 6000 and stone.itemid == 1354 then
		return 0
	elseif stone.actionid == 6000 or stone.itemid ~= 1354 then
		return 1
	end
end

local function roomBusy(cid, pos)
	pos.x = pos.x + 1 
	doTeleportThing(cid, pos)
	doPlayerSendTextMessage(cid, 22, "Somebody is before you in next room. Please wait.")
end
	doCheckLvl(cid, 5029)
	if item.actionid == 2004 and doCheckStone(stone1pos) == 0 then
		local npos = {x=590,y=745,z=7}
		doChange(cid, stone1pos, monsters[1], npos)
	elseif item.actionid == 2005 and doCheckStone(stone2pos) == 0 then
		local npos = {x=572,y=745,z=7}
		doChange(cid, stone2pos, monsters[2], npos)
		doCreateItem(1354,1,stone1pos)
	elseif item.actionid == 2006 and doCheckStone(stone3pos) == 0 then
		local npos = {x=555,y=745,z=7}
		doChange(cid, stone3pos, monsters[3], npos)
		doCreateItem(1354,1,stone2pos)
	elseif item.actionid == 2007 and doCheckStone(stone4pos) == 0 then
		local npos = {x=538,y=745,z=7}
		doChange(cid, stone4pos, monsters[4], npos)
		doCreateItem(1354,1,stone3pos)
	elseif item.actionid == 2008 and doCheckStone(stone5pos) == 0 then
		local npos = {x=546,y=730,z=7}
		doChange(cid, stone5pos, monsters[5], npos)
		doCreateItem(1354,1,stone4pos)
	elseif item.actionid == 2009 and doCheckStone(stone6pos) == 0 then
		local npos = {x=564,y=730,z=7}
		doChange(cid, stone6pos, monsters[6], npos)
		doCreateItem(1354,1,stone5pos)
	elseif item.actionid == 2010 and doCheckStone(stone7pos) == 0 then
		local npos = {x=580,y=730,z=7}
		doChange(cid, stone7pos, monsters[7], npos)
		doCreateItem(1354,1,stone6pos)
	elseif item.actionid == 2011 and doCheckStone(stone8pos) == 0 then
		local npos = {x=573,y=715,z=7}
		doChange(cid, stone8pos, monsters[8], npos)
		doCreateItem(1354,1,stone7pos)
	elseif item.actionid == 2012 and doCheckStone(stone9pos) == 0 then
		local npos = {x=555,y=715,z=7}
		doChange(cid, stone9pos, monsters[9], npos)
		doCreateItem(1354,1,stone8pos)
	elseif item.actionid == 2013 and doCheckStone(stone10pos) == 0 then
		local npos = {x=565,y=700,z=7}
		doChange(cid, stone10pos, monsters[10], npos)
		doCreateItem(1354,1,stone9pos)
	elseif item.actionid == 2014 then
		doCreateItem(1354,1,stone10pos)
		local npos = {x=605,y=726,z=6}
		doTeleportThing(cid, npos)
		doSendMagicEffect(npos,10)

	elseif doCheckStone(stone10pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone9pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone8pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone7pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone6pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone5pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone4pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone3pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone2pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone1pos) == 1 then
		roomBusy(cid, pos)
	end
end

function onAddItem(moveitem, tileitem, pos)

local function doCheckBody(moveitem, stonepos, monster)

	local stone = getThingfromPos(stonepos)
	if moveitem.itemid == 7349 and stone.itemid ~= 0  then
		doRemoveItem(stone.uid,1)
		doRemoveItem(moveitem.uid,1)
		doSendMagicEffect(stonepos,2)
	elseif moveitem.itemid == 3058 or moveitem.itemid == 3065 then
		doRemoveItem(moveitem.uid,1)
		local pos = getThingPos(monster)
		doCreatureAddHealth(monster,-10000)
		doCreateItem(1354,1,stonepos)
		doSetItemActionId(stone.uid,5999)
	end
end

	if tileitem.actionid == 3001 then 
		doCheckBody(moveitem, stone1pos, monster)
	elseif tileitem.actionid == 3002 then
		doCheckBody(moveitem, stone2pos, monster)
	elseif tileitem.actionid == 3003 then
		doCheckBody(moveitem, stone3pos, monster)
	elseif tileitem.actionid == 3004 then
		doCheckBody(moveitem, stone4pos, monster)
	elseif tileitem.actionid == 3005 then
		doCheckBody(moveitem, stone5pos, monster)
	elseif tileitem.actionid == 3006 then
		doCheckBody(moveitem, stone6pos, monster)
	elseif tileitem.actionid == 3007 then
		doCheckBody(moveitem, stone7pos, monster)
	elseif tileitem.actionid == 3008 then
		doCheckBody(moveitem, stone8pos, monster)
	elseif tileitem.actionid == 3009 then
		doCheckBody(moveitem, stone9pos, monster)
	elseif tileitem.actionid == 3010 then
		doCheckBody(moveitem, stone10pos, monster)
	end
end


Help? :p:thumbup:
 
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/stone.lua:eek:nStepIn

data/movements/scripts/stone.lua:57: attempt to index global 'monsters' (a nil value)


:57: no of line is function is doChange, and there is 10x this function
 
Hey!

Lua Script Error: [MoveEvents Interface]
data/movements/scripts/stone.lua:eek:nStepIn

data/movements/scripts/stone.lua:57: attempt to index global 'monsters' (a nil value)


:57: no of line is function is doChange, and there is 10x this function

Do you use forgotten server? :)
 
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/stone.lua:eek:nStepIn

data/movements/scripts/stone.lua:57: attempt to index global 'monsters' (a nil value)


:57: no of line is function is doChange, and there is 10x this function

Try this

stone.lua
Code:
-- Svargrond Arena by Szuwar 
-- Thanks to Noxitu for help

local stone1pos = {x=228,y=185,z=7,stackpos=1}
local stone2pos = {x=214,y=185,z=7,stackpos=1}
local stone3pos = {x=200,y=185,z=7,stackpos=1}
local stone4pos = {x=186,y=185,z=7,stackpos=1}
local stone5pos = {x=220,y=173,z=7,stackpos=1}
local stone6pos = {x=206,y=173,z=7,stackpos=1}
local stone7pos = {x=192,y=173,z=7,stackpos=1}
local stone8pos = {x=214,y=161,z=7,stackpos=1}
local stone9pos = {x=198,y=161,z=7,stackpos=1}
local stone10pos = {x=207,y=148,z=7,stackpos=1}

function onStepIn(cid, item, pos)

local function doCheckLvl(cid, storage)

	if getPlayerStorageValue(cid, storage) == 1 then
		monsters = {"Rat", "Wolf", "Bug", "Troll", "Orc", "Minotaur", "Rotworm", "Elf", "Ghoul", "Minotaur Mage"} 
	elseif getPlayerStorageValue(cid, storage) == 2 then
		monsters = {"Monk", "Orc Leader", "Dark Monk", "Vampire",  "Slime", "Orc Warlord", "Dragon", "Mummy", "Demon Skeleton", "Dragon Lord"} 
	elseif getPlayerStorageValue(cid, storage) == 3 then
		monsters = {"Dragon", "Wyvern", "Hydra", "Behemoth", "Thalas", "Evil Eye", "Demon", "Juggernaut", "Orshabaal", "Ferumbras"}
	end
end

local function doChange(cid, pos, creature, tpos)
	local stone = getThingfromPos(pos)
	doSetItemActionId(stone.uid,6000)
	doTeleportThing(cid,tpos)
	doSendMagicEffect(pos,10)
	local pos = getThingPos(stone.uid)
	monster = doSummonCreature(creature, pos)
	doSendAnimatedText(tpos,"Fight!",198)
end

local function doCheckStone(stonepos)
	local stone = getThingfromPos(stonepos)
	if stone.actionid ~= 6000 and stone.itemid == 1354 then
		return 0
	elseif stone.actionid == 6000 or stone.itemid ~= 1354 then
		return 1
	end
end

local function roomBusy(cid, pos)
	pos.y = pos.y + 1 
	doTeleportThing(cid, pos)
	doPlayerSendTextMessage(cid, 22, "Stand in the line!")
end
	doCheckLvl(cid, 5029)
	if item.actionid == 2004 and doCheckStone(stone1pos) == 0 then
		local npos = {x=233,y=185,z=7}
		doChange(cid, stone1pos, monsters[1], npos)
	elseif item.actionid == 2005 and doCheckStone(stone2pos) == 0 then
		local npos = {x=220,y=185,z=7}
		doChange(cid, stone2pos, monsters[2], npos)
		doCreateItem(1354,1,stone1pos)
	elseif item.actionid == 2006 and doCheckStone(stone3pos) == 0 then
		local npos = {x=205,y=185,z=7}
		doChange(cid, stone3pos, monsters[3], npos)
		doCreateItem(1354,1,stone2pos)
	elseif item.actionid == 2007 and doCheckStone(stone4pos) == 0 then
		local npos = {x=191,y=185,z=7}
		doChange(cid, stone4pos, monsters[4], npos)
		doCreateItem(1354,1,stone3pos)
	elseif item.actionid == 2008 and doCheckStone(stone5pos) == 0 then
		local npos = {x=225,y=173,z=7}
		doChange(cid, stone5pos, monsters[5], npos)
		doCreateItem(1354,1,stone4pos)
	elseif item.actionid == 2009 and doCheckStone(stone6pos) == 0 then
		local npos = {x=212,y=174,z=7}
		doChange(cid, stone6pos, monsters[6], npos)
		doCreateItem(1354,1,stone5pos)
	elseif item.actionid == 2010 and doCheckStone(stone7pos) == 0 then
		local npos = {x=197,y=174,z=7}
		doChange(cid, stone7pos, monsters[7], npos)
		doCreateItem(1354,1,stone6pos)
	elseif item.actionid == 2011 and doCheckStone(stone8pos) == 0 then
		local npos = {x=219,y=161,z=7}
		doChange(cid, stone8pos, monsters[8], npos)
		doCreateItem(1354,1,stone7pos)
	elseif item.actionid == 2012 and doCheckStone(stone9pos) == 0 then
		local npos = {x=203,y=162,z=7}
		doChange(cid, stone9pos, monsters[9], npos)
		doCreateItem(1354,1,stone8pos)
	elseif item.actionid == 2013 and doCheckStone(stone10pos) == 0 then
		local npos = {x=212,y=149,z=7}
		doChange(cid, stone10pos, monsters[10], npos)
		doCreateItem(1354,1,stone9pos)
	elseif item.actionid == 2014 then
		doCreateItem(1354,1,stone10pos)
		local npos = {x=245,y=168,z=6}
		doTeleportThing(cid, npos)
		doSendMagicEffect(npos,10)

	elseif doCheckStone(stone10pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone9pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone8pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone7pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone6pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone5pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone4pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone3pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone2pos) == 1 then
		roomBusy(cid, pos)
	elseif doCheckStone(stone1pos) == 1 then
		roomBusy(cid, pos)
	end
end

function onAddItem(moveitem, tileitem, pos)

local function doCheckBody(moveitem, stonepos, monster)

	local stone = getThingfromPos(stonepos)
	if moveitem.itemid == 6324 and stone.itemid ~= 0  then
		doRemoveItem(stone.uid,1)
		doRemoveItem(moveitem.uid,1)
		doSendMagicEffect(stonepos,2)
	elseif moveitem.itemid == 3058 or moveitem.itemid == 3065 then
		doRemoveItem(moveitem.uid,1)
		local pos = getThingPos(monster)
		doCreatureAddHealth(monster,-10000)
		doCreateItem(1354,1,stonepos)
		doSetItemActionId(stone.uid,5999)
	end
end

	if tileitem.actionid == 3001 then 
		doCheckBody(moveitem, stone1pos, monster)
	elseif tileitem.actionid == 3002 then
		doCheckBody(moveitem, stone2pos, monster)
	elseif tileitem.actionid == 3003 then
		doCheckBody(moveitem, stone3pos, monster)
	elseif tileitem.actionid == 3004 then
		doCheckBody(moveitem, stone4pos, monster)
	elseif tileitem.actionid == 3005 then
		doCheckBody(moveitem, stone5pos, monster)
	elseif tileitem.actionid == 3006 then
		doCheckBody(moveitem, stone6pos, monster)
	elseif tileitem.actionid == 3007 then
		doCheckBody(moveitem, stone7pos, monster)
	elseif tileitem.actionid == 3008 then
		doCheckBody(moveitem, stone8pos, monster)
	elseif tileitem.actionid == 3009 then
		doCheckBody(moveitem, stone9pos, monster)
	elseif tileitem.actionid == 3010 then
		doCheckBody(moveitem, stone10pos, monster)
	end
end
 
Ye TFS rox ;p

Edit
@up
What did you change? Monster names? Dont work...And i ddont need normal monsters in my Arena...i have made all arena bosses..
 
Last edited:
Code:
local combat = createCombatObject()
local condition = createConditionObject(CONDITION_DROWN)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 20, 2000, -10)
setCombatCondition(combat, condition)

function onSay(cid, words, param)
sexProposal = getPlayerStorageValue(cid, 66600)
sexAccept = cid
noCondom = math.random(4)
aidsEffect = math.random(3)

	local playerPos = getCreaturePosition(cid)
	if getPlayerLookDir(cid) == 1 then 
		posDir = {x = playerPos.x + 1, y = playerPos.y, z = playerPos.z, stackpos = 253}
	elseif getPlayerLookDir(cid) == 2 then
		posDir = {x = playerPos.x, y = playerPos.y + 1, z = playerPos.z, stackpos = 253}
	elseif getPlayerLookDir(cid) == 3 then
		posDir = {x = playerPos.x - 1, y = playerPos.y, z = playerPos.z, stackpos = 253}
	else
		posDir = {x = playerPos.x, y = playerPos.y - 1, z = playerPos.z, stackpos = 253}
	end
	target = getThingfromPos(posDir)
	if isPlayer(target.uid) == TRUE then
		if getPlayerLookDir(target.uid) == getPlayerLookDir(cid)-2 then
			sameLookDir = TRUE
		elseif getPlayerLookDir(target.uid) == getPlayerLookDir(cid)+2 then
			sameLookDir = TRUE
		else
			sameLookDir = FALSE
		end
		if sameLookDir == TRUE then
			if getPlayerSex(target.uid) == getPlayerSex(cid) then
				doPlayerSendCancel(cid, 'You cannot make sex with same gender as self, pervert!')
				doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
			else
				if getPlayerGroupId(cid) > 3 and getPlayerGroupId(cid) >= getPlayerGroupId(target.uid) then
					sexProposal = cid
					sexAccept = target.uid
					allowSex = TRUE
				elseif target.uid == sexProposal then
					allowSex = TRUE
				else
					allowSex = FALSE
				end
				if allowSex == TRUE then
					if getPlayerStorageValue(sexProposal, 66660) > 0 or getPlayerStorageValue(sexAccept, 66660) > 0 then
						doSendAnimatedText(getCreaturePosition(sexProposal), 'Ahh, Ahh...', TEXTCOLOR_YELLOW)
						doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_STUN)
						doSendAnimatedText(getThingPos(sexAccept), 'Ohh, Ohh!', TEXTCOLOR_TEAL)
						doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_STUN)
						setPlayerStorageValue(sexProposal, 66660, 0)
						setPlayerStorageValue(sexAccept, 66660, 0)
					else
						if noCondom == 3 then
							hurtMessage = 'Sex without condoms brings consequences - You just got AIDS!\nYour sickness will hurt alot...'
							partnerMessage = 'Sex without condoms brings consequences - Your partner just got AIDS!'
							bothMessage = 'Sex without condoms brings consequences - You and Your partner just got AIDS!\nYour sickness will hurt alot...'
							if aidsEffect == 1 then
								proposalMessage = hurtMessage
								acceptMessage = partnerMessage
								hurtPlayer = sexProposal
							elseif aidsEffect == 2 then
								proposalMessage = partnerMessage
								acceptMessage = hurtMessage
								hurtPlayer = sexAccept
							else
								proposalMessage = bothMessage
								acceptMessage = bothMessage
								hurtPlayer = FALSE
							end
							doPlayerSendTextMessage(sexProposal, MESSAGE_STATUS_WARNING, proposalMessage)
							doPlayerSendTextMessage(sexAccept, MESSAGE_STATUS_WARNING, acceptMessage)
							if hurtPlayer == FALSE then
								doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_YELLOW_RINGS)
								doCombat(0,combat,numberToVariant(sexProposal))
								doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_YELLOW_RINGS)
								doCombat(0,combat,numberToVariant(sexAccept))
							else
								doSendMagicEffect(getPlayerPosition(hurtPlayer),CONST_ME_YELLOW_RINGS)
								doCombat(0,combat,numberToVariant(hurtPlayer))
							end
						elseif noCondom == 2 then
							payMessage = '\nAs a good parent You spend whole Your gold for the child.'
							if getPlayerSex(sexProposal) == 0 then
								childMother = sexProposal
								childFather = sexAccept
								motherMsg = payMessage
								fatherMsg = ""
							elseif getPlayerSex(sexProposal) == 1 then
								childMother = sexAccept
								childFather = sexProposal
								motherMsg = ""
								fatherMsg = payMessage
							else
								if getPlayerSex(sexAccept) == 0 then
									childMother = sexAccept
									childFather = sexProposal
									motherMsg = ""
									fatherMsg = payMessage
								else
									childMother = sexProposal
									childFather = sexAccept
									motherMsg = payMessage
									fatherMsg = ""
								end
							end
							doPlayerSendTextMessage(childFather, MESSAGE_STATUS_WARNING, 'Sex without condoms brings consequences - '..getCreatureName(childMother)..' just born a child!' .. fatherMsg)
							doPlayerSendTextMessage(childMother, MESSAGE_STATUS_WARNING, 'Sex without condoms brings consequences - You have just born a child!' .. motherMsg)
							doSendMagicEffect(getPlayerPosition(childFather), CONST_ME_FIREWORK_YELLOW)
							doSendMagicEffect(getPlayerPosition(childMother), CONST_ME_FIREWORK_RED)
							if math.random(2) == 1 then
								childGender = "son"
							else
								childGender = "daughter"
							end
							doSetItemSpecialDescription(doPlayerAddItem(childMother,6579,1),'It is a '..childGender..' of '..getCreatureName(childFather)..' and '..getCreatureName(childMother)..'.')
							local gps = getPlayerItemCount(sexProposal, ITEM_GOLD)
							local pcs = getPlayerItemCount(sexProposal, ITEM_PLATINUM)
							local ccs = getPlayerItemCount(sexProposal, ITEM_CRYSTAL)
							if gps > 0 or pcs > 0 or ccs > 0 then
								doPlayerRemoveItem(sexProposal, ITEM_GOLD, gps)
								doPlayerRemoveItem(sexProposal, ITEM_PLATINUM, pcs)
								doPlayerRemoveItem(sexProposal, ITEM_CRYSTAL, ccs)
							end
						else
							doSendAnimatedText(getCreaturePosition(sexProposal), 'Ahh, Ahh...', TEXTCOLOR_YELLOW)
							doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_STUN)
							doSendAnimatedText(getThingPos(sexAccept), 'Ohh, Ohh!', TEXTCOLOR_TEAL)
							doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_STUN)
						end
					end
					setPlayerStorageValue(sexProposal, 66600, 0)
					setPlayerStorageValue(sexAccept, 66600, 0)
				else
					if getPlayerStorageValue(target.uid, 66600) == cid then
						doPlayerSendCancel(cid, 'You have already sent a sex proposal to '..getCreatureName(target.uid)..'.')
						doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
					else
						setPlayerStorageValue(target.uid, 66600, cid)
						doPlayerSendTextMessage(cid, 22, 'You have sent a sex proposal to '..getCreatureName(target.uid)..'.')
						doPlayerSendTextMessage(target.uid, 22, getCreatureName(cid)..' wants to have a sex with You.')
						doSendMagicEffect(getPlayerPosition(target.uid),CONST_ME_HEARTS)
					end
				end
			end
		else
			doPlayerSendCancel(cid, 'You must stand after your partner to do sex.')
			doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
		end
	else
		doPlayerSendCancel(cid, 'You may do sex only with players.')
		doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
	end
	doPlayerSendTextMessage(cid, 25, words)
	return FALSE
end

My Advanced sex system is not working.

I get this error when i type !sex.

Lua Script Error: [TalkAction Interface]

data/talkactions/scripts/sex.lua:eek:nSay

data/talkactios/scripts/sex.lua:37: attempt to call global 'getPlayerGroupId' (a nil value)

Please help me :)
 
Code:
local combat = createCombatObject()
local condition = createConditionObject(CONDITION_DROWN)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 20, 2000, -10)
setCombatCondition(combat, condition)

function onSay(cid, words, param)
sexProposal = getPlayerStorageValue(cid, 66600)
sexAccept = cid
noCondom = math.random(4)
aidsEffect = math.random(3)

    local playerPos = getCreaturePosition(cid)
    if getPlayerLookDir(cid) == 1 then 
        posDir = {x = playerPos.x + 1, y = playerPos.y, z = playerPos.z, stackpos = 253}
    elseif getPlayerLookDir(cid) == 2 then
        posDir = {x = playerPos.x, y = playerPos.y + 1, z = playerPos.z, stackpos = 253}
    elseif getPlayerLookDir(cid) == 3 then
        posDir = {x = playerPos.x - 1, y = playerPos.y, z = playerPos.z, stackpos = 253}
    else
        posDir = {x = playerPos.x, y = playerPos.y - 1, z = playerPos.z, stackpos = 253}
    end
    target = getThingfromPos(posDir)
    if isPlayer(target.uid) == TRUE then
        if getPlayerLookDir(target.uid) == getPlayerLookDir(cid)-2 then
            sameLookDir = TRUE
        elseif getPlayerLookDir(target.uid) == getPlayerLookDir(cid)+2 then
            sameLookDir = TRUE
        else
            sameLookDir = FALSE
        end
        if sameLookDir == TRUE then
            if getPlayerSex(target.uid) == getPlayerSex(cid) then
                doPlayerSendCancel(cid, 'You cannot make sex with same gender as self, pervert!')
                doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
            else
                if getPlayerGroupId(cid) > 3 and getPlayerGroupId(cid) >= getPlayerGroupId(target.uid) then
                    sexProposal = cid
                    sexAccept = target.uid
                    allowSex = TRUE
                elseif target.uid == sexProposal then
                    allowSex = TRUE
                else
                    allowSex = FALSE
                end
                if allowSex == TRUE then
                    if getPlayerStorageValue(sexProposal, 66660) > 0 or getPlayerStorageValue(sexAccept, 66660) > 0 then
                        doSendAnimatedText(getCreaturePosition(sexProposal), 'Ahh, Ahh...', TEXTCOLOR_YELLOW)
                        doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_STUN)
                        doSendAnimatedText(getThingPos(sexAccept), 'Ohh, Ohh!', TEXTCOLOR_TEAL)
                        doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_STUN)
                        setPlayerStorageValue(sexProposal, 66660, 0)
                        setPlayerStorageValue(sexAccept, 66660, 0)
                    else
                        if noCondom == 3 then
                            hurtMessage = 'Sex without condoms brings consequences - You just got AIDS!\nYour sickness will hurt alot...'
                            partnerMessage = 'Sex without condoms brings consequences - Your partner just got AIDS!'
                            bothMessage = 'Sex without condoms brings consequences - You and Your partner just got AIDS!\nYour sickness will hurt alot...'
                            if aidsEffect == 1 then
                                proposalMessage = hurtMessage
                                acceptMessage = partnerMessage
                                hurtPlayer = sexProposal
                            elseif aidsEffect == 2 then
                                proposalMessage = partnerMessage
                                acceptMessage = hurtMessage
                                hurtPlayer = sexAccept
                            else
                                proposalMessage = bothMessage
                                acceptMessage = bothMessage
                                hurtPlayer = FALSE
                            end
                            doPlayerSendTextMessage(sexProposal, MESSAGE_STATUS_WARNING, proposalMessage)
                            doPlayerSendTextMessage(sexAccept, MESSAGE_STATUS_WARNING, acceptMessage)
                            if hurtPlayer == FALSE then
                                doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_YELLOW_RINGS)
                                doCombat(0,combat,numberToVariant(sexProposal))
                                doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_YELLOW_RINGS)
                                doCombat(0,combat,numberToVariant(sexAccept))
                            else
                                doSendMagicEffect(getPlayerPosition(hurtPlayer),CONST_ME_YELLOW_RINGS)
                                doCombat(0,combat,numberToVariant(hurtPlayer))
                            end
                        elseif noCondom == 2 then
                            payMessage = '\nAs a good parent You spend whole Your gold for the child.'
                            if getPlayerSex(sexProposal) == 0 then
                                childMother = sexProposal
                                childFather = sexAccept
                                motherMsg = payMessage
                                fatherMsg = ""
                            elseif getPlayerSex(sexProposal) == 1 then
                                childMother = sexAccept
                                childFather = sexProposal
                                motherMsg = ""
                                fatherMsg = payMessage
                            else
                                if getPlayerSex(sexAccept) == 0 then
                                    childMother = sexAccept
                                    childFather = sexProposal
                                    motherMsg = ""
                                    fatherMsg = payMessage
                                else
                                    childMother = sexProposal
                                    childFather = sexAccept
                                    motherMsg = payMessage
                                    fatherMsg = ""
                                end
                            end
                            doPlayerSendTextMessage(childFather, MESSAGE_STATUS_WARNING, 'Sex without condoms brings consequences - '..getCreatureName(childMother)..' just born a child!' .. fatherMsg)
                            doPlayerSendTextMessage(childMother, MESSAGE_STATUS_WARNING, 'Sex without condoms brings consequences - You have just born a child!' .. motherMsg)
                            doSendMagicEffect(getPlayerPosition(childFather), CONST_ME_FIREWORK_YELLOW)
                            doSendMagicEffect(getPlayerPosition(childMother), CONST_ME_FIREWORK_RED)
                            if math.random(2) == 1 then
                                childGender = "son"
                            else
                                childGender = "daughter"
                            end
                            doSetItemSpecialDescription(doPlayerAddItem(childMother,6579,1),'It is a '..childGender..' of '..getCreatureName(childFather)..' and '..getCreatureName(childMother)..'.')
                            local gps = getPlayerItemCount(sexProposal, ITEM_GOLD)
                            local pcs = getPlayerItemCount(sexProposal, ITEM_PLATINUM)
                            local ccs = getPlayerItemCount(sexProposal, ITEM_CRYSTAL)
                            if gps > 0 or pcs > 0 or ccs > 0 then
                                doPlayerRemoveItem(sexProposal, ITEM_GOLD, gps)
                                doPlayerRemoveItem(sexProposal, ITEM_PLATINUM, pcs)
                                doPlayerRemoveItem(sexProposal, ITEM_CRYSTAL, ccs)
                            end
                        else
                            doSendAnimatedText(getCreaturePosition(sexProposal), 'Ahh, Ahh...', TEXTCOLOR_YELLOW)
                            doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_STUN)
                            doSendAnimatedText(getThingPos(sexAccept), 'Ohh, Ohh!', TEXTCOLOR_TEAL)
                            doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_STUN)
                        end
                    end
                    setPlayerStorageValue(sexProposal, 66600, 0)
                    setPlayerStorageValue(sexAccept, 66600, 0)
                else
                    if getPlayerStorageValue(target.uid, 66600) == cid then
                        doPlayerSendCancel(cid, 'You have already sent a sex proposal to '..getCreatureName(target.uid)..'.')
                        doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
                    else
                        setPlayerStorageValue(target.uid, 66600, cid)
                        doPlayerSendTextMessage(cid, 22, 'You have sent a sex proposal to '..getCreatureName(target.uid)..'.')
                        doPlayerSendTextMessage(target.uid, 22, getCreatureName(cid)..' wants to have a sex with You.')
                        doSendMagicEffect(getPlayerPosition(target.uid),CONST_ME_HEARTS)
                    end
                end
            end
        else
            doPlayerSendCancel(cid, 'You must stand after your partner to do sex.')
            doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
        end
    else
        doPlayerSendCancel(cid, 'You may do sex only with players.')
        doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
    end
    doPlayerSendTextMessage(cid, 25, words)
    return FALSE
end
My Advanced sex system is not working.

I get this error when i type !sex.

Lua Script Error: [TalkAction Interface]

data/talkactions/scripts/sex.lua:eek:nSay

data/talkactios/scripts/sex.lua:37: attempt to call global 'getPlayerGroupId' (a nil value)

Please help me :)

What distro do you use?
 
data/spells/custom/death star.lua

(You launch this spell at a player or a monster, and it will jump to that monster and deal damage, if there is any other players/monsters within 5 sqm radius, it will jump over to that after 0.2 sec, then to next, then to next, after this configurations, it jumps at the speed of 0.2 sec, and may jump up to 10 times.

death star.lua
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, TRUE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_NONE)
 
local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 50000)
setCombatCondition(combat, condition)
 
function getSpellDamage(cid, weaponSkill, weaponAttack, attackStrength)
local attack = 20
local skill = getPlayerMagLevel(cid)
local maxWeaponDamage = (skill * attack) / 20 + attack
local damage = -((math.random(50, maxWeaponDamage) * attackStrength) / 80) * 2.5
 
return damage, damage
end
 
function sonichoming(param)
if isCreature(param.cid) == TRUE and param.crc == 1 then
for abs = param.nxp, param.pxp do
for coo = param.nyp, param.pyp do
local pretile = {x = abs, y = coo, z = param.nzp, stackpos = 255}
local thing = getThingfromPos(pretile)
if isCreature(thing.uid) == TRUE and thing.uid ~= param.cid then
 
crcb = 1
jumps = jumps + 1
 
local radius = param.radius
local nodea = getCreaturePosition(param.cid)
local nodeb = getCreaturePosition(thing.uid)
 
local nha = {x = nodeb.x, y = nodeb.y - 2, z = nodeb.z, stackpos = 255}
local sha = {x = nodeb.x, y = nodeb.y + 2, z = nodeb.z, stackpos = 255}
local wha = {x = nodeb.x - 2, y = nodeb.y, z = nodeb.z, stackpos = 255}
local eha = {x = nodeb.x + 2, y = nodeb.y, z = nodeb.z, stackpos = 255}
 
doTeleportThing(param.cid, nodeb, FALSE)
 
doSendMagicEffect(nodea, CONST_ME_GROUNDSHAKER)
doSendMagicEffect(nodea, CONST_ME_POFF)
doSendDistanceShoot(nodea, nodeb, CONST_ANI_ENERGYBALL)
doSendMagicEffect(nodeb, CONST_ME_STUN)
doSendDistanceShoot(nodeb, eha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, wha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, sha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, nha, CONST_ANI_ENERGY)
doSendMagicEffect(eha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(wha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(sha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(nha, CONST_ME_PURPLEENERGY)
 
var = numberToVariant(thing.uid)
 
doCombat(param.cid, param.combat, var)
break
end
end
if crcb == 1 then
break
end
end
if crcb == 1 and limit > 0 and jumps < limit then
crcb = 0
addEvent(sonichoming, param.tbj, param)
end
if crcb == 1 and limit == 0 then
crcb = 0
addEvent(sonichoming, param.tbj, param)
end
end
end
 
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getSpellDamage")
 
function onCastSpell(cid, var)
 
-- >>> Small config --
 
local radius = 5 -- Quite self explanatory --
limit = 10 -- Limit of homing jumps, 0 = Unlimited --
local tbj = 200 -- Time between jumps in miliseconds --
 
-- Small config <<< --
 
local nodea = getCreaturePosition(cid)
local nodeb = getCreaturePosition(variantToNumber(var))
 
local nha = {x = nodeb.x, y = nodeb.y - 2, z = nodeb.z, stackpos = 255}
local sha = {x = nodeb.x, y = nodeb.y + 2, z = nodeb.z, stackpos = 255}
local wha = {x = nodeb.x - 2, y = nodeb.y, z = nodeb.z, stackpos = 255}
local eha = {x = nodeb.x + 2, y = nodeb.y, z = nodeb.z, stackpos = 255}
 
doTeleportThing(cid, nodeb, FALSE)
 
doSendMagicEffect(nodea, CONST_ME_GROUNDSHAKER)
doSendMagicEffect(nodea, CONST_ME_POFF)
doSendDistanceShoot(nodea, nodeb, CONST_ANI_ENERGYBALL)
doSendMagicEffect(nodeb, CONST_ME_STUN)
doSendDistanceShoot(nodeb, eha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, wha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, sha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, nha, CONST_ANI_ENERGY)
doSendMagicEffect(eha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(wha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(sha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(nha, CONST_ME_PURPLEENERGY)
 
jumps = 1
 
doCombat(cid, combat, var)
 
param = { cid = cid, var = var, combat = combat, nxp = nodeb.x - radius, pxp = nodeb.x + radius, nyp = nodeb.y - radius, pyp = nodeb.y + radius, radius = radius, nzp = nodeb.z, crc = 1, tbj = tbj}
 
addEvent(sonichoming, tbj, param)
end

The problem with this script, once you execute the script at a dude close depot, and there is a player who is within pz zone (inside depot), you will still jump over to the dude whos inside pz. This can be abused heavily, for depot killing, and bugging your char safety.

Code:
[19/07/2008  21:51:26] TFS - Znote Edition - Version 0.2rc13 (Mystic Spirit).
[19/07/2008  21:51:26] A server developed by  TFS Group & Clary, Jester & Znote.
[19/07/2008  21:51:26] Visit our forum for updates, support and resources: http://otland.net/.
The server ain't much modifyed, fixed so when executing spells it will appear the spellname in orange colours, also fixed an "Erroron:accept 100 listed errors" bug which was a common problem before.
Also fixed so you don't need premy to buy houses and such things, mostly modifyed by Clary.

Code:
[19/07/2008 05:12:06] in callback: data/spells/scripts/custom/death stark.lua:getSpellDamage
[19/07/2008 05:12:06] (Unknown scriptfile)
The spell works, but sometimes this error appears.

And even tho it works, the pz thing ain't fixed. What I am doing is to make it only jump one time, and make it as a "charge" spell for knights, and in spells.xml I made it not possible to execute in pz, this helps temporarly. But if it would be possible to solve this problem out, this spell is pretty intresting.

Afraid I cant give out much more information.
 
On the second error, it looks like to me that it tries to read the file getSpellDamage. You should remove " and replace it with this: getSpellDamage(cid, weaponSkill, weaponAttack, attackStrength)
cid is fine, but the others, you'll need to get from somewhere/define in some way.

Kult spell forresten ;)
 
Last edited:
Ahh thanks!.

But still a bit stuck on this pz problem :p Anyone got any ideas?

Atempting to add pz:
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, TRUE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_NONE)
local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 50000)
setCombatCondition(combat, condition)
function getSpellDamage(cid, weaponSkill, weaponAttack, attackStrength)
local attack = 20
local skill = getPlayerMagLevel(cid)
local maxWeaponDamage = (skill * attack) / 20 + attack
local damage = -((math.random(50, maxWeaponDamage) * attackStrength) / 80) * 2.5
return damage, damage
end
function sonichoming(param)
if isCreature(param.cid) == TRUE and param.crc == 1 then
for abs = param.nxp, param.pxp do
for coo = param.nyp, param.pyp do
local pretile = {x = abs, y = coo, z = param.nzp, stackpos = 255}
local thing = getThingfromPos(pretile)
local pzd = getTilePzInfo(pretile)
local hst = getTileHouseInfo(pretile)
if isCreature(thing.uid) == TRUE and thing.uid ~= param.cid and pzd == 0 and hst == 0 then
local radius = param.radius
local nodea = getCreaturePosition(param.cid)
local nodeb = getCreaturePosition(thing.uid)
crcb = 1
jumps = jumps + 1
local nha = {x = nodeb.x, y = nodeb.y - 2, z = nodeb.z, stackpos = 255}
local sha = {x = nodeb.x, y = nodeb.y + 2, z = nodeb.z, stackpos = 255}
local wha = {x = nodeb.x - 2, y = nodeb.y, z = nodeb.z, stackpos = 255}
local eha = {x = nodeb.x + 2, y = nodeb.y, z = nodeb.z, stackpos = 255}
 
doTeleportThing(param.cid, nodeb, FALSE)
doSendMagicEffect(nodea, CONST_ME_GROUNDSHAKER)
doSendMagicEffect(nodea, CONST_ME_POFF)
doSendDistanceShoot(nodea, nodeb, CONST_ANI_ENERGYBALL)
doSendMagicEffect(nodeb, CONST_ME_STUN)
doSendDistanceShoot(nodeb, eha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, wha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, sha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, nha, CONST_ANI_ENERGY)
doSendMagicEffect(eha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(wha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(sha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(nha, CONST_ME_PURPLEENERGY)
var = numberToVariant(thing.uid)
doCombat(param.cid, param.combat, var)
break
end
end
if crcb == 1 then
break
end
end
if crcb == 1 and limit > 0 and jumps < limit then
crcb = 0
addEvent(sonichoming, param.tbj, param)
end
if crcb == 1 and limit == 0 then
crcb = 0
addEvent(sonichoming, param.tbj, param)
end
end
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getSpellDamage")
function onCastSpell(cid, var)
-- >>> Small config --
local radius = 5 -- Quite self explanatory --
limit = 10 -- Limit of homing jumps, 0 = Unlimited --
local tbj = 200 -- Time between jumps in miliseconds --
-- Small config <<< --
local nodea = getCreaturePosition(cid)
local nodeb = getCreaturePosition(variantToNumber(var))
local nha = {x = nodeb.x, y = nodeb.y - 2, z = nodeb.z, stackpos = 255}
local sha = {x = nodeb.x, y = nodeb.y + 2, z = nodeb.z, stackpos = 255}
local wha = {x = nodeb.x - 2, y = nodeb.y, z = nodeb.z, stackpos = 255}
local eha = {x = nodeb.x + 2, y = nodeb.y, z = nodeb.z, stackpos = 255}
 
doTeleportThing(cid, nodeb, FALSE)
doSendMagicEffect(nodea, CONST_ME_GROUNDSHAKER)
doSendMagicEffect(nodea, CONST_ME_POFF)
doSendDistanceShoot(nodea, nodeb, CONST_ANI_ENERGYBALL)
doSendMagicEffect(nodeb, CONST_ME_STUN)
doSendDistanceShoot(nodeb, eha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, wha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, sha, CONST_ANI_ENERGY)
doSendDistanceShoot(nodeb, nha, CONST_ANI_ENERGY)
doSendMagicEffect(eha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(wha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(sha, CONST_ME_PURPLEENERGY)
doSendMagicEffect(nha, CONST_ME_PURPLEENERGY)
jumps = 1
doCombat(cid, combat, var)
param = { cid = cid, var = var, combat = combat, nxp = nodeb.x - radius, pxp = nodeb.x + radius, nyp = nodeb.y - radius, pyp = nodeb.y + radius, radius = radius, nzp = nodeb.z, crc = 1, tbj = tbj}
addEvent(sonichoming, tbj, param)
end

But got totaly messed up :S my screen got like 50 errors/sec and my serv crashed and the players faced a 20min roleback. :S

Ohh and btw, I would like to thank Molinero for theese scripts, the credits goes to him.

edit:

I recieve errors so fast at the console, i cant freeze the console, and i cant manage to read the messsages. even doing print screen and try to watch it, its still to fuzzy to read.
 
Last edited:
Code:
local combat = createCombatObject() 
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) 
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, TRUE) 
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_NONE) 
  
local condition = createConditionObject(CONDITION_PARALYZE) 
setConditionParam(condition, CONDITION_PARAM_TICKS, 50000) 
setCombatCondition(combat, condition) 
  
function getSpellDamage(cid, weaponSkill, weaponAttack, attackStrength) 
local attack = 20 
local skill = getPlayerMagLevel(cid) 
local maxWeaponDamage = (skill * attack) / 20 + attack 
local damage = -((math.random(50, maxWeaponDamage) * attackStrength) / 80) * 2.5 
  
return damage, damage 
end 
  
function sonichoming(param) 
if isCreature(param.cid) == TRUE and param.crc == 1 then 
for abs = param.nxp, param.pxp do 
for coo = param.nyp, param.pyp do 
local pretile = {x = abs, y = coo, z = param.nzp, stackpos = 255} 
local thing = getThingfromPos(pretile) 
if isCreature(thing.uid) == TRUE and thing.uid ~= param.cid [B]and getTilePzInfo(pretile) == FALSE[/B] then 
crcb = 1 
jumps = jumps + 1 
  
local radius = param.radius 
local nodea = getCreaturePosition(param.cid) 
local nodeb = getCreaturePosition(thing.uid) 
  
local nha = {x = nodeb.x, y = nodeb.y - 2, z = nodeb.z, stackpos = 255} 
local sha = {x = nodeb.x, y = nodeb.y + 2, z = nodeb.z, stackpos = 255} 
local wha = {x = nodeb.x - 2, y = nodeb.y, z = nodeb.z, stackpos = 255} 
local eha = {x = nodeb.x + 2, y = nodeb.y, z = nodeb.z, stackpos = 255} 
  
doTeleportThing(param.cid, nodeb, FALSE) 
  
doSendMagicEffect(nodea, CONST_ME_GROUNDSHAKER) 
doSendMagicEffect(nodea, CONST_ME_POFF) 
doSendDistanceShoot(nodea, nodeb, CONST_ANI_ENERGYBALL) 
doSendMagicEffect(nodeb, CONST_ME_STUN) 
doSendDistanceShoot(nodeb, eha, CONST_ANI_ENERGY) 
doSendDistanceShoot(nodeb, wha, CONST_ANI_ENERGY) 
doSendDistanceShoot(nodeb, sha, CONST_ANI_ENERGY) 
doSendDistanceShoot(nodeb, nha, CONST_ANI_ENERGY) 
doSendMagicEffect(eha, CONST_ME_PURPLEENERGY) 
doSendMagicEffect(wha, CONST_ME_PURPLEENERGY) 
doSendMagicEffect(sha, CONST_ME_PURPLEENERGY) 
doSendMagicEffect(nha, CONST_ME_PURPLEENERGY) 
  
var = numberToVariant(thing.uid) 
  
doCombat(param.cid, param.combat, var) 
break 
end 
end 
if crcb == 1 then 
break 
end 
end 
if crcb == 1 and limit > 0 and jumps < limit then 
crcb = 0 
addEvent(sonichoming, param.tbj, param) 
end 
if crcb == 1 and limit == 0 then 
crcb = 0 
addEvent(sonichoming, param.tbj, param) 
end 
end 
end 
  
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, [B]getSpellDamage(cid, weaponSkill, weaponAttack, attackStrength)[/B]) 
  
function onCastSpell(cid, var) 
  
-- >>> Small config -- 
  
local radius = 5 -- Quite self explanatory -- 
limit = 10 -- Limit of homing jumps, 0 = Unlimited -- 
local tbj = 200 -- Time between jumps in miliseconds -- 
  
-- Small config <<< -- 
  
local nodea = getCreaturePosition(cid) 
local nodeb = getCreaturePosition(variantToNumber(var)) 

local nha = {x = nodeb.x, y = nodeb.y - 2, z = nodeb.z, stackpos = 255} 
local sha = {x = nodeb.x, y = nodeb.y + 2, z = nodeb.z, stackpos = 255} 
local wha = {x = nodeb.x - 2, y = nodeb.y, z = nodeb.z, stackpos = 255} 
local eha = {x = nodeb.x + 2, y = nodeb.y, z = nodeb.z, stackpos = 255} 
  
doTeleportThing(cid, nodeb, FALSE) 
  
doSendMagicEffect(nodea, CONST_ME_GROUNDSHAKER) 
doSendMagicEffect(nodea, CONST_ME_POFF) 
doSendDistanceShoot(nodea, nodeb, CONST_ANI_ENERGYBALL) 
doSendMagicEffect(nodeb, CONST_ME_STUN) 
doSendDistanceShoot(nodeb, eha, CONST_ANI_ENERGY) 
doSendDistanceShoot(nodeb, wha, CONST_ANI_ENERGY) 
doSendDistanceShoot(nodeb, sha, CONST_ANI_ENERGY) 
doSendDistanceShoot(nodeb, nha, CONST_ANI_ENERGY) 
doSendMagicEffect(eha, CONST_ME_PURPLEENERGY) 
doSendMagicEffect(wha, CONST_ME_PURPLEENERGY) 
doSendMagicEffect(sha, CONST_ME_PURPLEENERGY) 
doSendMagicEffect(nha, CONST_ME_PURPLEENERGY) 
  
jumps = 1 
  
doCombat(cid, combat, var) 
  
param = { cid = cid, var = var, combat = combat, nxp = nodeb.x - radius, pxp = nodeb.x + radius, nyp = nodeb.y - radius, pyp = nodeb.y + radius, radius = radius, nzp = nodeb.z, crc = 1, tbj = tbj} 
  
addEvent(sonichoming, tbj, param) 
end
Maybe this will work?
Also notice that spell damage part, and see if it works better.
 
Code:
local combat = createCombatObject()
local condition = createConditionObject(CONDITION_DROWN)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 20, 2000, -10)
setCombatCondition(combat, condition)

function onSay(cid, words, param)
sexProposal = getPlayerStorageValue(cid, 66600)
sexAccept = cid
noCondom = math.random(4)
aidsEffect = math.random(3)

	local playerPos = getCreaturePosition(cid)
	if getPlayerLookDir(cid) == 1 then 
		posDir = {x = playerPos.x + 1, y = playerPos.y, z = playerPos.z, stackpos = 253}
	elseif getPlayerLookDir(cid) == 2 then
		posDir = {x = playerPos.x, y = playerPos.y + 1, z = playerPos.z, stackpos = 253}
	elseif getPlayerLookDir(cid) == 3 then
		posDir = {x = playerPos.x - 1, y = playerPos.y, z = playerPos.z, stackpos = 253}
	else
		posDir = {x = playerPos.x, y = playerPos.y - 1, z = playerPos.z, stackpos = 253}
	end
	target = getThingfromPos(posDir)
	if isPlayer(target.uid) == TRUE then
		if getPlayerLookDir(target.uid) == getPlayerLookDir(cid)-2 then
			sameLookDir = TRUE
		elseif getPlayerLookDir(target.uid) == getPlayerLookDir(cid)+2 then
			sameLookDir = TRUE
		else
			sameLookDir = FALSE
		end
		if sameLookDir == TRUE then
			if getPlayerSex(target.uid) == getPlayerSex(cid) then
				doPlayerSendCancel(cid, 'You cannot make sex with same gender as self, pervert!')
				doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
			else
				if getPlayerGroupId(cid) > 3 and getPlayerGroupId(cid) >= getPlayerGroupId(target.uid) then
					sexProposal = cid
					sexAccept = target.uid
					allowSex = TRUE
				elseif target.uid == sexProposal then
					allowSex = TRUE
				else
					allowSex = FALSE
				end
				if allowSex == TRUE then
					if getPlayerStorageValue(sexProposal, 66660) > 0 or getPlayerStorageValue(sexAccept, 66660) > 0 then
						doSendAnimatedText(getCreaturePosition(sexProposal), 'Ahh, Ahh...', TEXTCOLOR_YELLOW)
						doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_STUN)
						doSendAnimatedText(getThingPos(sexAccept), 'Ohh, Ohh!', TEXTCOLOR_TEAL)
						doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_STUN)
						setPlayerStorageValue(sexProposal, 66660, 0)
						setPlayerStorageValue(sexAccept, 66660, 0)
					else
						if noCondom == 3 then
							hurtMessage = 'Sex without condoms brings consequences - You just got AIDS!\nYour sickness will hurt alot...'
							partnerMessage = 'Sex without condoms brings consequences - Your partner just got AIDS!'
							bothMessage = 'Sex without condoms brings consequences - You and Your partner just got AIDS!\nYour sickness will hurt alot...'
							if aidsEffect == 1 then
								proposalMessage = hurtMessage
								acceptMessage = partnerMessage
								hurtPlayer = sexProposal
							elseif aidsEffect == 2 then
								proposalMessage = partnerMessage
								acceptMessage = hurtMessage
								hurtPlayer = sexAccept
							else
								proposalMessage = bothMessage
								acceptMessage = bothMessage
								hurtPlayer = FALSE
							end
							doPlayerSendTextMessage(sexProposal, MESSAGE_STATUS_WARNING, proposalMessage)
							doPlayerSendTextMessage(sexAccept, MESSAGE_STATUS_WARNING, acceptMessage)
							if hurtPlayer == FALSE then
								doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_YELLOW_RINGS)
								doCombat(0,combat,numberToVariant(sexProposal))
								doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_YELLOW_RINGS)
								doCombat(0,combat,numberToVariant(sexAccept))
							else
								doSendMagicEffect(getPlayerPosition(hurtPlayer),CONST_ME_YELLOW_RINGS)
								doCombat(0,combat,numberToVariant(hurtPlayer))
							end
						elseif noCondom == 2 then
							payMessage = '\nAs a good parent You spend whole Your gold for the child.'
							if getPlayerSex(sexProposal) == 0 then
								childMother = sexProposal
								childFather = sexAccept
								motherMsg = payMessage
								fatherMsg = ""
							elseif getPlayerSex(sexProposal) == 1 then
								childMother = sexAccept
								childFather = sexProposal
								motherMsg = ""
								fatherMsg = payMessage
							else
								if getPlayerSex(sexAccept) == 0 then
									childMother = sexAccept
									childFather = sexProposal
									motherMsg = ""
									fatherMsg = payMessage
								else
									childMother = sexProposal
									childFather = sexAccept
									motherMsg = payMessage
									fatherMsg = ""
								end
							end
							doPlayerSendTextMessage(childFather, MESSAGE_STATUS_WARNING, 'Sex without condoms brings consequences - '..getCreatureName(childMother)..' just born a child!' .. fatherMsg)
							doPlayerSendTextMessage(childMother, MESSAGE_STATUS_WARNING, 'Sex without condoms brings consequences - You have just born a child!' .. motherMsg)
							doSendMagicEffect(getPlayerPosition(childFather), CONST_ME_FIREWORK_YELLOW)
							doSendMagicEffect(getPlayerPosition(childMother), CONST_ME_FIREWORK_RED)
							if math.random(2) == 1 then
								childGender = "son"
							else
								childGender = "daughter"
							end
							doSetItemSpecialDescription(doPlayerAddItem(childMother,6579,1),'It is a '..childGender..' of '..getCreatureName(childFather)..' and '..getCreatureName(childMother)..'.')
							local gps = getPlayerItemCount(sexProposal, ITEM_GOLD)
							local pcs = getPlayerItemCount(sexProposal, ITEM_PLATINUM)
							local ccs = getPlayerItemCount(sexProposal, ITEM_CRYSTAL)
							if gps > 0 or pcs > 0 or ccs > 0 then
								doPlayerRemoveItem(sexProposal, ITEM_GOLD, gps)
								doPlayerRemoveItem(sexProposal, ITEM_PLATINUM, pcs)
								doPlayerRemoveItem(sexProposal, ITEM_CRYSTAL, ccs)
							end
						else
							doSendAnimatedText(getCreaturePosition(sexProposal), 'Ahh, Ahh...', TEXTCOLOR_YELLOW)
							doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_STUN)
							doSendAnimatedText(getThingPos(sexAccept), 'Ohh, Ohh!', TEXTCOLOR_TEAL)
							doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_STUN)
						end
					end
					setPlayerStorageValue(sexProposal, 66600, 0)
					setPlayerStorageValue(sexAccept, 66600, 0)
				else
					if getPlayerStorageValue(target.uid, 66600) == cid then
						doPlayerSendCancel(cid, 'You have already sent a sex proposal to '..getCreatureName(target.uid)..'.')
						doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
					else
						setPlayerStorageValue(target.uid, 66600, cid)
						doPlayerSendTextMessage(cid, 22, 'You have sent a sex proposal to '..getCreatureName(target.uid)..'.')
						doPlayerSendTextMessage(target.uid, 22, getCreatureName(cid)..' wants to have a sex with You.')
						doSendMagicEffect(getPlayerPosition(target.uid),CONST_ME_HEARTS)
					end
				end
			end
		else
			doPlayerSendCancel(cid, 'You must stand after your partner to do sex.')
			doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
		end
	else
		doPlayerSendCancel(cid, 'You may do sex only with players.')
		doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
	end
	doPlayerSendTextMessage(cid, 25, words)
	return FALSE
end

My advanced sex system Don't work! I really need help!

I get an error when i type !sex

Lua Script Error: [TalkAction Interface]

data/talkactions/scripts/sex.luanSay

data/talkactios/scripts/sex.lua:37: attempt to call global 'getPlayerGroupId' (a nil value)

I am using Quickly server 8.1.
 
That's because your server is based on evolutions, and this script is based on TFS. Some functions in use by the script doesn't exist on evo-based servers. And I have no idea about the functions used by that server.
 
Back
Top