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

A function with a param spell

Siegh

Thronar Developer
Joined
Mar 12, 2011
Messages
1,186
Solutions
1
Reaction score
510
Location
Brazil
Ive been trying to script something related to a param spell (such as exura sio, which requires a name between " " to work). The problem is, I cant find a way to reach the target of the spell, since its not by normal targetting (right clicking).

My request is that someone please make this below work, since I will use it as a base to the most variated scripts. Remember, getCreatureTarget won't work.

Code:
onCastSpell(cid, var)

doPlayerSendTextMessage(xxx, 22, "Hi")

return true
end

Thanks in advance!

PS: I might have posted this in the wrong section, but Im not sure.
 
try like:
put that into your spells.xml
XML:
params="1"
then do it like:
Lua:
onCastSpell(cid, var)

doPlayerSendTextMessage(getCreatureByName(var), 22, "Hi")

return true
end
If you set params="1" at spells, then the var in your function will reflect the param.

just looked it up at sources, should be working.


kind regards, Evil Hero.
 
Lua:
function onCastSpell(cid, var)
	return doPlayerSendTextMessage(cid, 22, "msg")
end

Lua:
function onCastSpell(cid, var)
	return doPlayerSendTextMessage(var, 22, "msg")
end

Lua:
function onCastSpell(cid, var)
if (isPlayer(cid)) then
 doPlayerSendTextMessage(cid, 22, "msg")
end
end

Lua:
function onCastSpell(cid, var)
if (isPlayer(cid)) then
 doPlayerSendTextMessage(var, 22, "msg")
end
end

Try these.... if they dont work.... You can make it a talkaction, it will work just the same.
Lua:
function onSay(cid, words, param, channel)
if (param == "spell words") then
t = string.explode(param,",")

t[1] = target

if (isPlayer(target)) then
   doPlayerSendTextMessage(target, 22, "msg")
else
  doPlayerSendCancel(cid, "You must type the name of a player to use this spell!")
return false
end
end
end

If you want a multi worded spell it may have to be configured differently.
 
Last edited:
The spell forms didnt worked, and yes, Im aware I can do them as talkactions. But since Id implement this on many spells already done, I wouldnt like to change them all into talkactions. Seems like I will have to leave this idea behind.

Thanks for trying though.
 
Lua:
function onCastSpell(cid, var)
    local target = variantToNumber(var)
    if isCreature(target) then
        doPlayerSendTextMessage(target, 22, "Hi")
    end
    -- doCombat?
    return true
end
 
Back
Top