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

Solved Spell System

Skrypton

Unknown
Joined
Aug 23, 2014
Messages
105
Reaction score
28
-- Problem --
Heya everyone, I'm using TFS 1.0 and I've encountered a weird spell error. It's like the two spells are reading functions from eachother. For example, if I change the crit chance on one spell (Hells core.lua) it'll change for both, flame strike and hells core. I'm not sure what could possibly cause this? Anyone got any ideas? All are appreciated!
-- Problem --

-- Solution --
Thanks for everything! I think the problem was, the local functions were below the main functions. So when they were called in the main function, they weren't being recognized.
-- Solution --
 
Last edited:
That's not the whole script. They are being passed from the onCastSpell function. However, it'll probably help if I post the whole script
I had a problem with it interfering with a whole other spell so I put all the made-functions to local and it solved it... but there's probably some other errors there as well.
 
Last edited:
What exactly are you trying to do? ...
I'm sorry, I didn't really answer that.. I'm just trying to shorten the code. It's working just fine it's just I would like to shorten it. I thought the way posted above would work but I guess not :x haha
 
Add the variables in the functions where you used them aswell. If you define a variable in a function, in an other function it will still be nil. Use cid as parameter in the functions where it isn't used yet.
Example
~~
firstCrit = checkCrit(cid)

local function checkCrit(cid)
~~
If you are going to use cid in a function, then the function needs cid as parameter, else cid is nil.

If you use player for metatable functions, then also define it above where it's used in every function.
Code:
player = Player(cid)
 
shall all the spells you declare scale with just this one storagevalue or do they yield each their own storagevalue?
edit @Limos cid in onCastSpell is already a creaturetable :p
it's normaly onCastSpell(creature, var)
 
@Evil Hero They each have a storage value that declares how many times they've upgraded the spell (Thanks to Limos for helping me and Nik get started a while ago)

@Limos Omg, thank you! I didn't know you could call (cid) as a pre-defined parameter! I thought I would have to send it through onCastSpell(cid, var) or something lame xD You just made it a lot easier to make variables local xD

-- Edit --
Updated main post, thank you for responding so quickly though guys!
 
Last edited:
Back
Top Bottom