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

Key door

Hmpfot

New Member
Joined
Apr 19, 2009
Messages
72
Reaction score
0
Hello again!

I got a huntplace on my custommaded map located behind a door, and i want that door to be locked and u can just lock it up with a key (of course) but the thing is i dont want the door too open...

I want it like this: When u use the key on the door you should be teleported behind the door so u REALLY NEED a key to get in there so ppls cant open the door for you, if you know what i mean? like a level door but with a key


would be very grateful if someone could help me with this, then i dont just mean the script i also need help with the XML file's and ALL, yea you heard it, ALL :)

Thx alot

Yours, Hmpf~
 
First of all, this is a request. Post it here next time: Requests

But well here's the code
Code:
 local config = {
	positions = {
		from = {x = x, y = y, z = z},
		to = {x = x, y = y, z = z}
	},
	keyActionId = xxxx
}

function getDistance(a, b)
	return math.max(math.abs(a.x - b.x), math.abs(a.y - b.y))
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.uid == xxxx then
		local teleportPosition = getDistance(getCreaturePosition(cid), config.positions.from) < getDistance(getCreaturePosition(cid), config.positions.to) and config.positions.to or config.positions.from
		doTeleportThing(cid, teleportPosition)
	end
	return true
end
 
hmm where do i put this code and dont i need an XML movements too? i also got another problem the door that the key is goin to can be opened without a key, how to i fix this? i use a LOCKED door but can still open it without key but now WITH key, still want the door to be closed all the time just want a teleport infront of the door too behind the door, do i need to change any ACtion id on the key/door or uniqe id on key/door, i need it all so detailed as possible,


Thx alot
 
@hmpfot try the door not on a staff position.. Staff can open all doors whether locked or not.. Well every server i've had/been on that has been the case..

Then do as above posters stated
 
Simply put an actionid on the door.. and then the same actionid on the key. its that simple :)
That will require the player to wear the key in his inventerior and will open the door as usually, he will have to set an unique ID on the door & the key to connect it to the script I made.

actions.xml
Code:
<action uniqueid="xxxx" event="script" value="specialdoor.lua"/>
 
Back
Top