Roga Foryn
New Member
- Joined
- Mar 29, 2014
- Messages
- 12
- Reaction score
- 3
https://otland.net/threads/tfs-1-0-all-of-my-scripts-actions-movements-part-one.237996/
https://otland.net/threads/tfs-1-0-all-of-my-scripts-actions-movements.237994/
Sorry for my bad english, i have many scripts that i want to share.
All scripts are on this page, click on Spoiler.
I could not fix some bugs on the topic .
Actions
https://otland.net/threads/tfs-1-0-all-of-my-scripts-actions-movements.237994/
Sorry for my bad english, i have many scripts that i want to share.
All scripts are on this page, click on Spoiler.
I could not fix some bugs on the topic .
Actions
Divine Items 1.1 - Create a divine items system for your server
globalevents.xml
The XML have about 1 hour.
globalevents/scripts/divineitems.lua
globalevents.xml
The XML have about 1 hour.
Code:
<globalevent name="Divine Items" interval="3600000" script="divineitems.lua" />
globalevents/scripts/divineitems.lua
Code:
local config = { -- only edit what is here[/B][/LEFT][/B][/LEFT][/B][/LEFT]
[B]
[LEFT][B]
[LEFT][B]
[LEFT]chance = 50, -- chance of the seal(the magicforce field) to open MAX 100
destino = {x=1009, y=990, z=7}, -- position of the room where items are created
origem = {x=1029, y=1020, z=7}, -- where the tp is created
tempo = 15 -- time to remove tp, 300 = 5min
}
local function remove(remover)
local t = getTileItemById(remover, 1387).uid
broadcastMessage("The divine seal is locked once again.")
return t > 0 and doRemoveItem(t)
end
function onThink(interval, lastExecution)
local rand = math.random(1, 100)
if (rand > config.chance) then
doCreateTeleport(1387, config.destino, config.origem)
addEvent(remove, config.tempo * 1000, config.origem)
broadcastMessage("The divine seal is open.")
end
return true
end
actions.xml
Code:
<!-- Divine items -->
<action uniqueid="2451" script="divineitems.lua"/>
actions/scripts/divineitems.lua
Code:
local config = { [/B][/LEFT][/B][/LEFT][/B][/LEFT]
[B]
[LEFT][B]
[LEFT][B]
[LEFT]--theitem sequence IS important
--LOCATIONS, the 4SQMS
primeiro = {x=1007, y=982, z=7}, -- first 1
segundo = {x=1008, y=982, z=7}, -- second 2
terceiro = {x=1010, y=982, z=7}, -- third 3
quarto = {x=1011, y=982, z=7}, -- four 4
final = {x=1009, y=985, z=7}, -- final SQM, where the item is created
-- RECIPES
-- Here have two recipes samples
receitas = { -- Name, {ID do of created item, first item, second item, third item, four item}
-- Warlord Sword / Magic Sword, Avenger, Thunder Hammer, Demon Armor
["Warlord Sword"] = { [1] = 2408, [2] = 2400, [3] = 6528, [4] = 2421, [5] = 2494 },
-- Golden Boots / Soft, Soft, BoH, Yalarahi Legs
["Golden Boots"] = { [1] = 2646, [2] = 6132, [3] = 6132, [4] = 2195, [5] = 9777 },
}
}
function onUse(cid, item, fromPosition, target, toPosition, isHotkey)
for nome, item in pairs(config.receitas) do
--checar se os itens estao l
local a = getTileItemById(config.primeiro, item[2]).uid
local b = getTileItemById(config.segundo, item[3]).uid
local c = getTileItemById(config.terceiro, item[4]).uid
local d = getTileItemById(config.quarto, item[5]).uid
print(a)
if a > 0 and b > 0 and c > 0 and d > 0 then
doCreateItem(item[1], 1, config.final)
doSendMagicEffect(config.final, CONST_ME_TELEPORT)
broadcastMessage("The divine item "..nome.." was raised for "..getPlayerName(cid)..".")
doRemoveItem(a,1)
doRemoveItem(b,1)
doRemoveItem(c,1)
doRemoveItem(d,1)
end
end
return true
end
Transform objects on map
Before/After
actions.xml
change the unique id with the object unique id on the map editor.
actions/scripts/transform.lua
change the unique id with the object unique id on the map editor.
Code:
<!-- Transform items -->
<action uniqueid="4234" script="transform.lua"/>
Code:
local config = { -- Só edite o que estiver aqui dentro
primeiroitem = 1457, -- original item
segundoitem = 1453, -- item after use
globalstorage = 4152, -- global storage for this item, cannot be already used
--DELAY to use again
tempo = 30, -- 30 seconds
}
local function destransformar(pos)
local item = getTileItemById(pos, config.segundoitem).uid
doTransformItem(item, config.primeiroitem)
setGlobalStorageValue(config.globalstorage, 0)
return true
end
function onUse(cid, item, fromPosition, target, toPosition, isHotkey)
if getGlobalStorageValue(config.globalstorage) ~= 1 then
local item = getTileItemById(toPosition, config.primeiroitem).uid
doTransformItem(item, config.segundoitem)
addEvent(destransformar, config.tempo * 1000, toPosition)
setGlobalStorageValue(config.globalstorage, 1)
end
return true
end
Climb on branches
I used item id 6220(twines). But everything can be used.
actions.xml
actions/scripts
climb.lua
actions.xml
Code:
<action actionid="15446" script="climb.lua"/>
actions/scripts
climb.lua
Code:
function onUse(cid, item, fromPosition, target, toPosition)
--Floors that the player will rise, a negative number to a positive floor ex: -2
local andares = -1
--Direction, select one and remove the comment, and put on another direction.
--doCreatureSetLookDir(cid, 0) -- NORTH
--doCreatureSetLookDir(cid, 1) -- >>
--doCreatureSetLookDir(cid, 2) -- SOUTH
doCreatureSetLookDir(cid, 3) -- <<
-- Stop modifications --
local pos = getPlayerPosition(cid)
local direcao = getPlayerLookDir(cid)
if direcao == NORTH then
doTeleportThing(cid, { x = pos.x, y = pos.y - 1, z = pos.z + andares })
end
if direcao == EAST then
doTeleportThing(cid, { x = pos.x + 1, y = pos.y, z = pos.z + andares })
end
if direcao == SOUTH then
doTeleportThing(cid, { x = pos.x, y = pos.y + 1, z = pos.z + andares })
end
if direcao == WEST then
doTeleportThing(cid, { x = pos.x - 1, y = pos.y, z = pos.z + andares })
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You climbed on branches.")
return true
end
The Narnia Wardrobe
(teleport on use, summon on use, etc. )
actions.xml
actions/scripts/narnia.lua
Code:
<action uniqueid="15444" script="narnia.lua"/>
actions/scripts/narnia.lua
Code:
function onUse(cid, item, fromPosition, target, toPosition)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doTeleportThing(cid, {x=1000, y=1000, z=7}, false) -- EDIT THIS LINE WITH THE LOCATION
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You go to narnia!")
return true
end
Now, derivations of this script:
Code:
function onUse(cid, item, fromPosition, target, toPosition)
local storageplayer = getPlayerStorageValue(cid, 41111)
local criatura = "Slime" -- monster name
if storageplayer == 1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Nothing here.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Is a trap!")
doSummonCreature(criatura, getCreaturePosition(cid))
setPlayerStorageValue(cid, 41111, 1)
end
return true
end
Code:
function onUse(cid, item, fromPosition, target, toPosition)local storageplayer = getPlayerStorageValue(cid,41111)
local criatura1 ="Slime"-- monster name
local criatura2 ="Slime"-- monster namelocal criatura3 ="Slime"-- monster namelocal criatura4 ="Slime"-- monster namelocal criatura5 ="Slime"-- monster name
if storageplayer ==1then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Nothing.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Is a trap!")
doSummonCreature(criatura1, getCreaturePosition(cid))
doSummonCreature(criatura2, getCreaturePosition(cid))
doSummonCreature(criatura3, getCreaturePosition(cid))
doSummonCreature(criatura4, getCreaturePosition(cid))
doSummonCreature(criatura5, getCreaturePosition(cid))
setPlayerStorageValue(cid,41111,1)endreturntrue
end
Last edited: