Caduceus
Unknown Member
- Joined
- May 10, 2010
- Messages
- 321
- Solutions
- 2
- Reaction score
- 24
I have the socket version currently implemented into my server. However, when a normal player kills a monster with the tag of <flag rewardboss="1"/>, they recieve the message, "You are not the owner." and receive no loot. On the other hand, if I use /m & place monster, everything works as intended.
place_monster.lua
I have already tried to use a script to make the monster use isRewardBoss, but this also did not register the reward.
Do I have to modify the Game.createMonster function to include the isRewardBoss functions to make the monsters spawned on map use the <flag rewardboss="1"/> flag? if so how do I do this?
place_monster.lua
Lua:
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local position = player:getPosition()
local monster = Game.createMonster(param, position)
if monster ~= nil then
if monster:getType():isRewardBoss() then
monster:setReward(true)
end
monster:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
position:sendMagicEffect(CONST_ME_MAGIC_RED)
else
player:sendCancelMessage("There is not enough room.")
position:sendMagicEffect(CONST_ME_POFF)
end
return false
end
I have already tried to use a script to make the monster use isRewardBoss, but this also did not register the reward.
Code:
<monster name="Monster" species="undead" nameDescription="Monster" race="undead" experience="0" speed="300" manacost="0" script="boss.lua">
Lua:
function onCreatureAppear(self, creature)
if self == creature then
if self:getType():isRewardBoss() then
self:setReward(true)
end
end
end
Do I have to modify the Game.createMonster function to include the isRewardBoss functions to make the monsters spawned on map use the <flag rewardboss="1"/> flag? if so how do I do this?
C++:
int LuaScriptInterface::luaGameCreateMonster(lua_State* L)
{
// Game.createMonster(monsterName, position[, extended = false[, force = false]])
Monster* monster = Monster::createMonster(getString(L, 1));
if (!monster) {
lua_pushnil(L);
return 1;
}
const Position& position = getPosition(L, 2);
bool extended = getBoolean(L, 3, false);
bool force = getBoolean(L, 4, false);
if (g_game.placeCreature(monster, position, extended, force)) {
pushUserdata<Monster>(L, monster);
setMetatable(L, -1, "Monster");
} else {
delete monster;
lua_pushnil(L);
}
return 1;
}