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

Action Switches

Massmurdera

New Member
Joined
Jul 24, 2009
Messages
19
Reaction score
0
i want to make a pvp arena but when i flick the switch on and off it doesnt give any recognition that anything was done
I have armonia based off of TFS and its a 8.4 server..

The switch has a action ID of 34658

In actions\scripts\pvparenalever.lua
Code:
local playerPosition =
{
    {x = 32394, y = 32189, z = 7, stackpos = STACKPOS_TOP_CREATURE},
    {x = 32394, y = 32189, z = 7, stackpos = STACKPOS_TOP_CREATURE}
}

local newPosition =
{
    {x = 32392, y = 3214, z = 7},
    {x = 32398, y = 3214, z = 7}
}

-- Do not modify the declaration lines below.
local player = {0, 0}
local failed = FALSE

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 1945 then
        for i = 1, 2 do
            failed = TRUE
            player[i] = getThingfromPos(playerPosition[i])
            if player[i].itemid > 0 then
                if isPlayer(player[i].uid) == TRUE then
                    if getPlayerStorageValue(player[i].uid, 30016) == -1 then
                        if getPlayerLevel(player[i].uid) >= 100 then
                            failed = FALSE
                        end
                    end
                end
            end
            if failed == TRUE then
                doPlayerSendCancel(cid, "Sorry, not possible.")
                return TRUE
            end
        end
        for i = 1, 2 do
            doSendMagicEffect(playerPosition[i], CONST_ME_POFF)
            doTeleportThing(player[i].uid, newPosition[i], FALSE)
            doSendMagicEffect(newPosition[i], CONST_ME_ENERGYAREA)
        end
        doTransformItem(item.uid, item.itemid + 1)
    elseif item.itemid == 1946 then
        doTransformItem(item.uid, item.itemid - 1)
    end
    return TRUE
end

in actions.xml i have (all other actions work)
Code:
	<!-- PvP Arena -->
	<action uniqueid="34658" event="script" value="pvparenalever.lua" />

In creaturescripts\scripts\pvparena.lua
Code:
local arena = {
frompos = {x=32392, y=32191, z=7},
topos = {x=32399, y=32198, z=7},
exit = {x=32395, y=32197, z=7}
}

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if isPlayer(cid) == TRUE then
if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
if doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE) == TRUE then
if doTeleportThing(cid, arena.exit) == TRUE then
doSendMagicEffect(arena.exit, 10)
return FALSE
end
end
end
end
return TRUE
end

in creaturescripts.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
	<event type="login" name="PlayerLogin" script="login.lua"/>
	<event type="PrepareDeath" name="pvparena" script="pvparena.lua"/> 
	<event type="death" name="PlayerDeath" script="playerdeath.lua"/> 
	<event type="death" name="DeathBroadcast" script="deathBroadcast.lua"/>
	<event type="logout" name="logout" event="script" value="logout.lua"/>
</creaturescripts>
 
If you switch the lever on and off like nothing happens then you dont have an actionId set in the lever.

Because if there any problem with script there has to be:
Console Error or a message to the player "Sorry, not possible.".

And the script is fine, its the same one from the Annihilator (editted for 2 persons)
 
If you switch the lever on and off like nothing happens then you dont have an actionId set in the lever.

Because if there any problem with script there has to be:
Console Error or a message to the player "Sorry, not possible.".

And the script is fine, its the same one from the Annihilator (editted for 2 persons)

I added the switch with RME, with an action ID of 34658, im not sure whats up with it
 
Back
Top