Apollos's best answers

  • Apollos

    Lua Globalevent dont start

    You're activating the event at hour 17 yet you are only allowing the prepareShutdown func to run if the hour is 3. There's no need to have that part in the if statement. I don't see a need to check the server uptime either. Just run the prepareShutdown func without any conditional statements...
  • Apollos

    Annihilator tile does not exist (Problem)

    You show this error, 552, 823, 8: This position 552, 823, 8 is not written in your script anywhere. Also, your positions change from 552 to 522, read code comments here to help you understand what I'm saying: local player_positions = { [1] = {fromPos = Position(552, 821, 8), toPos =...
  • Apollos

    You may not logout icon

    Untested so let me know how it goes. Remove this if statement section: In Fight Icon Within Protection Zone Then replace this line: Logout Protection Zone With this: if (player->hasCondition(CONDITION_INFIGHT)) { If you only want the icon to remain but still allow players to logout in PZ...
  • Apollos

    Lua NPC Interface

    You're missing the cid on line 30. It should be npcHandler:say(thinkMsg[rand], cid). EDIT: Just noticed that it was onThink function. You don't have access to cid during think callbacks. So the best way to do this is to either set up a VoiceModule which can be found in otland and some other...
  • Apollos

    TFS 1.2 doubt spectators

    Variables target and player are useless. Also this will cause errors if the spectator does not have a master. You must check if there's a master first then have the spec say it's name. function onCastSpell(creature, variant) for key, spec in pairs(Game.getSpectators(creature:getPosition()...
  • Apollos

    TFS 1.2 Help With Spell

    You can try this out, I tried to use your example but it didn't work at all so I'm not sure exactly what you want. Let me know. Add these in data/lib/core/position.lua: function Position:isClear(checkCreatures) local tile = Tile(self) if not tile then return false end...
  • Apollos

    Custom Heal Friend

    You have to use variant:getNumber() instead of getString() because in this case the variant will only return a unique id of the creature. Also it's a good idea to verify that target exists before you attempt to use other function with it. So try this out: function onCastSpell(creature, variant)...
  • Apollos

    [please move to Support] AddItem do a corpse after kill it

    Try this out: local vocation_items = { [1] = {2160, 100}, -- Sorcerer [2] = {2160, 100}, -- Druid [3] = {2160, 100}, -- Paladin [4] = {2160, 100}, -- Knight } function onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified) if not corpse or not killer or not...
  • Apollos

    Lua script

    If you want the vocation to determine if ALL these functions should work then do this: local storage = 30018 function onUse(player, item, fromPosition, target, toPosition, isHotkey) local voc_id = player:getVocation():getId() if voc_id ~= 0 and voc_id < 5 and...
  • Apollos

    Different starting level, health, mana, and townID based on player vocation

    Here's the login script, you can adjust the vocations table to fit what you need for each vocation. local vocations = { [1] = {town_id = 1, max_health = 100, max_mana = 100, max_cap = 100}, -- Sorcerer [2] = {town_id = 2, max_health = 100, max_mana = 100, max_cap = 100}, -- Druid...
  • Apollos

    TFS 0.X keep walking if you drop connection

    The server is what will keep track of where you are on the map, so even if you are disconnected and still move it will be fine. The tricky part will be checking if the player is actually disconnected and make them walk from there. This thread may help you with inspiration on how to do it...
  • Apollos

    TFS 1.X+ Spell area varying according to player position

    There's are some variations you aren't addressing, like if the target is farther away but only offset by one SQM, this results in only a wave of 2 SQM. I did my best and this is what I came up with. During testing I had it set to target needed and range at 7. local combat = createCombatObject()...
  • Apollos

    Lua script edit help

    Your descriptions are very hard to understand. If this is what you want great, but otherwise idk how to help, sorry man. local event_duration = 3 * 60 local event_interval = 2 local switch_pos = {x = 33199, y = 31648, z = 15} local positions = { {x = 33201, y = 31646, z = 15}, {x =...
  • Apollos

    Random item from chest.

    I hope I understood what you needed. Try this, it's untested. local storage_id = 2544 local static_rewards = { [1] = {chest_uid = 1575, reward_id = 16857, reward_count = 25} } local random_rewards = { [1] = {chest_uid = 1575, reward_id = 100, reward_count = 1}, [2] = {chest_uid =...
  • Apollos

    How to do spell "ultimate explosion" with paralyze?

    You should post your distro version within support threads to get the correct help. Only thing I can see is your have an extra parameter set on the ticks part. Or maybe your formula is wrong and messing things up. Here's an example of one done in a TFS 0.4 script (assuming this is your...
  • Apollos

    Export/Import Map (RME) ?

    Downgrading then copy pasting is the only way I know of. There is the potential of the map getting messed up in areas that don't have the sufficient sprites in lower versions but you just gotta spend the time to fix the problem areas. If you don't know how to select large areas, you make sure...
  • Apollos

    How to create an item and then remove it with certain time? (using addEvent)

    I'm not the best at older tfs version but I hope this helps. Some notes: Your tabbing could use some work. It can really improve the readability of your scripts. You can put things that stay static locally outside of the function because there's no need to recreate them every time the function...
  • Apollos

    Change in PvP system

    Like this? Register in login.lua. local exp_percent = 2 function onKill(creature, target) if creature:isPlayer() and target:isPlayer() then if target:getLevel() >= creature:getLevel() then creature:addExperience(math.floor(target:getExperience() * (exp_percent / 100)))...
  • Apollos

    TFS 1.X+ NPC says first time

    local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid)...
  • Apollos

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

    In luascript.cpp within pushInstantSpell function: after: setField(L, "name", spell.getName()); put this: setField(L, "spellid", spell.getSpellId()); then in spells.h after this: bool configureSpell(const pugi::xml_node& node); const std::string& getName() const {...
Top