• 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 Look look this oh my god!

KylerXX

Active Member
Joined
Jun 24, 2010
Messages
439
Reaction score
30
PHP:
local outfit = getCreatureOutfit(getCreatureTarget(cid))
local vocout = {
[39] = {2}
}

function onCastSpell(cid, var)
	if isPlayer(getCreatureTarget(cid)) then
		doPlayerSetVocation(cid, getPlayerVocation(getCreatureTarget(cid)))
		doPlayerSendCancel(cid, 'Now you are ' ..getPlayerVocationName(cid)..'!')
		addEvent(doPlayerSetVocation, 1 * 60 * 1000, cid, 59)
		addEvent(doCreatureChangeOutfit, 1 * 60 * 1000, cid, {lookType = 28, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0})
	elseif isMonster(getCreatureTarget(cid)) then
		doCreatureChangeOutfit(cid, getCreatureOutfit(getCreatureTarget(cid)))
		addEvent(doCreatureChangeOutfit, 1 * 60 * 1000, cid, {lookType = 28, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0})
		doPlayerSetVocation(cid, vocout[outfit][1])
        addEvent(doPlayerSetVocation, 1 * 60 * 1000, cid, 59)
	else
		doPlayerSendCancel(cid, 'No has indicado al pokemon para utilizar este ataque!')
		return false
	end
return true
end

If I say this spell my outfit is exchanged for the monster, but also define what if the monster have "that" outfit, also changing the vocation indicated in black, but I get this damned error...:


[20/07/2010 02:29:31] Lua Script Error: [Spell Interface]
[20/07/2010 02:29:31] data/spells/scripts/summon/ditto.lua:eek:nCastSpell

[20/07/2010 02:29:31] data/spells/scripts/summon/ditto.lua:16: attempt to index field '?' (a nil value)
[20/07/2010 02:29:31] stack traceback:
[20/07/2010 02:29:31] data/spells/scripts/summon/ditto.lua:16: in function <data/spells/scripts/summon/ditto.lua:7>
 
@up, you can not bump before
86400

seconds

well if you include parameters in variables that require them from the function, you'll obviously get errors
 
You can indicate my errors on the script in black please :S?

@Up:

Its strefull to see that other are attenden, and me not!
 
ahm wait a sec, i helped somebody recently with that same script ;s

Lua:
function onCastSpell(cid, var)
    local outfit = getCreatureOutfit(getCreatureTarget(cid))
    local vocout = {
        [39] = {2},
    }
    if isPlayer(getCreatureTarget(cid)) then
        doPlayerSetVocation(cid,  getPlayerVocation(getCreatureTarget(cid)))
        doPlayerSendCancel(cid, 'Now you are '  ..getPlayerVocationName(cid)..'!')
        addEvent(doPlayerSetVocation, 60 * 1000, cid, 59)
        addEvent(doCreatureChangeOutfit, 60 * 1000, cid, {lookType =  28})
    elseif isMonster(getCreatureTarget(cid)) then
        doCreatureChangeOutfit(cid,  getCreatureOutfit(getCreatureTarget(cid)))
        addEvent(doCreatureChangeOutfit, 60 * 1000, cid, {lookType =  28})
        doPlayerSetVocation(cid, vocout[outfit][1])
        addEvent(doPlayerSetVocation, 60 * 1000, cid, 59)
    else
        doPlayerSendCancel(cid, 'No has indicado al pokemon para  utilizar este ataque!')
        return false
    end
return true
end
 
[20/07/2010 03:12:36] Lua Script Error: [Spell Interface]
[20/07/2010 03:12:36] data/spells/scripts/summon/ditto.lua:eek:nCastSpell

[20/07/2010 03:12:36] data/spells/scripts/summon/ditto.lua:16: attempt to index field '?' (a nil value)
[20/07/2010 03:12:36] stack traceback:
[20/07/2010 03:12:36] data/spells/scripts/summon/ditto.lua:16: in function <data/spells/scripts/summon/ditto.lua:7>



the same :(
 
Code:
function onCastSpell(cid, var)
	local outfit = getCreatureOutfit(getCreatureTarget(cid))
	local vocout = {
		[39] = {2},
	}
	if isPlayer(getCreatureTarget(cid)) then
		doPlayerSetVocation(cid,  getPlayerVocation(getCreatureTarget(cid)))
		doPlayerSendCancel(cid, 'Now you are '  ..getPlayerVocationName(cid)..'!')
		addEvent(doPlayerSetVocation, 60 * 1000, cid, 59)
		addEvent(doCreatureChangeOutfit, 60 * 1000, cid, {lookType =  28})
	elseif isMonster(getCreatureTarget(cid)) then
		doCreatureChangeOutfit(cid, getCreatureOutfit(getCreatureTarget(cid)))
		addEvent(doCreatureChangeOutfit, 60 * 1000, cid, {lookType =  28})
		doPlayerSetVocation(cid, vocout[outfit[B][COLOR="Red"].lookType[/COLOR][/B]][1])
		addEvent(doPlayerSetVocation, 60 * 1000, cid, 59)
	else
		doPlayerSendCancel(cid, 'No has indicado al pokemon para  utilizar este ataque!')
		return false
	end
	return true
end
 
Back
Top