Animera
* * * * *
everything is fixed atm.
Last edited:
TFS Crying damson 0.3.6pl1 console
PROBLEM 1
Error message:
When haunted dragon dies you are supposed to get a storagevalue with effect and text wich doesn't work no errors.
Haunted dragon.xml
PHP:<script> <event name="RewardGhastly"/> </script>
Creaturescript.xml
PHP:<?xml version="1.0" encoding="UTF-8"?> <creaturescripts> <event type="login" name="PlayerLogin" event="script" value="login.lua"/> <event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/> <event type="receivemail" name="Mail" event="script" value="mail.lua"/> <event type="reportbug" name="SaveReportBug" script="reportbug.lua"/> <event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/> <event type="kill" name="RewardGhastly" event="script" value="RewardGhastly.lua"/> <event type="kill" name="MonsterPortal" event="script" value="monster_portal.lua"/> <event type="kill" name="MonsterPortal2" event="script" value="monster_portal2.lua"/> <event type="kill" name="MonsterPortal3" event="script" value="monster_portal3.lua"/> <event type="kill" name="MonsterPortal4" event="script" value="monster_portal4.lua"/> <event type="think" name="Idle" event="script" value="idle.lua"/> <event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/> </creaturescripts>
Login.lua
PHP:local config = { loginMessage = getConfigValue('loginMessage'), useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')) } function onLogin(cid) local loss = getConfigValue('deathLostPercent') if(loss ~= nil) then doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10) end local accountManager = getPlayerAccountManager(cid) if(accountManager == MANAGER_NONE) then local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage if(lastLogin > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "." else str = str .. " Please choose your outfit." doPlayerSendOutfitWindow(cid) end local town = "Enigma" --- town name local townid = 1 --- put the town id function onLogin(cid) if getPlayerStorageValue(cid, sotrage) == FALSE then doPlayerSendTextMessage(cid,24,"You have no vip, Purchace VIP to get acces to nice places and unique features!") doPlayerSetTown(cid, townid) end end registerCreatureEvent(cid, "PlayerDeath") return TRUE end doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) elseif(accountManager == MANAGER_NAMELOCK) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?") elseif(accountManager == MANAGER_ACCOUNT) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.") end if(not isPlayerGhost(cid)) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) end end registerCreatureEvent(cid, "Mail") registerCreatureEvent(cid, "MonsterPortal") registerCreatureEvent(cid, "MonsterPortal2") registerCreatureEvent(cid, "MonsterPortal3") registerCreatureEvent(cid, "MonsterPortal4") registerCreatureEvent(cid, "RewardGhastly") registerCreatureEvent(cid, "GuildMotd") registerCreatureEvent(cid, "Advanceeffect") registerCreatureEvent(cid, "Idle") if(config.useFragHandler) then registerCreatureEvent(cid, "SkullCheck") end registerCreatureEvent(cid, "ReportBug") registerCreatureEvent(cid, "AdvanceSave") return true end
Rewardghastly.lua
PHP:function onKill(cid, target) setPlayerStorageValue(cid,45459,1) doPlayerSay(cid, 'Congratulations! You slaughted The Haunted dragon, Get your rewards in the room in the west.', 19) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE, cid) end
PROBLEM 2
Errors of cg.lua:
Cityguard gives storagevalue after talking, If level 75 or higher and say quest then it says the problem and gives you storagevalue if you are under 75 it says it got no quest at this moment~ When you talk again and didn't finish it says too hard for you eh?
Example:
Me: Hi
NPC: Hi
Me: Quest
(If under level 75 then) NPC: I have no quests to offer you at the moment. Come back when your stronger!
(If 75 or higher then) NPC: Our city keep getting earthquakes please help us go to the larva cave and find out who is responsible for this and kill him(Give Storagevalue)
(If Storagevalue and say quest again then) NPC: Is it too hard for you eh?
(If got storagevalue from problem 3 then) NPC: Thanks for saving our city! (and get 50k exp)
cg.lua
PHP:local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end -- OTServ event handling functions end function pick_quest(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end local level = getPlayerLevel(cid) for k, v in pairs(wow_like_quests) do local required = tonumber(k) if(level >= required) then for i, v in ipairs(v) do if getPlayerLevel(cid) >= 80 then setPlayerStorageValue(cid,66226,1) npcHandler:say("Our city keep getting earthquakes please help us go to the larva cave and find out who is responsible for this and kill him!", cid) parameters.quest = v return true end npcHandler:resetNpc() return true end end end end npcHandler:say("I have no quests to offer you at the moment. Come back when your stronger", cid) npcHandler:resetNpc() return true end end end function accept_quest(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end local quest = node:getParent():getParameters().quest local storage = quest.storage setPlayerStorageValue(cid, storage, 0) npcHandler:say("I'm expecting to hear from you again. Don't dissapoint me.", cid) if(quest.on_accept) then quest.on_accept(cid, quest) end npcHandler:resetNpc() return true end -- Keyword "Quest" will pick lowest undone quest for you. local questNode = keywordHandler:addKeyword({'quest'}, pick_quest, {}) questNode:addChildKeyword({'yes'}, accept_quest, {}) questNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too hard for you, eh?'}) npcHandler:addModule(FocusModule:new())
local storage = 41000
function onDeath(cid, corpse, deathList)
if getCreatureName(cid):lower() == "haunted dragon" then
for i = 1, #deathList do
if isPlayer(deathList[i]) then
if getPlayerStorageValue(deathList[i], storage) < 0 then
doSendMagicEffect(getCreaturePosition(deathList[i], CONST_ME_MAGIC_RED)
setPlayerStorageValue(deathList[i], storage, 1)
break
end
end
end
end
return true
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
elseif msgcontains(msg, 'quest') then
local a, b = getPlayerStorageValue(cid, 34781), getPlayerStorageValue(cid, 34782)
if a < 1 then
npcHandler:say('My older brother got other interests then me, He is a demonhunter however i lost him can you find him?', cid)
setPlayerStorageValue(cid, 34781, 1)
elseif a == 1 and b ~= 1 then
npcHandler:say('You didn\'t find him yet?', cid)
elseif a == 1 and b == 1 and getPlayerStorageValue(cid, 44671) < 1 then
npcHandler:say('Thanks a lot! I give you access to the new city called Omashu city, Go to sunrise city and take the hole on the western part of the city, Follow the cave and you will find a boat.', cid)
npcHandler:releaseFocus(cid)
setPlayerStorageValue(cid, 44671, 1)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
elseif msgcontains(msg, 'quest') and getPlayerStorageValue(cid, 34781) == 1 and getPlayerStorageValue(cid, 35782) < 1 then
npcHandler:say('Thanks for letting me know he is fine!, Well i will visit him as soon i am back from my hunt.', cid)
npcHandler:releaseFocus(cid)
setPlayerStorageValue(cid, 35782, 1)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
TFS Crying damson 0.3.6pl1 console
PROBLEM 1
Error message:
When haunted dragon dies you are supposed to get a storagevalue with effect and text wich doesn't work no errors.
Haunted dragon.xml
PHP:<script> <event name="RewardGhastly"/> </script>
Creaturescript.xml
PHP:<?xml version="1.0" encoding="UTF-8"?> <creaturescripts> <event type="login" name="PlayerLogin" event="script" value="login.lua"/> <event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/> <event type="receivemail" name="Mail" event="script" value="mail.lua"/> <event type="reportbug" name="SaveReportBug" script="reportbug.lua"/> <event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/> <event type="kill" name="RewardGhastly" event="script" value="RewardGhastly.lua"/> <event type="kill" name="MonsterPortal" event="script" value="monster_portal.lua"/> <event type="kill" name="MonsterPortal2" event="script" value="monster_portal2.lua"/> <event type="kill" name="MonsterPortal3" event="script" value="monster_portal3.lua"/> <event type="kill" name="MonsterPortal4" event="script" value="monster_portal4.lua"/> <event type="think" name="Idle" event="script" value="idle.lua"/> <event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/> </creaturescripts>
Login.lua
PHP:local config = { loginMessage = getConfigValue('loginMessage'), useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')) } function onLogin(cid) local loss = getConfigValue('deathLostPercent') if(loss ~= nil) then doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10) end local accountManager = getPlayerAccountManager(cid) if(accountManager == MANAGER_NONE) then local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage if(lastLogin > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "." else str = str .. " Please choose your outfit." doPlayerSendOutfitWindow(cid) end local town = "Enigma" --- town name local townid = 1 --- put the town id function onLogin(cid) if getPlayerStorageValue(cid, sotrage) == FALSE then doPlayerSendTextMessage(cid,24,"You have no vip, Purchace VIP to get acces to nice places and unique features!") doPlayerSetTown(cid, townid) end end registerCreatureEvent(cid, "PlayerDeath") return TRUE end doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) elseif(accountManager == MANAGER_NAMELOCK) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?") elseif(accountManager == MANAGER_ACCOUNT) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.") end if(not isPlayerGhost(cid)) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) end end registerCreatureEvent(cid, "Mail") registerCreatureEvent(cid, "MonsterPortal") registerCreatureEvent(cid, "MonsterPortal2") registerCreatureEvent(cid, "MonsterPortal3") registerCreatureEvent(cid, "MonsterPortal4") registerCreatureEvent(cid, "RewardGhastly") registerCreatureEvent(cid, "GuildMotd") registerCreatureEvent(cid, "Advanceeffect") registerCreatureEvent(cid, "Idle") if(config.useFragHandler) then registerCreatureEvent(cid, "SkullCheck") end registerCreatureEvent(cid, "ReportBug") registerCreatureEvent(cid, "AdvanceSave") return true end
Rewardghastly.lua
PHP:function onKill(cid, target) setPlayerStorageValue(cid,45459,1) doPlayerSay(cid, 'Congratulations! You slaughted The Haunted dragon, Get your rewards in the room in the west.', 19) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE, cid) end
function onDeath(cid, corpse, deathList)
registerCreatureEvent(cid, "RewardGhastly")
if getCreatureName(cid) == '--EDIT--' then
doCreatureSetStorage(cid, 45459, 1)
doCreatureSay(cid, "Congratulations! You slaughtered the Haunted Dragon. Get your rewards in the room to the west.", TALKTYPE_ORANGE_1)
doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_BLUE, cid)
end
return true
end
<event type="death" name="RewardGhastly" event="script" value="rewardghastly.lua"/>
<script>
<event name="RewardGhastly"/>
</script>
function onUse(cid, item, fromPosition, itemEx, toPosition)
-----------------------------------------------------
local firstID = X -- id of the first item
local secondID = X -- id of the second item
local newID = X -- id of the new item
local count = 1 -- You get 1 of the new item
local effect = {
pos = {x=1269, y=1146, z=9},
pos2 = {x=1269, y=1147, z=9},
pos3 = {x=1269, y=1148, z=9},
}
local piece1pos = {
x = 1268,
y = 1146, -- Position of the first item
z = 9,
}
local piece2pos = {
x = 1268,
y = 1148, -- Position of the second item
z = 9,
stackpos=255}
local getpiece1 = getThingfromPos(piece1pos)
local getpiece2 = getThingfromPos(piece2pos)
local playerpos = getPlayerPosition(cid)
if ((getpiece1.itemid == firstID) and (getpiece2.itemid == secondID)) == 1 then
if item.itemid == 1945 then
doTransformItem(item.uid,item.itemid+1)
elseif item.itemid == 1946 then
doTransformItem(item.uid,item.itemid-1)
end
doRemoveItem(getpiece1.uid,1)
doSendMagicEffect(piece1pos,15)
doRemoveItem(getpiece2.uid,1)
doSendMagicEffect(piece2pos,15)
doPlayerAddItem(playerpos,newID,count)
doSendMagicEffect(playerpos,15)
doPlayerSendTextMessage(cid, 22, "X")
doSendMagicEffect(effect.pos,11)
doSendMagicEffect(effect.pos2,11)
doSendMagicEffect(effect.pos3,11)
end
end
local stonepos1 = {x=1782, y=1415, z=7} -- Blocking stone position.
local stone1 = getTileItemById(stonepos1, 1304) -- You can change the ID to any other kind of blocking item
function onStepIn(cid, item, frompos, item2, topos)
if getPlayerLevel(cid) < 15 then
doRemoveItem(stone1.uid, 1)
doSendMagicEffect(stonepos1, 14)
end
function onStepOut(cid, item, frompos, item2, topos)
doCreateItem(1304, 1, stonepos1)
doSendMagicEffect(stonepos1, 34)
end
return true
end
local s,m = 15921,'ghastly'
function onKill(cid,target)
local v = getThingPos(cid)
if getCreatureName(target):lower() == m:lower() then
setPlayerStorageValue(cid,s,1)
doSendMagicEffect(v,CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You killed Ghastly, you can now collect your reward in the west room.')
end
return true
end