• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Search results

  1. Z

    Lua Only in protection zone

    You may try changing this: db.query("UPDATE `player_deaths` SET `unjustified` = 0 WHERE `unjustified` = 1 AND `killed_by` = " .. db.escapeString(player:getName())) to db.query("UPDATE `player_deaths` SET `unjustified` = 0, `mostdamage_unjustified` = 0 WHERE `unjustified` = 1 AND `killed_by`...
  2. Z

    How do you hide this icon?

    creatureType will be CREATURETYPE_SUMMON_OTHERS, thus showing the red shield icon. CREATURETYPE_MONSTER on the other hand will let client application treat it as a regular monster - no shield icon. So you should use void Game::updateCreatureType(Creature* creature) implementation from #4. I'm...
  3. Z

    Lua Only in protection zone

    Yeas, you're right, it should be ":" instead of "::". I've made the change in my original answer for other people who may miss your post. Great it works, just make sure it works as expected if you try to use it on another player / creature / item.
  4. Z

    How do you hide this icon?

    You're right, damn.. my mistake, the CREATURETYPE_MONSTER should be used in "else" clause instead of creatureType variable, updated it there (#4). I think I should post it in Resources subforum and link here, instead of having all these changes spead over the thread.
  5. Z

    Lua Only in protection zone

    function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey) if not player:getTile():hasFlag(TILESTATE_PROTECTIONZONE) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only remove skulls in protection zone!")...
  6. Z

    How do you hide this icon?

    Yes, I agree that removing parts of the function is better if you know what you're doing :) but for someone who just wants to copy&paste code, it is better to replace whole function definition, because identifying function block seems easier. I think you just spotted a mistake! Fixed code: void...
  7. Z

    Lua Check items in bp

    local config = { 2160, } local function checkItems(playerUid, items) local player = Player(playerUid) if not player then return false end for i = 1, #items do if player:getItemCount(items[i]) > 0 then npcHandler:say('Remove the items first.', cid) else...
  8. Z

    Lua Why this potion ends?

    Yes, sure. But you could also infer this by comparing your potions.lua with mine potions.lua. Basically I removed all parts responsible for transforming potion item to empty vial and all parts that would act on this new empty vial (stacking empty vials, etc.).
  9. Z

    How do you hide this icon?

    TFS 1.0? You'll have to compile it yourself though. game.cpp, find void Game::updateCreatureType(Creature* creature) method and replace it with: The following code is not 100% correct, see How do you hide this icon? void Game::updateCreatureType(Creature* creature) { const Player*...
  10. Z

    Lua Why this potion ends?

    Ok, so you use potions.lua for these potions that should not end? Second script from your original post? And you want all these potions to never end? Can you replace your potions.lua with this? local config = { usableOnTarget = "yes", -- can be used on target? (fe. healing friend)...
  11. Z

    C++ Set Creature Name (need help with source)

    The "workaround" is really not a workaround, because it will send information about convincing creature to the client, not to change the name. This is just something I wanted to show you that happens on convincing the creature. Basically you need to inform all spectators of that change. But I am...
  12. Z

    onBlock/blockHit function?

    I'm not sure this will work, as you can see yourself, it's onHealthChange(), shield block will not change player's health. I am checking it now in source just to be 100% sure. Confirmed. To execute onHealthChange monster must deal damage to you :) As a hint: check combat.cpp...
  13. Z

    Lua Why this potion ends?

    Okay, I understand that you want to create new health potion, but what item Id does it use? Like I told you already, my guess is this potion of yours uses potions.lua, not your custom script and potions.lua remove charges. That would also be consistent with what you're saying about removing...
  14. Z

    C++ Set Creature Name (need help with source)

    Yes, this code is there, but it is not executed when you set new name to a monster. This is just an example I pointed out to show what happens when monster is added (summoned or spawned) - spectators are made aware of this event, this is missing from the code you linked to - it only changes the...
  15. Z

    C++ Set Creature Name (need help with source)

    I recently wrote a post in the linked thread with "a bit" harder possibility of solving this. Your suggestions, while hacky, seems to be pretty easy to implement and would solve the problem I guess.
  16. Z

    Lua How to set spell target without attacking?

    Alright, this would make more sense than my interpretation. If that's the case I also think onUse script would be correct way to do this and seems like the only possibility as well - unless you use OTClient to mimic 'use with' behavior when casting a spell.
  17. Z

    Feature setCreatureName & monster:setName for TFS 1.2

    You should probably move your updated methods from monsters.h to monsters.cpp, as they are no longer single getters (get* methods). Just have a look how it's done in case of DepotChest class and DepotChest::getRealParent() (simple getter) compared to DepotChest::getParent() (one if statement)...
  18. Z

    Lua Another way to create FIREFIELD

    isHotkey has no purpose here :) I just took it from the "best anwer" post, not being aware there's a onCastSpell signature taking only cid and var arguments - I'm not up-to-date with OTS development :)
  19. Z

    Lua How to set spell target without attacking?

    I'm not sure I understand the question, would you perhaps be able to rephrase it? Correct me if I'm wrong, but do you want a talkAction (player says something) to "open" (as in, open the door?)? Something like a "secret password"? :)
  20. Z

    Lua Another way to create FIREFIELD

    I can agree the isHotkey here is not necessary. As for the script, look at it once again and try to follow both execution paths available :) This is equivalent of your script, just shorter. end here will only close if statement, the rest of the code will be executed every time. The optional...
Back
Top