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

For some reason vocation id for spells doesnt work

Lopaskurwa

Active Member
Joined
Oct 6, 2017
Messages
873
Solutions
2
Reaction score
49
Hi,
so i have a weird problem maybe its a source problem or i dont know so basically before i used <vocation name="Knight"/> for spells, so then i noticed that i wasnt able to do spells because i have vocations that have same name because i use it for transforms, so if you are first Knight, spells will work but if you transform to second Knight you wont be able to do spells anymore. So i came with solution to use <vocation id=""/> because then you will be able to use spells even when vocation names are the same because its based on id, and still to use vocation id is way better then name. So the problem is that vocation id doesnt work if that spell doesnt have your vocation id you still can use his spell. TFS 1.2
 
Solution
Hi,
so i have a weird problem maybe its a source problem or i dont know so basically before i used <vocation name="Knight"/> for spells, so then i noticed that i wasnt able to do spells because i have vocations that have same name because i use it for transforms, so if you are first Knight, spells will work but if you transform to second Knight you wont be able to do spells anymore. So i came with solution to use <vocation id=""/> because then you will be able to use spells even when vocation names are the same because its based on id, and still to use vocation id is way better then name. So the problem is that vocation id doesnt work if that spell doesnt have your vocation id you still can use his spell. TFS 1.2
Looks like your...
Hi,
so i have a weird problem maybe its a source problem or i dont know so basically before i used <vocation name="Knight"/> for spells, so then i noticed that i wasnt able to do spells because i have vocations that have same name because i use it for transforms, so if you are first Knight, spells will work but if you transform to second Knight you wont be able to do spells anymore. So i came with solution to use <vocation id=""/> because then you will be able to use spells even when vocation names are the same because its based on id, and still to use vocation id is way better then name. So the problem is that vocation id doesnt work if that spell doesnt have your vocation id you still can use his spell. TFS 1.2
Looks like your issues is here:
otland/forgottenserver (https://github.com/otland/forgottenserver/blob/bcb86eac0655c58b8dc9a35c652f8953a0edd033/src/spells.cpp#L512)

You can try this but I'm no pro at C++
C++:
for (auto vocationNode : node.children()) {
    if (!(attr = vocationNode.attribute("id"))) {
        continue;
    }

    int32_t vocationId = pugi::cast<uint32_t>(attr.value());
    if (vocationId != -1) {
        attr = vocationNode.attribute("showInDescription");
        vocSpellMap[vocationId] = !attr || attr.as_bool();
    } else {
        std::cout << "[Warning - Spell::configureSpell] Wrong vocation id: " << attr.as_string() << std::endl;
    }
}

Be aware my attempt is to remove name and instead use id so name won't work with this.
 
Solution
Looks like your issues is here:
otland/forgottenserver (https://github.com/otland/forgottenserver/blob/bcb86eac0655c58b8dc9a35c652f8953a0edd033/src/spells.cpp#L512)

You can try this but I'm no pro at C++
C++:
for (auto vocationNode : node.children()) {
    if (!(attr = vocationNode.attribute("id"))) {
        continue;
    }

    int32_t vocationId = pugi::cast<uint32_t>(attr.value());
    if (vocationId != -1) {
        attr = vocationNode.attribute("showInDescription");
        vocSpellMap[vocationId] = !attr || attr.as_bool();
    } else {
        std::cout << "[Warning - Spell::configureSpell] Wrong vocation id: " << attr.as_string() << std::endl;
    }
}

Be aware my attempt is to remove name and instead use id so name won't work with this.
It works thanks a lot. Its all good if there is no name because there is no point even to use names when i have characters with same names
 
Back
Top