Titanum
New Member
- Joined
- Feb 21, 2016
- Messages
- 22
- Reaction score
- 0
Greeting otlanders
.
I've got some problems and i hope someone may help me with them, Thanks.
1- This script to charge a special weapon with runes what i need is to do limit for the charges MAX 300 charges.
2- This script is for npc who is selling coins for special id as you see (9971, 10) and its working good but when i'm trying to buy more than 1 like 10 or something it's still buys only 1 not more :S
3- I need to do broadcast message before this raid hmmm tried to do globalevent scripts and i've done it but they doesn't match together with the time :S so i need to do broadcast before every raid
4- This one is with gesior latest news, you will understand from the photo that i can't make a post on news page and i already have admin access, and the version of gesior that i have doesn't support admin panel :S
TFS 0.4
Hmm is it hard to solve?
EDIT
Website- solved
Raid- Solved
NPC- NOT SOLVED
WAND- NOT SOLVED :S
I've got some problems and i hope someone may help me with them, Thanks.
1- This script to charge a special weapon with runes what i need is to do limit for the charges MAX 300 charges.
local config = {
manaCost = 300,
soulCost = 2
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 2280 and isInArray({8300}, itemEx.itemid)) then
doTransformItem(itemEx.uid, 4848, 1)
doRemoveItem(item.uid, 1)
doSendMagicEffect(getPlayerPosition(cid), 31)
return true
elseif(item.itemid == 2280 and isInArray({4848}, itemEx.itemid)) then
local subtype = itemEx.type
doTransformItem(itemEx.uid, 4848, subtype+1)
doRemoveItem(item.uid, 1)
doSendMagicEffect(getPlayerPosition(cid), 31)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You may only use it on arrow of disaster.")
return true
end
if(isInArray(enchantableGems, item.itemid)) then
local subtype = item.type
if(subtype == 0) then
subtype = 1
end
local mana = config.manaCost
if(getPlayerMana(cid) < mana) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
return true
end
local soul = config.soulCost
if(getPlayerSoul(cid) < soul) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHSOUL)
return true
end
local a = table.find(enchantableGems, item.itemid)
if(a == nil or not isInArray(enchantingAltars[a], itemEx.itemid)) then
return false
end
local info = getItemInfo(enchantedGems[a])
doTransformItem(item.uid, enchantedGems[a], info.charges)
doPlayerAddMana(cid, -mana)
doPlayerAddSoul(cid, -soul)
doPlayerAddSpentMana(cid, mana)
doSendMagicEffect(fromPosition, CONST_ME_HOLYDAMAGE)
return true
end
local b = table.find(enchantedGems, item.itemid)
if(b == nil) then
return false
end
local subtype = itemEx.type
if(not isInArray({8300, 8300}, itemEx.itemid)) then
subtype = 1000
end
doTransformItem(itemEx.uid, enchantedItems[itemEx.itemid], subtype)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HOLYDAMAGE)
doDecayItem(itemEx.uid)
doRemoveItem(item.uid, 1)
return true
end
manaCost = 300,
soulCost = 2
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 2280 and isInArray({8300}, itemEx.itemid)) then
doTransformItem(itemEx.uid, 4848, 1)
doRemoveItem(item.uid, 1)
doSendMagicEffect(getPlayerPosition(cid), 31)
return true
elseif(item.itemid == 2280 and isInArray({4848}, itemEx.itemid)) then
local subtype = itemEx.type
doTransformItem(itemEx.uid, 4848, subtype+1)
doRemoveItem(item.uid, 1)
doSendMagicEffect(getPlayerPosition(cid), 31)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You may only use it on arrow of disaster.")
return true
end
if(isInArray(enchantableGems, item.itemid)) then
local subtype = item.type
if(subtype == 0) then
subtype = 1
end
local mana = config.manaCost
if(getPlayerMana(cid) < mana) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
return true
end
local soul = config.soulCost
if(getPlayerSoul(cid) < soul) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHSOUL)
return true
end
local a = table.find(enchantableGems, item.itemid)
if(a == nil or not isInArray(enchantingAltars[a], itemEx.itemid)) then
return false
end
local info = getItemInfo(enchantedGems[a])
doTransformItem(item.uid, enchantedGems[a], info.charges)
doPlayerAddMana(cid, -mana)
doPlayerAddSoul(cid, -soul)
doPlayerAddSpentMana(cid, mana)
doSendMagicEffect(fromPosition, CONST_ME_HOLYDAMAGE)
return true
end
local b = table.find(enchantedGems, item.itemid)
if(b == nil) then
return false
end
local subtype = itemEx.type
if(not isInArray({8300, 8300}, itemEx.itemid)) then
subtype = 1000
end
doTransformItem(itemEx.uid, enchantedItems[itemEx.itemid], subtype)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HOLYDAMAGE)
doDecayItem(itemEx.uid)
doRemoveItem(item.uid, 1)
return true
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler
nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler
nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler
nCreatureSay(cid, type, msg) end
function onThink() npcHandler
nThink() end
local shopWindow = {}
local keys = {
{id = 10571, buy = 10, name = "COIN"}
}
local cost = {9971, 10}
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
if doPlayerRemoveItem(cid, cost[1], cost[2]) then
local thing = doPlayerAddItem(cid, shopWindow[item].ID)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought a "..shopWindow[item].KeyName.." for gold.")
else
selfSay("You don't have enough money.", cid)
end
return true
end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if msgcontains(msg, 'trade') then
for var, item in pairs(keys) do
shopWindow[item.id] = {ID = item.id, Price = item.buy, KeyName = item.name}
end
openShopWindow(cid, keys, onBuy, onSell)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler
function onCreatureDisappear(cid) npcHandler
function onCreatureSay(cid, type, msg) npcHandler
function onThink() npcHandler
local shopWindow = {}
local keys = {
{id = 10571, buy = 10, name = "COIN"}
}
local cost = {9971, 10}
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
if doPlayerRemoveItem(cid, cost[1], cost[2]) then
local thing = doPlayerAddItem(cid, shopWindow[item].ID)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought a "..shopWindow[item].KeyName.." for gold.")
else
selfSay("You don't have enough money.", cid)
end
return true
end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if msgcontains(msg, 'trade') then
for var, item in pairs(keys) do
shopWindow[item.id] = {ID = item.id, Price = item.buy, KeyName = item.name}
end
openShopWindow(cid, keys, onBuy, onSell)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
<?xml version="1.0" encoding="UTF-8" ?>
- <raid>
<singlespawn delay="1" name="Devento" ref="yes" x="996" y="993" z="7" />
</raid>
- <raid>
<singlespawn delay="1" name="Devento" ref="yes" x="996" y="993" z="7" />
</raid>
<?xml version="1.0" encoding="UTF-8" ?>
- <raids>
<raid name="Devento" file="Devento.xml" interval2="60" margin="0" reftype="block" ref="no" />
- <!--
executed on average once every 2 minutes
<raid name="Example" file="example.xml" interval2="2" margin="0" reftype="single" ref="no"/>
won't be executed again till Cave Rat gets killed
<raid name="Example2" file="example.xml" interval2="2" margin="0" reftype="block" ref="no"/>
will stay as 'running' until Cave Rat gets killed
-->
</raids>
- <raids>
<raid name="Devento" file="Devento.xml" interval2="60" margin="0" reftype="block" ref="no" />
- <!--
executed on average once every 2 minutes
<raid name="Example" file="example.xml" interval2="2" margin="0" reftype="single" ref="no"/>
won't be executed again till Cave Rat gets killed
<raid name="Example2" file="example.xml" interval2="2" margin="0" reftype="block" ref="no"/>
will stay as 'running' until Cave Rat gets killed
-->
</raids>
TFS 0.4
Hmm is it hard to solve?
EDIT
Website- solved
Raid- Solved
NPC- NOT SOLVED
WAND- NOT SOLVED :S
Last edited: