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

Lua Distance Critical

nips

Da.Nb
Joined
Oct 15, 2009
Messages
152
Reaction score
0
Location
Germany
Hi again,

This is my complete weapon script:

items.xml
Code:
	<item id="2352" article="a" name="crystal arrow">
		<attribute key="description" value="This arrow seems not suitable for the use with ordinary bows. It seems to be rotting rapidly."/>
		<attribute key="weight" value="90"/>
		<attribute key="slotType" value="ammo"/>
		<attribute key="attack" value="112"/>
		<attribute key="hitChance" value="90"/>
		<attribute key="weaponType" value="ammunition"/>
		<attribute key="ammoType" value="arrow"/>
		<attribute key="shootType" value="shiverarrow"/>
	</item>

wapons.xml
Code:
<distance id="2352" event="script" value="crystal_arrow.lua"/>

crystal_arrow.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SHIVERARROW)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0)

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)
setConditionParam(condition, CONDITION_PARAM_SPEED, -500)
setCombatCondition(combat, condition)

function onUseWeapon(cid, var)
    doCombat(cid, combat, var)
end

i want to add a normal damage and critical damage !

if the weapon do a critical damage it musst do higher damage ( i will set it for my self, just insert XXX in lua)
and area fields like this...

Code:
local arr = {
	{0, 0, 0, 1, 0, 0, 0},
	{0, 0, 1, 3, 1, 0, 0},
	{0, 0, 0, 1, 0, 0, 0}
}

and i want to edit the shootTyp and ammoTyp on the critical damage.

can sone one help me ?

:(
 
it dowsn't compare with this tread, but i need help with arena ... :s

i use this scipts:

arena3.lua:
Code:
local arena = {
frompos = {x=121, y=36, z=9}, -- Top Left Corner
topos = {x=131, y=43, z=9}, -- Bottom Right Corner
exit = {x=126, y=33, z=9} -- Where loser goes
}

local tpPos = {x=126, y=36, z=9} -- Create Teleport Here
local exit = {x=126, y=33, z=9} -- Where Tele Takes You
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)
			doCreateTeleport(1387, exit, tpPos)
                        doPlayerSendTextMessage(cid, 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
		return TRUE
end

and

arenalever.lua
Code:
local arenas = {
        [7667] = {
                fromPos ={
                        {x = 125, y = 34, z = 9},    --player 1 start pos
                        {x = 127, y = 34, z = 9},            --player 2 start pos
                                                                                        --you can add how much you want, there are no limits
                },
                toPos = {
                        {x = 122, y = 39, z = 9},    --player 1 teleport position
                        {x = 129, y = 39, 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

		local telePos = {x=126, y=33, z=9}
        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

        local telePos = {x=126, y=33, z=9}
		for i, pid in pairs(players) do

			return TRUE
		end
end


IF player die in arena, this error appears. :

Code:
[28/11/2009 04:11:36] Lua Script Error: [CreatureScript Interface] 
[28/11/2009 04:11:36] data/creaturescripts/scripts/arena3.lua:onPrepareDeath

[28/11/2009 04:11:36] luaDoPlayerSendTextMessage(). Player not found

[28/11/2009 04:11:36] Lua Script Error: [CreatureScript Interface] 
[28/11/2009 04:11:36] data/creaturescripts/scripts/arena3.lua:onPrepareDeath

[28/11/2009 04:11:36] luaGetCreatureName(). Creature not found

[28/11/2009 04:11:36] Lua Script Error: [CreatureScript Interface] 
[28/11/2009 04:11:36] data/creaturescripts/scripts/arena3.lua:onPrepareDeath

[28/11/2009 04:11:36] data/creaturescripts/scripts/arena3.lua:17: attempt to concatenate a boolean value
[28/11/2009 04:11:36] stack traceback:
[28/11/2009 04:11:36] 	data/creaturescripts/scripts/arena3.lua:17: in function <data/creaturescripts/scripts/arena3.lua:9>


can some one fix the bug and set a time to delete teleporter after entering ?
 
I make n0b

ok, arena3.lua:
Code:
local arena = {
	frompos = {x=121, y=36, z=9}, -- Top Left Corner
	topos = {x=131, y=43, z=9}, -- Bottom Right Corner
	exit = {x=126, y=33, z=9} -- Where loser goes
}
local tpPos = {x=126, y=36, z=9} -- Create Teleport Here
local exit = {x=126, y=33, z=9} -- Where Tele Takes You

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, CONST_ME_TELEPORT)
			doCreateTeleport(1387, exit, tpPos)
			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
	end
	return TRUE
end
 
still error :(

Code:
[28/11/2009 05:57:50] Lua Script Error: [CreatureScript Interface] 
[28/11/2009 05:57:50] data/creaturescripts/scripts/arena3.lua:onPrepareDeath

[28/11/2009 05:57:50] luaDoPlayerSendTextMessage(). Player not found

[28/11/2009 05:57:50] Lua Script Error: [CreatureScript Interface] 
[28/11/2009 05:57:50] data/creaturescripts/scripts/arena3.lua:onPrepareDeath

[28/11/2009 05:57:50] luaGetCreatureName(). Creature not found

[28/11/2009 05:57:50] Lua Script Error: [CreatureScript Interface] 
[28/11/2009 05:57:50] data/creaturescripts/scripts/arena3.lua:onPrepareDeath

[28/11/2009 05:57:50] data/creaturescripts/scripts/arena3.lua:17: attempt to concatenate a boolean value
[28/11/2009 05:57:50] stack traceback:
[28/11/2009 05:57:50] 	data/creaturescripts/scripts/arena3.lua:17: in function <data/creaturescripts/scripts/arena3.lua:9>

and can you code that the teleporter dissappear after second player past it ?
 
Back
Top