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

mount

XouruS

Active Member
Joined
Dec 29, 2009
Messages
941
Reaction score
36
Location
Canada
Code:
[22/11/2010 18:54:12] [Error - Action Interface] 
[22/11/2010 18:54:12] data/actions/scripts/mountsystem.lua:onUse
[22/11/2010 18:54:12] Description: 
[22/11/2010 18:54:12] data/actions/scripts/mountsystem.lua:19: attempt to index local 'r' (a nil value)
[22/11/2010 18:54:12] stack traceback:
[22/11/2010 18:54:12] 	data/actions/scripts/mountsystem.lua:19: in function <data/actions/scripts/mountsystem.lua:17>

Code:
--------------------
---- CONDITION -----
--------------------
local wolfCondition = createConditionObject(CONDITION_OUTFIT)
setConditionParam(wolfCondition, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(wolfCondition, {lookType = 4, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0})
--------------------
----- config -------
--------------------
local t = {
	[7443] = {article='a' ,name='wolf', text='Mount, wolf!', dtext='Demount, wolf!', s=100, condition=wolfCondition},
}      
 
------------------------------------
--- don't change if you are noob ---
------------------------------------
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v, r = getCreaturePosition(cid), t[item.itemid]
	local s = r.s
	local pos = {x = v.x, y = v.y, z = v.z}
	if r then
		if getPlayerStorageValue(cid, s) <= 0 then
			doSendMagicEffect(pos, 10)
			doCreatureSay(cid, r.text, 19)
			setPlayerStorageValue(cid, s, 1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have mounted ' .. r.article .. ' '.. r.name .. '.')
			return doAddCondition(cid, r.condition)   
		elseif getPlayerStorageValue(cid, s) == 1 then
			doSendMagicEffect(pos, 10)
			doCreatureSay(cid, r.dtext, 19)
			setPlayerStorageValue(cid, s, 0)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have demounted ' .. r.article .. ' '.. r.name .. '.')
			return doRemoveCondition(cid, CONDITION_OUTFIT)
		else
			return doPlayerSendCancel(cid, 'You can\'t do this.')
		end
	else
		return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'There has been some error, try contacting a staff member.')
	end
end


anyone?
 
LUA:
--------------------
---- CONDITION -----
--------------------
local wolfCondition = createConditionObject(CONDITION_OUTFIT)
setConditionParam(wolfCondition, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(wolfCondition, {lookType = 4, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0})
--------------------
----- config -------
--------------------
local table = {
    [2624] = {
        article = 'a',
        name = 'wolf', 
        text = 'Mount, wolf!', 
        dtext = 'Demount, wolf!', 
        storage = 100, 
        condition = wolfCondition
    },
}      
 
------------------------------------
--- don't change if you are noob ---
------------------------------------
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local table = table[item.itemid]
    if table then
        if getCreatureStorage(cid, table.storage) <= 0 then
            doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
            doCreatureSay(cid, table.text, TALKTYPE_MONSTER_YELL)
            doCreatureSetStorage(cid, table.storage, 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have mounted ' .. table.article .. ' '.. table.name .. '.')
            return doAddCondition(cid, table.condition)   
        elseif getCreatureStorage(cid, table.storage) == 1 then
            doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
            doCreatureSay(cid, table.dtext, TALKTYPE_MONSTER_YELL)
            doCreatureSetStorage(cid, table.storage, 0)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have demounted ' .. table.article .. ' '.. table.name .. '.')
            return doRemoveCondition(cid, CONDITION_OUTFIT)
        else
            return doPlayerSendCancel(cid, 'You can\'t do this.')
        end
    else
        return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'There has been some error, try contacting a staff member.')
    end
end
 
LUA:
--------------------
---- CONDITION -----
--------------------
local wolfCondition = createConditionObject(CONDITION_OUTFIT)
setConditionParam(wolfCondition, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(wolfCondition, {lookType = 4, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0})
--------------------
----- config -------
--------------------
local table = {
    [2624] = {
        article = 'a',
        name = 'wolf', 
        text = 'Mount, wolf!', 
        dtext = 'Demount, wolf!', 
        storage = 100, 
        condition = wolfCondition
    },
}      
 
------------------------------------
--- don't change if you are noob ---
------------------------------------
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local table = table[item.itemid]
    if table then
        if getCreatureStorage(cid, table.storage) <= 0 then
            doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
            doCreatureSay(cid, table.text, TALKTYPE_MONSTER_YELL)
            doCreatureSetStorage(cid, table.storage, 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have mounted ' .. table.article .. ' '.. table.name .. '.')
            return doAddCondition(cid, table.condition)   
        elseif getCreatureStorage(cid, table.storage) == 1 then
            doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
            doCreatureSay(cid, table.dtext, TALKTYPE_MONSTER_YELL)
            doCreatureSetStorage(cid, table.storage, 0)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have demounted ' .. table.article .. ' '.. table.name .. '.')
            return doRemoveCondition(cid, CONDITION_OUTFIT)
        else
            return doPlayerSendCancel(cid, 'You can\'t do this.')
        end
    else
        return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'There has been some error, try contacting a staff member.')
    end
end

replaced, no error in console and it wont work.
 
Did you register it in actions.xml right?
Did you replace the itemid in the table to the one you registered in actions.xml?

Because that is the problem.
Post your actions.xml if it doesn't solve it and post the script modified that you use.
 
Back
Top