• 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 Need Help with Cool quest

destroyer667

Member
Joined
Nov 21, 2007
Messages
290
Reaction score
6
I was wondering if it was possible to make these statues shoot you with an arrow if you step on the wrong tile. Only the statue in the right row would shoot you with an arrow here is a picture i honestly dont know where i'd begin with this unless i made them into a monster but then they would just shoot you all the time. Also so people cant block the arrows for other people maybe it would be possible if they could focus on only the player who stepped on the wrong tile? if not then thats ok to :]

msyywz.jpg
 
yeah thats what i was trying to do. but i dont know how...................

Lua:
function onStepIn(cid, item, frompos, topos)
    if item.itemid == 426 and item.uid == 40001 then
	 if isPlayer(cid) == 1 then
	doCreatureAddHealth(cid,-350)
	doTransformItem(item.uid,item.itemid-1)
	doSendDistanceShoot({x=32850, y=32276, z=9}, {x=32848, y=32276, z=9}, CONST_ANI_ARROW)
        doTransformItem(item.uid,item.itemid+1)   
        doSendDistantShoot(statue1Pos, {x=32850, y=32276, z=9}, getCreaturePosition(cid), CONST_ANI_ARROW)
	doSendDistantShoot(statue2Pos, {x=32850, y=32275, z=9}, getCreaturePosition(cid), CONST_ANI_ARROW)
	doSendDistantShoot(statue3Pos, {x=32850, y=32274, z=9}, getCreaturePosition(cid), CONST_ANI_ARROW)
	 end
 
        return 1
end
end

doesn't work



then i tried this.

Lua:
function onStepIn(cid, item, frompos, topos)
    if item.itemid == 426 and item.uid == 40001 then
	 if isPlayer(cid) == 1 then
	doCreatureAddHealth(cid,-800)
	doTransformItem(item.uid,item.itemid-1)
        doTransformItem(item.uid,item.itemid+1)   
        doSendDistantShoot(statue1Pos, {x=32850, y=32276, z=9}, getCreaturePosition(cid), CONST_ANI_ARROW)
	 end
 
        return 1
end
end

doesn't work either
 
Lua:
function onStepIn(cid, item, frompos, topos)
    if item.itemid == 426 and item.uid == 40001 then
	 if isPlayer(cid) == 1 then
	doCreatureAddHealth(cid,-800)
	doTransformItem(item.uid,item.itemid-1)
        doTransformItem(item.uid,item.itemid+1)   
        doSendDistantShoot({x=1000, y=1000, z=7}, getCreaturePosition(cid), CONST_ANI_ARROW)
	 end
 
        return 1
end
end
 
@ Bogart

i step on the tile and nothing happens. No error in console. tile doesn't go down either. (stepped on with normal character)



think i give up i've tried everything i think a entire new script has to be made because this one doesn't work at all.
 
@ Bogart

i step on the tile and nothing happens. No error in console. tile doesn't go down either. (stepped on with normal character)



think i give up i've tried everything i think a entire new script has to be made because this one doesn't work at all.

you changed the position right?
 
yep :] ill show u what i have.

06:21 You see a statueNothing is written on it.ItemID: [3742]. Position(X:32850 Y:32276 Z:9)
06:21 You see a stone tile.ItemID: [426].ActionID: [40001]. Position(X:32847 Y:32276 Z:9)

Lua:
<movevent event="StepIn" uniqueid="40001" script="poi/statueshoot.lua" />



Lua:
function onStepIn(cid, item, frompos, topos)
    if item.itemid == 426 and item.uid == 40001 then
	 if isPlayer(cid) == 1 then
	doCreatureAddHealth(cid,-800)
	doTransformItem(item.uid,item.itemid-1)
        doTransformItem(item.uid,item.itemid+1)   
        doSendDistantShoot({x=32850, y=32276, z=9}, getCreaturePosition(cid), CONST_ANI_ARROW)
	 end
 
        return 1
end
end
 
Lua:
<movevent event="StepIn" actionid="40001" script="poi/statueshoot.lua" />

Lua:
function onStepIn(cid, item, frompos, topos)
    if item.itemid == 426 and item.aid == 40001 then
	 if isPlayer(cid) == 1 then
	doCreatureAddHealth(cid,-800)
	doTransformItem(item.uid,item.itemid-1)
        doTransformItem(item.uid,item.itemid+1)   
        doSendDistantShoot({x=32850, y=32276, z=9}, getCreaturePosition(cid), CONST_ANI_ARROW)
	 end
 
        return 1
end
end
 
ok i tried what you added it doesn't work statue doesn't shoot and tiles dont do anything / no errors in console. i did 3 controls on my mapeditor while testing.


06:39 You see a stone tile.ItemID: [426].UniqueID: [40001]. Position(X:32847 Y:32276 Z:9)

06:40 You see a stone tile.ItemID: [426].ActionID: [40001]. Position(X:32846 Y:32276 Z:9)

06:41 You see a stone tile.ItemID: [426].ActionID: [40001].UniqueID: [40001]. Position(X:32845 Y:32276 Z:9)
 
Try this
Lua:
function onStepIn(cid, item, frompos, topos)
    if item.itemid == 426 and item.uid == 40001 then
	 if isPlayer(cid) == 1 then
	doCreatureAddHealth(cid,-350)
	doTransformItem(item.uid,item.itemid-1)
        player = getPlayerPosition(cid)
        statue = {x=?, y=?, z=?} -- statue pos
	doSendDistanceShoot(statue,player, CONST_ANI_ARROW})
        doTransformItem(item.uid,item.itemid+1)   
         end
 
        return 1
end
end

Sry for double post
 
Lua:
function onStepIn(cid, item, pos, fromPos)
	if isPlayer(cid) then
		doTransformItem(item.uid, 425)
		doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -800, -800, CONST_ME_NONE)
		doSendDistanceShoot({x=32850, y=pos.y, z=9}, pos, CONST_ANI_ARROW)
	end
end
 
Try this, so if theres someone before the guy, it shoots the guy who is before him.
Lua:
function getPlayerBefore(ppos) 
for i = 32849, ppos do
    local v = {x=i, y=32276, z=9, stackpos = 253}
    if isPlayer(v) then
       return true   
    else
        if i == ppos then
           return false
        end
    end
end
end   
       
local ppos = 32848 -- X coordinate of tile position (the tile where player steps)    
function onStepIn(cid, item, pos, fromPos)
	if isPlayer(cid) then
       doTransformItem(item.uid, 425)
       doTargetCombatHealth(0, getPlayerBefore(ppos) and v or cid, COMBAT_PHYSICALDAMAGE, -800, -800, CONST_ME_NONE)
       doSendDistanceShoot({x=32850, y=pos.y, z=9}, getPlayerBefore(ppos) and getPlayerPosition(v) or pos, CONST_ANI_ARROW)
    end
end

EDIT: This one i liek moar
Lua:
function getPlayerBefore(ppos) 
for i = 32849, ppos do
    local v = {x=i, y=32276, z=9, stackpos = 253}
    if isPlayer(v) then
       return v  
    else
        if i == ppos then
           return cid
        end
    end
end
end   
       
local ppos = 32848 -- X coordinate of tile position (the tile where player steps)    
function onStepIn(cid, item, pos, fromPos)
	if isPlayer(cid) then
       doTransformItem(item.uid, 425)
       doTargetCombatHealth(0, getPlayerBefore(ppos), COMBAT_PHYSICALDAMAGE, -800, -800, CONST_ME_NONE)
       doSendDistanceShoot({x=32850, y=pos.y, z=9}, getPlayerBefore(ppos), CONST_ANI_ARROW)
    end
end
 
Back
Top