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

Advanced Door Script.

Flyckks

New Member
Joined
Jul 28, 2012
Messages
23
Reaction score
1
Location
Brazil
Hello Everyone.

I would like to ask a action script.


Let me explain it.


There will be a "Disk".... you must use this disk on a pillar (not any pillar, a especified one...)... when You use... it will get a position of a Wall... and change in another item... also, send a magic effect on this wall. It will be like the wall going down...
After use this... appear a message "You have 15 seconds to pass trough the door before it closes." (then with 10... 5... 2... and if not pass in this time... the item, will change back in wall.)... after the player pass the wall position... when the move into X tile... the wall will appear again.
 
Hello Everyone.

I would like to ask a action script.


Let me explain it.

Sorry, but at least for me it was quite confusing to understand...

Lemme see if I get it right:
1 - A player will use an item on a pillar
2 - It will send a magic effect on a certain position, and also remove a wall on that positon
3 - A msg will appear saying that after 15 seconds the wall will appear again
4 - If 15 second pass the wall will appear again OR if someone step on the wall position the wall will appear again

Is that right ?
 
Yes, it is right... and after guy pass the wall position... the wall appear again.


At least... Lets say...


Pillar (locked) ID....before use item ... and after wall restore.

Pillar Unlocked Id (unlocked) ID... after use it and before wall restore... like this.



CHECK:

IMG_26082012_142259.jpg

IMG_26082012_161601.jpg

it is the pillar... when use item, get blue... when wall locked get red... diferents IDS
 
Yes, it is right... and after guy pass the wall position... the wall appear again.


At least... Lets say...


Pillar (locked) ID....before use item ... and after wall restore.

Pillar Unlocked Id (unlocked) ID... after use it and before wall restore... like this.



CHECK:

View attachment 15785

View attachment 15786

it is the pillar... when use item, get blue... when wall locked get red... diferents IDS

Ok, here you go:
goto actions.xml and add this:
Lua:
<action itemid="xxxx" script="pillarkey.lua" />
change the "xxxx" to whatever item id you want to be the "key"

now go to scripts and create a pillarkey.lua file and add this inside:
Lua:
function onUse(cid, item, frompos, item2, topos)

local pillar = {x=topos.x, y=topos.y, z=topos.z} -- do not change this
local time = 60 -- time in seconds to the wall appear again
local pillarpos = {x=1234, y=1234, z=1234} -- position of the pillar
local wallpos = {x=1234, y=1234, z=1234} -- position of the wall
local wallid = xxxx -- wall id
local locked_pillar_id = yyyy -- pillar id when the door is locked
local unlocked_pillar_id = zzzz -- pillar id when the door is open


function doReaddWall()
	if getTileItemById(wallpos, wallid).uid < 1 then
                doRemoveItem(getTileItemById(pillarpos, unlocked_pillar_id).uid)
                doCreateItem(locked_pillar_id, 1, pillarpos)
                doSendMagicEffect(pillarpos, CONST_ME_POFF)
                doCreateItem(wallid, 1, wallpos)
                doSendMagicEffect(wallpos, CONST_ME_MAGIC_GREEN)
	end       
end 

	if item2.itemid == locked_pillar_id and pillar.x == pillarpos.x and pillar.y == pillarpos.y and pillar.z == pillarpos.z then
		doSendMagicEffect(pillarpos, CONST_ME_MAGIC_GREEN)
		doRemoveItem(getTileItemById(pillarpos, locked_pillar_id).uid)
		doCreateItem(unlocked_pillar_id, 1, pillarpos)
		doRemoveItem(getTileItemById(wallpos, wallid).uid)
		doSendMagicEffect(wallpos, CONST_ME_POFF)
		doPlayerSendTextMessage(cid, 20, "You only have ' .. time .. ' seconds to go to the secret location.")
		addEvent(doReaddWall, time * 1000)
		doRemoveItem(item.uid, 1)
	end
    return TRUE
end

now go to movements.xml and add this:
Lua:
<movevent type="StepIn" actionid="xxxx" event="script" value="walladd.lua"/>
change the xxxx to any action id that is not being used and remeber to add it to the floor of the position of the wall on your mapeditor

now go to movements/scripts and create a walladd.lua file and add this inside:
Lua:
function onStepIn(cid, item, position, fromPosition)

local pillarpos = {x=1234, y=1234, z=1234} -- position of the pillar
local wallpos = {x=1234, y=1234, z=1234} -- position of the wall
local wallid = xxxx -- wall id
local locked_pillar_id = yyyy -- pillar id when the door is locked
local unlocked_pillar_id = zzzz -- pillar id when the door is open


	if getTileItemById(wallpos, wallid).uid < 1 then
                doRemoveItem(getTileItemById(pillarpos, unlocked_pillar_id).uid)
                doCreateItem(locked_pillar_id, 1, pillarpos)
                doSendMagicEffect(pillarpos, CONST_ME_POFF)
                doCreateItem(wallid, 1, wallpos)
                doSendMagicEffect(wallpos, CONST_ME_MAGIC_GREEN)
	end
    return TRUE
end

I didn´t test it, but I think it is working...
Any problems just ask
Hope it helps = )
 
Back
Top