• 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 Editing this lua script

sick

Member
Joined
Feb 5, 2009
Messages
258
Reaction score
6
Location
Lithuania, Vilnius
So i got this summon scroll script which is unfinished completely (It summons monster when used, removes some mana and has 20 charges, when charges are out it becomes to a piece of paper):

Code:
local config = {
	[6119] = { -- # SCROLL ID # --
		monster = "Demon Skeleton",
		charges = 20,
		mana = 600,
		summons = 2
	}
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local v = config[item.itemid]
	if table.maxn(getCreatureSummons(cid)) >= v.summons then
		return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	end
 
	if getCreatureMana(cid) < v.mana then
		return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	end
 
	if item.actionid <= 0 then
		doItemSetAttribute(item.uid, "aid", v.charges - 1)
	elseif item.actionid == 1 then
		doTransformItem(item.uid,7491)
	else
		doItemSetAttribute(item.uid, "aid", item.actionid - 1)
	end
	
	    return doPlayerAddMana(cid, - v.mana) and doSummonMonster(cid,v.monster)
end

So the question is, could anyone edit it so when pressed "look" on the scroll i would see how many charges left ( like you see Summon scroll. Charges: 17 ) . And one more thing, it would be cool if it would have like 1 sec exhaust between pressing the scroll, because now you can summon it any time, even when using sds or so.

Thanks in advance, reputation for the ones who will help for sure :thumbup:
 
Something is wrong doesn't do anything ;S and says :
PHP:
[10/09/2010 18:05:08] [Error - LuaScriptInterface::loadFile] data/actions/scripts/other/summonscroll.lua:35: 'end' expected (to close 'function' at line 13) near ')'
[10/09/2010 18:05:08] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/summonscroll.lua)
[10/09/2010 18:05:08] data/actions/scripts/other/summonscroll.lua:35: 'end' expected (to close 'function' at line 13) near ')'
 
Code:
local config = {
	[6119] = { -- # SCROLL ID # --
		monster = "Demon Skeleton",
		charges = 20,
		mana = 600,
		summons = 2
	}
}

local exhausted = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhausted, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v = config[item.itemid]
	if table.maxn(getCreatureSummons(cid)) >= v.summons then
		return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	end
 
	if getCreatureMana(cid) < v.mana then
		return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	end
	
	if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
		return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
	end
 
	if item.actionid <= 0 then
		doItemSetAttribute(item.uid, "aid", v.charges - 1)
	elseif item.actionid == 1 then
		doTransformItem(item.uid, 7491)
	else
		doItemSetAttribute(item.uid, "aid", item.actionid - 1)
	end
	
	return doPlayerAddMana(cid, - v.mana) and doSummonMonster(cid, v.monster) and doAddCondition(cid, exhausted) and doItemSetAttribute(item.uid, "description", "It has " .. item.actionid - 1 .. "x charge" .. (item.actionid > 1 and "s" or "") .. ".")
end
 
Back
Top