PDA

View Full Version : door opener



timphillips
01-13-2013, 12:13 AM
i am tryin to make a oneliner to unlock the door in ab troll cave
Container:UseItemWithGround(2969, 32655, 31655, 9) is not working
do i use the x,y,z for the spot infront or behide the door?

Spectrus
01-13-2013, 12:25 AM
Container:UseItemWithGround() takes the spot that the key is in, not the ID. Change 2969 to the correct spot in the container. Also specify which container it is. If it's the first do:

Container.GetFirst():UseItemWithGround(spot, x, ,y, z)

Otherwise if it's the 2nd, 3rd, 4th, remember that container index is offset 0 (first is 0), use:

Container.New(1):UseItemWithGround(spot, x, y, z) -- This is for 2nd container open.

timphillips
01-13-2013, 12:33 AM
Container:UseItemWithGround() takes the spot that the key is in, not the ID. Change 2969 to the correct spot in the container. Also specify which container it is. If it's the first do:

Container.GetFirst():UseItemWithGround(spot, x, ,y, z)

Otherwise if it's the 2nd, 3rd, 4th, remember that container index is offset 0 (first is 0), use:

Container.New(1):UseItemWithGround(spot, x, y, z) -- This is for 2nd container open.






is the x,y,z the spot infront of the door or the spot right behind the door? ?

soul4soul
01-13-2013, 12:37 AM
on the door spot. not in front or behind.

timphillips
01-13-2013, 02:36 AM
Container.GetFirst():UseItemWithGround(1, 32655, 31655, 9) did not work, tryin to open the first door with the key to the ab troll cave

soul4soul
01-13-2013, 02:38 AM
If the key is in the very first spot of your backpack you need to use 0 not 1.

timphillips
01-13-2013, 02:49 AM
tryed with 0 didnt work and tryed with openDoor(32190, 32432, 8, 2968)
but i changed the xyz and item number and it poped up an error msg

timphillips
01-13-2013, 03:19 AM
u got time to run to ab and make a quick one liner?

soul4soul
01-13-2013, 03:43 AM
I dont have any chars around doors with keys but what you had earlier looked correct as long as you have the correct door pos and bp spot. Some people have been saying that there is a bug since XB 3.0+ where you cant open locked doors, I cant confirm or deny being I havent tested it myself.

Infernal Bolt
01-13-2013, 07:28 AM
there is a bug since XB 3.0+ where you cant open locked doors, I cant confirm or deny being I havent tested it myself.

If they were using forgees script to do it then yeah, it's broken but it should work if you make a script manually.

I'll go try this shit out now.

Edit:
It works just fine, I don't see any problems with it?

Container.New(1):UseItemWithGround(0,32190,32432,8 ) -- fibula door



do i use the x,y,z for the spot infront or behide the door?
ON the door.

soul4soul
01-13-2013, 02:48 PM
If they were using forgees script to do it then yeah, it's broken but it should work if you make a script manually.

I'll go try this shit out now.

Edit:
It works just fine, I don't see any problems with it?

Container.New(1):UseItemWithGround(0,32190,32432,8 ) -- fibula door


ON the door.
Thanks for letting me know. :) I had to assumed it work but I heard a seen many people have problems with it.

mrasdf
01-21-2013, 10:59 PM
How do I find out the spotnumber for the key?

EDIT: I found this by Spectrus

function useKeyOnDoor(keyID, x, y, z)
for i = 0, #Container.GetIndexes() - 1 do
local Cont = Container.New(i)
if Cont:CountItemsOfID(keyID) > 0 then
for s = 0, Cont:ItemCount() do
local item = Cont:GetItemData(s)
if item.id == keyID then
Cont:UseItemWithGround(s, x, y, z)
end
end
end
end
end

soul4soul
01-21-2013, 11:15 PM
How do I find out the spotnumber for the key?
0 = the first spot in a bp. 19 = the last spot. any time you move an item into a bp its put into spot 0.

mrasdf
01-22-2013, 08:09 AM
I ended up using these functions to open doors with a key. It will look for the key in the first opened backpack (mainbackpack)

--Find key in mainbackpack and use on position
function useKeyOnDoor(keyID, x, y, z)
local Cont = Container.New(0) -- check in main backpack (index is 0)
if Cont:CountItemsOfID(keyID) > 0 then
for s = 0, Cont:ItemCount() do --find specific itemid spot
local item = Cont:GetItemData(s)
if item.id == keyID then
Cont:UseItemWithGround(s, x, y, z)
end
end
end
end

--Open door with key
function openDoor(x,y,z,keyid)
if not (Map.IsTileWalkable(x,y,z)) then --is door already open
Self.UseDoor(x,y,z)
wait(900,1200)
if not (Map.IsTileWalkable(x,y,z)) then --it is locked
useKeyOnDoor(keyid, x,y,z)
wait(900,1200)
end
end
end

Kamoblindside77
03-05-2014, 08:14 AM
this helped me!