STiX
Intermediate OT User
Well here's what my files look like (most irrelevant information removed). There seems to be some sort of confliction in my advancement scripts...
Creaturescripts.xml
login.lua
level100.lua (the other level200 and level300 scripts are practically the same)
advance_ani.lua
The problem is, advance_ani won't work at the same time as the level100, 200 and 300 scripts. I have to comment them out like this:
The scripts work 100% fine by themselves, but I can't have more than 1 running. I also don't wish to combine them into one single file.
So yer, this is buggin me.
Creaturescripts.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
<event type="login" name="PlayerLogin" script="login.lua"/>
<event type="login" name="FirstItems" script="firstitems.lua"/>
<event type="death" name="PlayerDeath" script="playerdeath.lua"/>
<event type="advance" name="advance_ani" script="advance_ani.lua"/>
<event type="advance" name="level100" script="level100.lua"/>
<event type="advance" name="level200" script="level200.lua"/>
<event type="advance" name="level300" script="level300.lua"/>
<event type="preparedeath" name="Rook" script="Rook.lua"/>
<event type="look" name="playerLook" script="look.lua"/>
</creaturescripts>
Code:
function onLogin(cid)
registerCreatureEvent(cid, "PlayerDeath")
registerCreatureEvent(cid, "advance_ani")
registerCreatureEvent(cid, "Rook")
registerCreatureEvent(cid, "level100")
registerCreatureEvent(cid, "level200")
registerCreatureEvent(cid, "level300")
registerCreatureEvent(cid, "playerLook")
if getPlayerStorageValue(cid, 30004) == -1 then
doPlayerSendTextMessage(cid,22,"Greetings, "..getPlayerName(cid).."!")
setPlayerStorageValue(cid, 30004, 1)
else
doPlayerSendTextMessage(cid,22,"Welcome back, "..getPlayerName(cid).."!")
end
return TRUE
end
Code:
function onAdvance(cid, skill, oldlevel, newlevel)
if newlevel == 100 then
doBroadcastMessage(getPlayerName(cid).." has just advanced to LVL 100.\nCongratulations!", 21)
end
return TRUE
end
Code:
local config = {
[0] = { "Fist", 29}, -- 28 = variable[2] -- Animation effect
[1] = { "Club", 29}, -- 28 = variable[2] -- Animation effect
[2] = { "Sword", 29}, -- 28 = variable[2] -- Animation effect
[3] = { "Axe", 29}, -- 28 = variable[2] -- Animation effect
[4] = { "Distance", 29}, -- 28 = variable[2] -- Animation effect
[5] = { "Shield", 30}, -- 28 = variable[2] -- Animation effect
[6] = { "Fishing", 30}, -- 28 = variable[2] -- Animation effect
[7] = { "Magic", 28}, -- 28 = variable[2] -- Animation effect
[8] = { "Level", 28} -- 28 = variable[2] -- Animation effect
}
function onAdvance(cid, skill, oldlevel, newlevel)
local pos = getPlayerPosition(cid)
local positions = {
{x=pos.x+1,y=pos.y-1,z=pos.z},
{x=pos.x-1,y=pos.y-1,z=pos.z},
{x=pos.x+1,y=pos.y+1,z=pos.z},
{x=pos.x-1,y=pos.y+1,z=pos.z},
{x=pos.x+1,y=pos.y,z=pos.z},
{x=pos.x-1,y=pos.y,z=pos.z},
{x=pos.x,y=pos.y+1,z=pos.z},
{x=pos.x,y=pos.y-1,z=pos.z}}
for type, variable in pairs(config) do
if skill == type then
--doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have raised your "..variable[1].." skill from "..oldlevel.." to "..newlevel..".")
for i = 1, table.maxn(positions) do
doSendMagicEffect(positions[i],variable[2])
end
end
end
return TRUE
end
The problem is, advance_ani won't work at the same time as the level100, 200 and 300 scripts. I have to comment them out like this:
Code:
function onLogin(cid)
registerCreatureEvent(cid, "PlayerDeath")
registerCreatureEvent(cid, "advance_ani")
registerCreatureEvent(cid, "Rook")
-- registerCreatureEvent(cid, "level100")
-- registerCreatureEvent(cid, "level200")
-- registerCreatureEvent(cid, "level300")
registerCreatureEvent(cid, "playerLook")
if getPlayerStorageValue(cid, 30004) == -1 then
doPlayerSendTextMessage(cid,22,"Greetings, "..getPlayerName(cid).."!")
setPlayerStorageValue(cid, 30004, 1)
else
doPlayerSendTextMessage(cid,22,"Welcome back, "..getPlayerName(cid).."!")
end
return TRUE
end
So yer, this is buggin me.