What's new
  • logo_cipsoft
    Latest servers:
    New servers will open on: 19th Feb 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

Actions [7.x][8.x] Prosty Anihilator Script z ciekawymi opcjami

Status
Not open for further replies.

Gandhi

Active User
Joined
Aug 7, 2013
Messages
80
Reaction score
19
Siema. ?apcie tu ?wie?o napisany skrypt, jest to ?atwy do ustawienia skrypt (wymaga jedynie troch? inteligencji) na annihilator quest.

Mo?esz ustawi? takie rzeczy, jak:
  • ilo?? graczy bior?cych udzia? w que?cie (mo?e ich by? mniej lub wi?cej ni? 4)
  • warunek sprawdzania graczy (mo?esz ustawi?, ?e aby wykona? quest, nie potrzeba zebra? ca?ego teamu, tylko ile os?b przyjdzie)
  • mo?liwo?? wielokrotnego wykonywania questy (nagrod? mo?na wzi?? tylko raz)
  • warunek zabicia wszystkich potwor?w do wydostania si? z pokoju
  • sprawdzanie levela
  • summonowanie potwor?w
  • i co? tam jeszcze

Testowany na TFS 0.4 8.6, ale s?dz?, ?e skrypt jest napisany w taki spos?b, ?e i na 7.6 b?dzie dzia?a?. Je?li tak nie b?dzie, to piszcie w tym temacie.

W data/actions/scripts zr?bcie plik annihilator.lua i wklejcie to:
[lua]
--[[
Author: Gandhi [PL]
Date: 24.03.2012 ~10.20-11.15
Contanct: GG - 38138073 (I can do some not easy scripts for cash (Self-promotion, hah) )
About:
Simple script for annihilator quest. You can set:
- more or less than 4 players (numbers of tables with position in config.positions.before_teleport and config.positions.after_teleport (this number must be equal in these two tables) )
- player can do quest without all teammates
- player can do quest only at once
- players must kill all monsters to get prize
- placing of monsters
- prizes

Greetings for people of Go(o)d Will!
]]

local config = {
positions = { -- positions
before_teleport = { -- positions where are players before teleport to quest
{x=1221, y=969, z=11, stackpos=253},
{x=1222, y=969, z=11, stackpos=253},
{x=1223, y=969, z=11, stackpos=253},
{x=1224, y=969, z=11, stackpos=253}
},
after_teleport = { -- positions of players after teleport
{x=1221, y=969, z=12, stackpos=253},
{x=1222, y=969, z=12, stackpos=253},
{x=1223, y=969, z=12, stackpos=253},
{x=1224, y=969, z=12, stackpos=253}
},
place_monsters = { -- positions to place monsters
placeMonstersAfterTeleport = true, -- use placing monsters on quest by script?
{name = 'Demon', position = {x=1222, y=967, z=12, stackpos=253}},
{name = 'Demon', position = {x=1224, y=967, z=12, stackpos=253}},
{name = 'Demon', position = {x=1221, y=971, z=12, stackpos=253}},
{name = 'Demon', position = {x=1223, y=971, z=12, stackpos=253}}
}
},
requiredLevel = 100, -- required level to join annihilator quest
checkForPlayers = false, -- if false, you can do quest when you don't have whole team
killAllMonstersToExitRoom = true, -- if true, you have to kill all monsters before exit the room
requiredStorage = {
storage = 8600, -- storage where are saving info that player has do this quest (has take a price)
valueDone = 1, -- value after do quest
checkStorage = false -- check storage before join (if true, players can do quest only once)
},
messagesType = 20, -- type of messages sent to players
items = {
itemActionIdType = 'uid', -- chest with price from annihilator quest have set its id in actionid ('aid') or uniqueid ('uid')?
[2650] = {count = 1, itemid = 2494, name = 'demon armor'},
[2651] = {count = 1, itemid = 2400, name = 'magic sword'},
[2652] = {count = 1, itemid = 2431, name = 'stonecutter axe'},
[2653] = {count = 1, itemid = 2421, name = 'thunder hammer'},
[2654] = {storage = 123233, value = 4, message = 'You have won pass to the forbidden city.'},
[2655] = {storage = {[22234] = 2, [56642] = 6}, message = 'You have earned two new functionality: demon lord exp place and something more...'},
[9000] = {switch = true}, -- is item with this id a switch to teleport?
[9001] = {doors = true} -- is item with this id a doors to exit room?
}
}

function onUse(cid, item, frompos, item2, topos)
local idType = (config.items.itemActionIdType == 'uid' and item.uid or item.actionid)
local prize = config.items[idType]
if(prize == nil) then
return 0
end
if(prize.itemid ~= nil or prize.storage ~= nil) then
if(prize.itemid ~= nil) then
if(getPlayerStorageValue(cid, config.requiredStorage.storage) == config.requiredStorage.valueDone) then
doPlayerSendTextMessage(cid, config.messagesType, 'You already take your price from this quest.')
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return 1
end
doPlayerAddItem(cid, prize.itemid, prize.count)
doPlayerSendTextMessage(cid, config.messagesType, 'You have found ' .. (prize.count == 1 and 'a' or prize.count) .. ' ' .. prize.name .. '.')
setPlayerStorageValue(cid, config.requiredStorage.storage, config.requiredStorage.valueDone)
end
if(prize.storage ~= nil) then
if(type(prize.storage) == 'table') then
for k, v in pairs(prize.storage) do setPlayerStorageValue(cid, k, v) end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, prize.message)
elseif(prize.storage ~= nil) then
setPlayerStorageValue(cid, prize.storage, prize.value)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, prize.message)
else
error('Wrong type of storage, when taking prize with id ' .. idType .. '.')
end
end
elseif(prize.doors) then
if(config.killAllMonstersToExitRoom) then
local monsters, monster = {}, 0
for k, v in pairs(config.positions.place_monsters) do
if(type(v) == 'table') then
monster = getThingfromPos(v.position)
if(monster.uid > 0) then
table.insert(monsters, monster.uid)
end
end
end
if(table.getn(monsters) > 0) then
for _, v in pairs(monsters) do
doSendMagicEffect(getCreaturePosition(v), CONST_ME_MAGIC_RED)
end
doPlayerSendTextMessage(cid, config.messagesType, 'You have to kill ' .. table.getn(monsters) .. ' monsters.')
return 1
end
end
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, getThingPos(item.uid))
if(config.killAllMonstersToExitRoom) then
doPlayerSendTextMessage(cid, config.messagesType, 'Your team killed all monsters. You can pass doors.')
end
return 1
elseif(not prize.switch) then
return 0
end
if(table.getn(config.positions.before_teleport) ~= table.getn(config.positions.after_teleport)) then
error('Numbers of positions before teleport and after teleport doesn\'t match.')
return 0
end
local players, player = {}, 0
for k, v in pairs(config.positions.after_teleport) do
player = getThingfromPos(v)
if(isPlayer(player.uid)) then
doPlayerSendCancel(cid, 'Another team is doing annihilator quest now. Wait a moment.')
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return 1
end
end
local sendMessageNotEnoughPlayers = false
for k, v in pairs(config.positions.before_teleport) do
player = getThingfromPos(v)
if(not isPlayer(player.uid)) then
if(config.checkForPlayers) then
if(not sendMessageNotEnoughPlayers) then
doPlayerSendTextMessage(cid, config.messagesType, 'You need ' .. table.getn(config.positions.before_teleport) .. ' players to do annihilator quest.')
doSendMagicEffect(getCreaturePosition(player.uid), CONST_ME_POFF)
sendMessageNotEnoughPlayers = true
end
else
table.insert(players, -1)
end
elseif(getPlayerLevel(player.uid) < config.requiredLevel) then
doPlayerSendTextMessage(cid, config.messagesType, 'Player ' .. getCreatureName(player.uid) .. ' from your team don\'t have required level (' .. config.requiredLevel .. ')')
doPlayerSendCancel(player.uid, 'You don\'t have enough level to do annihilator quest. Come back if you reach ' .. config.requiredLevel .. ' level.')
doSendMagicEffect(getCreaturePosition(player.uid), CONST_ME_POFF)
elseif(config.requiredStorage.checkStorage and getPlayerStorageValue(player.uid, config.requiredStorage.storage) == config.requiredStorage.valueDone) then
doPlayerSendTextMessage(cid, config.messagesType, 'Player ' .. getCreatureName(player.uid) .. ' from your team has done this quest.')
doPlayerSendCancel(cid, 'You have done this quest.')
doSendMagicEffect(getCreaturePosition(player.uid), CONST_ME_POFF)
else
table.insert(players, player.uid)
end
end
if(table.getn(players) ~= table.getn(config.positions.before_teleport)) then
return 1
end
local teleportPosition = 0
for i, v in ipairs(players) do
if(v ~= -1) then
teleportPosition = config.positions.after_teleport
doTeleportThing(v, teleportPosition)
doSendMagicEffect(teleportPosition, CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(v, config.messagesType, 'Now you are teleported to annihilator room. Good luck.')
end
end
if(config.positions.place_monsters.placeMonstersAfterTeleport) then
local monster = 0
for k, v in pairs(config.positions.place_monsters) do
if(type(v) == 'table') then
monster = getThingfromPos(v.position)
if(monster.uid == 0) then
doSummonCreature(v.name, v.position)
doSendMagicEffect(v.position, CONST_ME_MAGIC_RED)
end
end
end
end
return 1
end
[/lua]

A do actions.xml wklejcie to:
Wersja dla nowszych TFS?w
[xml]

<action uniqueid="9000;9001;2650;2651;2652;2653" event="script" value="annihilator.lua"/>
[/xml]

Wersja dla starszych silnik?w
[xml]
<action uniqueid="9000" event="script" value="annihilator.lua"/>
<action uniqueid="9001" event="script" value="annihilator.lua"/>
<action uniqueid="2650" event="script" value="annihilator.lua"/>
<action uniqueid="2651" event="script" value="annihilator.lua"/>
<action uniqueid="2652" event="script" value="annihilator.lua"/>
<action uniqueid="2653" event="script" value="annihilator.lua"/>
[/xml]

Jak b?d? b??dy to piszcie, g?owy za to nie daj?.
Yo.

Notka moderatorska:
Poprawi?em znaczniki
 

Zielony Pixel

Senior User
Joined
Feb 8, 2010
Messages
544
Reaction score
38
Odp: [7.x][8.x] Prosty Anihilator Script z ciekawymi opcjami

if(config.positions.place_monsters.placeMonstersAf terTeleport) then
finalizujemy 7.6:D
 

Gandhi

Active User
Joined
Aug 7, 2013
Messages
80
Reaction score
19
Odp: [7.x][8.x] Prosty Anihilator Script z ciekawymi opcjami

if(config.positions.place_monsters.placeMonstersAf terTeleport) then
finalizujemy 7.6:D

T? spacj? w skrypcie to chyba pod?wietlanie sk?adnie robi, i jako? nie mog? si? jej pozby?. I sory, ale tego twojego "finalizujemy", to nie rozumiem, co chcia?e? przekaza?. : p
 
Status
Not open for further replies.
Top