Gubailovo
Well-Known Member
- Joined
- Dec 19, 2013
- Messages
- 407
- Solutions
- 2
- Reaction score
- 62
I asked a question in the main thread, but no one answered me.
I'll ask in support.
twdHammer.lua
10.98 TFS1.3
a more detailed description of the error
Tower Defense Event [TFS 1.0 / 1.1]
Hello, well i thougt about release a christmas present to everyone in otland. Here you go guys: Cheers @Ninja and @Limos for the help :) Features: Unlimited waves can be configured! Monsters health, gold drop and speed can be configured! Different monsters, counts and space between the...
otland.net
C++:
Lua Script Error: [Action Interface]
data/actions/scripts/twdHammer.lua:onUse
data/actions/scripts/twdHammer.lua:8: attempt to call method 'Tile' (a nil value)
stack traceback:
[C]: in function 'Tile'
data/actions/scripts/twdHammer.lua:8: in function <data/actions/scripts/twdHammer.lua:3>
Lua:
dofile('data/libs/TWD/towerDefenseLib.lua')
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(playingGameStorage) ~= 1 then
return false
end
local tile = toPosition:getTile()
if tile then
if not tile:hasFlag(TILESTATE_PROTECTIONZONE) or tile:hasProperty(CONST_PROP_IMMOVABLEBLOCKSOLID) then
player:sendCancelMessage("You cannot place the turret here.")
return true
end
end
if target:isItem() then
local modalWindow = ModalWindow(100, "Build Turret", "Here you can select variations of turrets to build.")
local turret, cfgTable = turrets.allTurretsId
for i = 1, #turret do
turret = turrets.allTurretsId[i]
cfgTable = turrets[turret].cfg
modalWindow:addChoice(turret, string.format("%s [%s coins]", cfgTable.turretName, cfgTable[1].buildPrice))
end
modalWindow:addButton(0, "Build")
modalWindow:setDefaultEnterButton(0)
modalWindow:addButton(1, "Cancel")
modalWindow:setDefaultEscapeButton(1)
modalWindow:sendToPlayer(player)
turretPosition = toPosition
elseif target:isNpc() and target:getName() == "Turret" then
local table = turrets[target:getOutfit().lookType]
local lvl = target:getTurretLevel()
local cfg, cfgCombat = table.cfg[lvl], table.combat[lvl]
local turrentInfo = string.format("Turret Information\n----------------------------\nTurret Level: %s\nAttack Type: %s\nRange SQM: %sx%s\nTurret Damage: [%s - %s]\nAttack Speed: %s\nSell/Upgrade Price: [%s / %s]", lvl, string.upper(cfgCombat.attackType), cfg.rangeX, cfg.rangeY, cfgCombat.dmgValues[1], cfgCombat.dmgValues[2], cfg.attackSpeed, cfg.sellPrice, cfg.upgradePrice)
local playerInfo = string.format("Player Information\n----------------------------\nWave Level: %s\nYour Coins: %s", getWaveLevel(), player:getCoins())
local modalWindow = ModalWindow(101, "Information", string.format("%s\n\n%s", turrentInfo, playerInfo))
if lvl < 3 then
modalWindow:addChoice(0, "Upgrade")
end
modalWindow:addChoice(1, "Sell")
modalWindow:addButton(0, "Yes")
modalWindow:setDefaultEnterButton(0)
modalWindow:addButton(0x01, "Cancel")
modalWindow:setDefaultEscapeButton(1)
modalWindow:sendToPlayer(player)
targetTurret = target
end
return true
end
a more detailed description of the error