This part i think it have it. Trued to print damage but it always say the same for all character, like it doesnt share the damage. Would be awesome if someone could give some light on the issue, or at leaat tell me if its only not working fine to me! Thank you all!
- function BossLoot:updateDamage()
- if self.creature then
- local tmp = {}
- local totaldmg = 0
- for killer, damage in pairs(self.creature:getDamageMap()) do
- totaldmg = totaldmg+damage.total
- tmp[killer] = damage.total
- end
- self.players = sort_descending(tmp)
- self.totaldmg = totaldmg
- else
- error("Creature not found.")
- end
- end
- function BossLoot:setRewards()
- if self.totaldmg and self.creature then
- if getConfigInfo("rateLoot") > 0 then
- local mt = MonsterType(self.creature:getName())
- for i, playertab in ipairs(self.players) do
- local loot
- if i == 1 then
- loot = mt:getBossReward(playertab[2] / self.totaldmg, true)
- else
- loot = mt:getBossReward(playertab[2] / self.totaldmg, false)
- end
- table.insert(self.players, loot)
- end
- end
- else
- error("Error")
- end
- end
src/luascript.cpp: In static member function ‘static int LuaScriptInterface::luaItemGetNameDescription(lua_State*)’:
src/luascript.cpp:11698:55: error: ‘it’ was not declared in this scope
const std::string& name = (item ? item->getName() : it.name);
^
src/luascript.cpp:11702:3: error: ‘s’ was not declared in this scope
s << subType << ' ';
^
src/luascript.cpp:11712:3: error: ‘s’ was not declared in this scope
s << article << ' ';
^
src/luascript.cpp:11716:3: error: ‘s’ was not declared in this scope
s << name;
^
src/luascript.cpp:11720:3: error: ‘s’ was not declared in this scope
s << "an item of type " << it.id;
^
src/luascript.cpp:11722:17: error: ‘s’ was not declared in this scope
pushString(L, s.str());
^
src/luascript.cpp: At global scope:
src/luascript.cpp:12775:10: error: expected constructor, destructor, or type conversion before ‘(’ token
pushLoot(L, monsterType->info.lootItems);
^
src/luascript.cpp:12776:2: error: expected unqualified-id before ‘return’
return 1;
^
src/luascript.cpp:12777:1: error: expected declaration before ‘}’ token
}
^
Ok, just to help people with TFS 1.3
in src/depotchest.cpp:
Change
TFS 1.2 was maxDepotItems = 1500;Code:Container(type), maxDepotItems(1500) {}
For
Code:Container(type), maxDepotItems(1500), depotId(0) {}
in src/monsters.h
Below...
Code:bool hiddenHealth = false
...Add
Code:bool rewardChest = false;
and also ignore this change
in src/monsters.cpp
Below...
Code:} else if (strcasecmp(attrName, "hidehealth") == 0) { mType->info.hiddenHealth = attr.as_bool();
...Add
(mType->rewardChest now is mType->info.rewardChest)Code:} else if (strcasecmp(attrName, "rewardchest") == 0) { mType->info.rewardChest = attr.as_bool();
after your changes in src/luascript.cpp
Back there and change:
Code:pushBoolean(L, monsterType->rewardChest);
For:
Code:pushBoolean(L, monsterType->info.rewardChest);
Change:
Code:parseLoot(monsterType->lootItems);
For:
Code:parseLoot(monsterType->info.lootItems);
Everything is working fine here, with the TFS 1.3 master![]()
Scanning dependencies of target theforgottentibia
[ 1%] Building CXX object CMakeFiles/theforgottentibia.dir/src/actions.cpp.o
In file included from /home/novoc/src/player.h:36,
from /home/novoc/src/game.h:30,
from /home/novoc/src/actions.cpp:26:
/home/novoc/src/depotlocker.h: In member function ‘void DepotLocker::setMaxLockerItems(uint32_t)’:
/home/novoc/src/depotlocker.h:51:9: error: ‘uint32_t Container::maxSize’ is private within this context
51 | maxSize = maxitems;
| ^~~~~~~
In file included from /home/novoc/src/actions.cpp:25:
/home/novoc/src/container.h:157:12: note: declared private here
157 | uint32_t maxSize;
| ^~~~~~~
make[2]: *** [CMakeFiles/theforgottentibia.dir/build.make:91: CMakeFiles/theforgottentibia.dir/src/actions.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:180: CMakeFiles/theforgottentibia.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Someone else mentioned that u need to move uint32_t maxSize; from 'private' to 'public' function for it to work , perhaps that will fix the problem?Hello guys!
I'm using this server as a base: The Forgotten Tibia (no vocations, new skills, skills by points, dual wield, auto loot, quiver, etc)
Following this tutorial, starting with part TFS 1.2 and editing the fixes for TFS 1.3, I got the following errors:
C++:Scanning dependencies of target theforgottentibia [ 1%] Building CXX object CMakeFiles/theforgottentibia.dir/src/actions.cpp.o In file included from /home/novoc/src/player.h:36, from /home/novoc/src/game.h:30, from /home/novoc/src/actions.cpp:26: /home/novoc/src/depotlocker.h: In member function ‘void DepotLocker::setMaxLockerItems(uint32_t)’: /home/novoc/src/depotlocker.h:51:9: error: ‘uint32_t Container::maxSize’ is private within this context 51 | maxSize = maxitems; | ^~~~~~~ In file included from /home/novoc/src/actions.cpp:25: /home/novoc/src/container.h:157:12: note: declared private here 157 | uint32_t maxSize; | ^~~~~~~ make[2]: *** [CMakeFiles/theforgottentibia.dir/build.make:91: CMakeFiles/theforgottentibia.dir/src/actions.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:180: CMakeFiles/theforgottentibia.dir/all] Error 2 make: *** [Makefile:84: all] Error 2
I put at disposal all the files mentioned in the error console:
Action.cpp, container.h, depotlocker.h, game.h and player.h
I am very grateful in advance for any help! 😍😘🥰
Anyone else got problems with the script? im using tfs 1.3 and its crashing after i kill the boss and then kill normal monster which doesnt have 'reward-chest' flag, anyone had similar problem?
I have not unfortunately@Sopago I'm also experiencing the crashing after killing a boss and then a normal mob. Did you ever figure that out?
TFS 1.3 followed all the directions for upgrading it to 1.3 and it is working. Generates loot in the chest, just crashes the server if you kill a mob, then a boss, or a boss then a mob.
Solved this, but I also get the same problem as earlier comments. Killing too many bosses or killing normal mobs after a boss makes TFS shut down. Did anyone figure it out?