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

[Support] Spell System

Shinmaru

エロルアー Scripter!
Joined
Aug 20, 2007
Messages
1,988
Reaction score
88
Location
Puerto Rico
ok, I'm making a spell system using talkactions as the base,
now before you say this is useless, let me explain, the reason
on this is that i want to make it that if you say the magical words
they will do the actions that are stated in another lua script, this
helps me in some special vocations that I plan to make, so
here is the script so far and i want to know if commands can be
executed from a lua script using dofile('lua name here.lua') :
LUA:
local customSpell = {
	[words = "helgana"] = {spellName = "Hell's Release", spend1 = 100, spend2 = 200, vocation = {4, 8}, file = 'helgana.lua'}
	}
function onSay(cid, words)
	for spell, info in pairs(customSpell) do
		if words == spell.words then
			if isInArray(info.vocation, getPlayerVocation(cid)) then
				if info.spend1 ~= 0 then
					doCreatureAddHealth(cid, -info.spend1)
				end
				if info.spend2 ~= 0 then
					doCreatureAddMana(cid, -info.spend2)
				end
				if info.file ~= ('') then
					dofile(info.file)
				else
					doPlayerSendTextMessage(cid, 25, "No file specified.")
				end	
			else
				doPlayerSendCancel(cid, "You can't use this spell due to your vocation.")
		end
	end
return true
end
will really appreciate your cooperation on this.
 
After dofile, add:
Code:
onCastSpell(cid, numberToVariant(getCreatureTarget(cid)))
? :D



or idk, maybe it won't get combats because they're local :s
 
dofile only loads variables and functions from the file (unless they're local?), so after they're loaded you have function onCastSpell. All that remains then is to call it with the correct parameters :p
 
Back
Top