• 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!

From action to spell xD

Status
Not open for further replies.
Joined
Jun 19, 2009
Messages
1,852
Reaction score
5
Hello!

Could some1 make this action script to spell script?

Code:
local t = {
  name = 'Kalle',
  limit = 2,
  vocation = 'Paladin'
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
  local full_mp = getCreatureMaxMana(cid)
  local foo = _G['is' ..t.vocation]
  if foo and foo(cid) then
    if #getCreatureSummons(cid) < t.limit then
            if getCreatureMana(cid) == full_mp then
      doCreatureAddMana(cid, -full_mp)
      local ret = doSummonMonster(cid, t.name)
      doCreatureSay(cid,"Summon: Kalle!",TALKTYPE_ORANGE_1)
      if ret ~= RETURNVALUE_NOERROR then
        doPlayerSendDefaultCancel(cid, ret)
end
      end
    else
      doPlayerSendCancel(cid, "You cannot summon more creatures.")
    end
  else
    doPlayerSendCancel(cid, "Only Paladins can summon me.")
  end
  return true
end

Script by Cykotitan

thanks!
 
theres no way to do it because of the;
Code:
	<instant name="Summon Creature" words="utevo res" lvl="25" params="1" exhaustion="2000" needlearn="0" [B][COLOR="Red"]event="function"[/COLOR][/B] value="summonMonster">
		<vocation id="1"/>
		<vocation id="2"/>
		<vocation id="5"/>
		<vocation id="6"/>
	</instant>
do it by a talkaction better
 
PHP:
local t = {
  name = 'Rat',
  limit = 2
}

function onCastSpell(cid, var)
	if getCreatureMana(cid) ~= getCreatureMaxMana(cid) then
		return (doPlayerSendDefaultCancel(cid, 36) and doSendMagicEffect(getPlayerPosition(cid),2))
	end
	if #getCreatureSummons(cid) >= t.limit then
		return (doPlayerSendCancel(cid, "You cannot summon more creatures.") and doSendMagicEffect(getPlayerPosition(cid),2))
	end
	
	local ret = doSummonMonster(cid, t.name)
	if ret ~= RETURNVALUE_NOERROR then
		doPlayerSendDefaultCancel(cid, ret)
		return true
	end
	doCreatureSay(cid,"Summon: Kalle!",TALKTYPE_ORANGE_1)
	doCreatureAddMana(cid, (-getCreatureMaxMana(cid)))
	return true
end
Here your script as spell

Note:Set the manacost in spells.xml to 0 because the spell will take mana. If you set manacost in spell it may happen that mana is lost but no monster is summoned..
 
Status
Not open for further replies.
Back
Top Bottom