Extrodus
|| Blazera.net ||
So I found some scripts on the forum that I am converting to TFS 1.2, but after finishing the first one and testing it. I get no errors, and nothing happens on the death of the monster, no text message; no storages set.. nothing.
So here is the creature script:
Script:
Really don't know why it isn't working, was thinking I may have to use creature functions instead, but not sure. Any help is appreciated!
Note: Here is the movements script for the previous script, I have converted it but havent been able to test it due to the other script not working. If you see any flaws in it, please let me know.
So here is the creature script:
Code:
<event type="kill" name="Willow_Boss_Storage_Counter" event="script" value="Aragon/dungeons/willow_boss_storage_counter.lua"/>
Code:
<!-- OnLogin.lua Register Event -->
player:registerEvent("Willow_Boss_Storage_Counter")
Script:
Code:
local storage = 45001 -- storageID to use.
local maxPoints = 1 -- maximum amount of saved points a player can have
local givePoints = 1 -- amount of points to give player
local creatureName = '[b] willow' -- creaturename (must be lowercase letters)
function onKill(player, target, damage, flags)
if player:isPlayer(target) then
return true
end
local name = target:getName():lower()
if name ~= creatureName then
return true
end
if player:getStorageValue(storage) < 0 then
player:setStorageValue(storage, 0)
end
if player:getStorageValue(storage) < maxPoints then
player:setStorageValue(storage, player:getStorageValue(storage) + givePoints)
end
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have defeated ' .. name .. '.')
return true
end
Really don't know why it isn't working, was thinking I may have to use creature functions instead, but not sure. Any help is appreciated!
Note: Here is the movements script for the previous script, I have converted it but havent been able to test it due to the other script not working. If you see any flaws in it, please let me know.
Code:
local storage = 45001 -- storage used in creaturescript
local location = {x = 1000, y = 1000, z = 7} -- place you will teleport
local pointsRequired = 1 -- how many creature points required to teleport
function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if player:isPlayer ~= TRUE then
return false
end
if player:getStorageValue(storage) < 0 then
player:setStorageValue(storage, 0)
end
if player:getStorageValue(storage) >= pointsRequired then
player:setStorageValue(storage, player:getStorageValue(storage) - pointsRequired)
creature:teleportThing(location)
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You require ".. pointsRequired .." points to use this teleport. You currently have ".. player:getStorageValue(storage) .." points.")
end
return true
end
Last edited: