• 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!

Kill monster before enter TP

Tofflarn

New Member
Joined
Mar 22, 2008
Messages
360
Reaction score
1
Location
Sweden
Well im working on a real Inq quest, and i need a script that when a team have killed the monster they can enter the teleport!
Something that add a storage value or something. Something like real Arena? Or maybe when team killed the boss a tp is created in a pos!


Would be awesome if someone could try this! Im don't think im alone to need this scripts!
so please help :)
 
some new errors :P

[19/11/2008 21:43:48] Lua Script Error: [CreatureScript Interface]
[19/11/2008 21:43:48] data/creaturescripts/scripts/morga.lua:onKill

[19/11/2008 21:43:48] luaAddEvent(). callback parameter should be a function.

[19/11/2008 21:44:40] Lua Script Error: [CreatureScript Interface]
[19/11/2008 21:44:40] data/creaturescripts/scripts/morga.lua:onKill

[19/11/2008 21:44:40] data/creaturescripts/scripts/morga.lua:8: attempt to perform arithmetic on global 'monster' (a nil value)
[19/11/2008 21:44:40] stack traceback:
[19/11/2008 21:44:40] data/creaturescripts/scripts/morga.lua:8: in function <data/creaturescripts/scripts/morga.lua:1>



and you know this line in movements
local pos = {{x=33110,y=31682,z=12},{x=33200,y=31687,z=12},{x=33038,y=31753,z=15},{x=33038,y=31753,z=15},{x=33153,y=31782,z=12},{x=33069,y=31782,z=13},{x=33371,y=31614,z=14}} -- Hellgorak,Annihilion,Golgordan,Latrivan,Madareth,Ushuriel,Zugurosh
It only listen to the first Pos.. When i kill the second moster in inq i get teleported to the same place as the first boss.



And one question, is this right? In creaturescript. login.lua
function onLogin(cid)
registerCreatureEvent(cid, "PlayerDeath")
registerCreatureEvent(cid, "Hellgorak")
registerCreatureEvent(cid, "Annihilon")
registerCreatureEvent(cid, "Golgordan")
registerCreatureEvent(cid, "Latrivan")
registerCreatureEvent(cid, "Madareth")
registerCreatureEvent(cid, "Ushuriel")
registerCreatureEvent(cid, "Zugurosh")
return TRUE
end
 
Updated.

and no... you just need to set a single thing in "login.lua"

Code:
registerCreatureEvent(cid, "Inquisition")

and this into creaturescripts.xml

Code:
<event type="kill" name="Inquisition" script="nameofscript.lua"/>

sorry that i made the onstepin even longer, I'll short him down tmr when i have more time :)


kind regards, Evil Hero
 
Why the heck do you register so many events? Moreover- for every player! :o
Wouldn't it be better to make a single onDeath event for each of these monsters (= less resources usage)? So, when monster dies, it creates automaticly a teleport on specified inside the script position...
 
Sorry but for me it doesn't work ;/ Can someone help me? I'm using TFS 0.2 now. I've tried to edit script, and I've tried all scripts posted there and it doesn't work;//
This is my login.lua , Can soemone edit for me that file and write scrypts for TFS 0.2 ? :)
Code:
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 17
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
SQL_COMUNICATION_INTERVAL = SQL_interval * 1000
function onLogin(cid)
    registerCreatureEvent(cid, "PlayerKill")
    if (InitArenaScript ~= 0) then
    InitArenaScript = 1
    -- make arena rooms free
        for i = 42300, 42309 do
            setGlobalStorageValue(i, 0)
            setGlobalStorageValue(i+100, 0)
        end
    end
    -- if he did not make full arena 1 he must start from zero
    if getPlayerStorageValue(cid, 42309) < 1 then
        for i = 42300, 42309 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 2 he must start from zero
    if getPlayerStorageValue(cid, 42319) < 1 then
        for i = 42310, 42319 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 3 he must start from zero
    if getPlayerStorageValue(cid, 42329) < 1 then
        for i = 42320, 42329 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    if getPlayerStorageValue(cid, 42355) == -1 then
        setPlayerStorageValue(cid, 42355, 0) -- did not arena level
    end
    setPlayerStorageValue(cid, 42350, 0) -- time to kick 0
    setPlayerStorageValue(cid, 42352, 0) -- is not in arena  
	if(InitShopComunication == 0) then
		local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, {})
		InitShopComunication = eventServ
	end
	return TRUE
end
function sql_communication(parameters)
    dofile("./config.lua")
    env = assert(luasql.mysql())
    con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
    result_plr = assert(con:execute("SELECT * FROM z_ots_comunication WHERE `type` = 'login';"))
    todo = result_plr:fetch({}, "a")
    while todo do
        id = tonumber(todo.id)
        action = tostring(todo.action)
        delete = tonumber(todo.delete_it)
        cid = getPlayerByName(tostring(todo.name))
        if isPlayer(cid) == TRUE then
            local itemtogive_id = tonumber(todo.param1)
            local itemtogive_count = tonumber(todo.param2)
            local container_id = tonumber(todo.param3)
            local container_count = tonumber(todo.param4)
            local add_item_type = tostring(todo.param5)
            local add_item_name = tostring(todo.param6)
            local received_item = 0
            local full_weight = 0
            if add_item_type == 'container' then
                container_weight = getItemWeight(container_id, 1)
                items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
                full_weight = items_weight + container_weight
            else
                full_weight = getItemWeight(itemtogive_id, itemtogive_count)
            end
            local free_cap = getPlayerFreeCap(cid)
            if full_weight <= free_cap then
                if add_item_type == 'container' then
                    local new_container = doCreateItemEx(container_id, 1)
                    local iter = 0
                    while iter ~= container_count do
                        doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                        iter = iter + 1
                    end
                    received_item = doPlayerAddItemEx(cid, new_container)
                else
                    local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                    received_item = doPlayerAddItemEx(cid, new_item)
                end
                if received_item == RETURNVALUE_NOERROR then
                    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
                    delete = assert(con:execute("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";"))
                    assert(con:execute("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";"))
                else
                    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
                end
            else
                doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
            end
            end
        todo = result_plr:fetch (todo, "a")
    end
    con:close()
    env:close()
    local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, parameters)

end
 
Why the heck do you register so many events? Moreover- for every player! :o
Wouldn't it be better to make a single onDeath event for each of these monsters (= less resources usage)? So, when monster dies, it creates automaticly a teleport on specified inside the script position...


I did but seems to dont work
here's my code just edited it to onDeath and removed the globalstorageid

Code:
function onDeath(cid, corpse, killer)
local minutes = 1 -- How long people will be able to pass the teleport
local seconds = 30 -- This is in a addition with minutes
local monstername = "General Murius" -- Put the Monster name in there which has to be defeated
local topos = {x=209,y=205,z=7}
local createpos = {x=212,y=200,z=3}
	if (isPlayer(target) ~= TRUE) then
		if (getCreatureName(target) == monstername) then
			tp = doCreateTeleport(5023, topos, createpos)
			addEvent(timeToPas,(1000*60*minutes) + (1000*seconds))
		else
			return FALSE
		end
	else
		return FALSE
	end
	return TRUE
end

function timeToPas()
	doTransformItem(tp.uid, 407, 1)
	return TRUE
end
 
Back
Top