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

TFS 1.X+ tfs 1.3 have function to get spellID? inside spells.xml?

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
Hello, if i want to get a level of a spell i use:
Code:
" .. spell.level .. "
if i wand a name, i use:
Code:
" .. spell.name .. "

but if i need to get spell id, how i can do it? have some funciton to get the spell id?
spell.spellid doenst exist, give a "nil value"
 
Solution
Hello, if i want to get a level of a spell i use:
Code:
" .. spell.level .. "
if i wand a name, i use:
Code:
" .. spell.name .. "

but if i need to get spell id, how i can do it? have some funciton to get the spell id?
spell.spellid doenst exist, give a "nil value"
In luascript.cpp within pushInstantSpell function:
after:
C++:
setField(L, "name", spell.getName());

put this:
C++:
setField(L, "spellid", spell.getSpellId());

then in spells.h
after this:
C++:
        bool configureSpell(const pugi::xml_node& node);
        const std::string& getName() const {
            return name;
        }

put this:
C++:
        uint8_t getSpellId() const {
            return spellId;
        }

compile and you should be able to use...
Hello, if i want to get a level of a spell i use:
Code:
" .. spell.level .. "
if i wand a name, i use:
Code:
" .. spell.name .. "

but if i need to get spell id, how i can do it? have some funciton to get the spell id?
spell.spellid doenst exist, give a "nil value"
In luascript.cpp within pushInstantSpell function:
after:
C++:
setField(L, "name", spell.getName());

put this:
C++:
setField(L, "spellid", spell.getSpellId());

then in spells.h
after this:
C++:
        bool configureSpell(const pugi::xml_node& node);
        const std::string& getName() const {
            return name;
        }

put this:
C++:
        uint8_t getSpellId() const {
            return spellId;
        }

compile and you should be able to use it the way you originally intended.
 
Solution
Back
Top