hi all,
This is my standart mini arena.
1. Player pos 1
2. Player pos 2
3. Looser kick pos
4. Winner exit pos
Can somebody create a scipt for my teleporter ?
it is stressfull to fight in arena and while you have to watch that u dont step on TP(pos 4).
Now i need a scipt that let the teleporter(pos 4) appear when one of two players got kicked ...
something like:
IF player 1 or player 2 kicked out of arena
Then playce teleporter on X,Y,Z.
IF player 1 or player 2 moved into teleporter on pos X,Y,Z
Then remove teleporter
Return.
Here are my Codes:
Server/actions
Server/globalevents
I hope somebody can help me.
Yours Nips
This is my standart mini arena.
1. Player pos 1
2. Player pos 2
3. Looser kick pos
4. Winner exit pos
Can somebody create a scipt for my teleporter ?
it is stressfull to fight in arena and while you have to watch that u dont step on TP(pos 4).
Now i need a scipt that let the teleporter(pos 4) appear when one of two players got kicked ...
something like:
IF player 1 or player 2 kicked out of arena
Then playce teleporter on X,Y,Z.
IF player 1 or player 2 moved into teleporter on pos X,Y,Z
Then remove teleporter
Return.
Here are my Codes:
Server/actions
<action actionid="7667" script="arenalever.lua" />
<action uniqueid="7667" script="arenalever.lua" />
arenalever.lua
Code:
local arenas = {
[7667] = {
fromPos ={
{x = 119, y = 38, z = 9}, --player 1 start pos
{x = 132, y = 38, z = 9} --player 2 start pos
--you can add how much you want, there are no limits
},
toPos = {
{x = 122, y = 38, z = 9}, --player 1 teleport position
{x = 129, y = 38, z = 9} --player 2 teleport position
--you can add how much you want, there are no limits
}
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
doTransformItem(item.uid, 1945)
return TRUE
end
local arena = arenas[item.uid]
if(not arena) then
return FALSE
end
local players = {}
for _, pos in pairs(arena.fromPos) do
pos.stackpos = STACKPOS_TOP_CREATURE
local tmp = getThingfromPos(pos).uid
if(tmp > 0 and isCreature(tmp) == TRUE) then
table.insert(players, tmp)
end
end
if(table.maxn(players) < table.maxn(arena.fromPos)) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need more creatures for duel.")
return TRUE
end
for i, pid in pairs(players) do
doSendMagicEffect(arena.fromPos[i], CONST_ME_POFF)
doTeleportThing(pid, arena.toPos[i])
doSendMagicEffect(arena.toPos[i], CONST_ME_TELEPORT)
doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "FIGHT!")
end
return TRUE
end
Server/globalevents
<event type="preparedeath" name="Arena3" script="arena3.lua"/>
arena3.lua
Code:
local arena = {
frompos = {x=121, y=35, z=9}, -- Top Left Corner
topos = {x=131, y=42, z=9}, -- Bottom Right Corner
exit = {x=126, y=33, z=9} -- Exit
}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if isPlayer(cid) == TRUE then
if isInArea(getCreaturePosition(cid), arena.frompos, arena.topos) then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE)
doTeleportThing(cid, arena.exit)
doSendMagicEffect(arena.exit, 10)
doPlayerSendTextMessage(mostDamageKiller,MESSAGE_STATUS_CONSOLE_ORANGE,'[ARENA] You have defeated '..getCreatureName(cid)..'!')
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_RED,'[ARENA] You where defeated by '..getCreatureName(mostDamageKiller)..'!')
end
return true
end
end
I hope somebody can help me.
Yours Nips