Page 1 of 1
Trigger Pressure Plates by certain item?
Posted: Sat Oct 13, 2012 3:53 am
by Brodie301
Trying to open a door by pressure only if certain item is on it.
I can trigger by any item in editor and i even tried my hand at scripting finally to do this and a couple other things.
But script comes back as error nil value no matter how i try it.
Any ideas helpful welcome
Re: Trigger Pressure Plates by certain item?
Posted: Sat Oct 13, 2012 4:05 am
by Neikun
...Hmm Alcove with xyz position on the ground and a on insertitem hook?
Sorry. I'm tired and sick. Kinda a half-assed answer, and I'm sure there's an easier way.
Re: Trigger Pressure Plates by certain item?
Posted: Sat Oct 13, 2012 4:24 am
by YpsiNine
You can do something like this if you go by name of the item, just connect the pressure plate to the script.
Code: Select all
function itemCheck()
for item in entitiesAt(1, 16, 21) do
if item.name == "dagger" then
print("yeah baby")
end
end
end
Or by the id of the item:
Code: Select all
function itemCheck()
for item in entitiesAt(1, 16, 21) do
if item.id == "dagger_1" then
print("yeah baby")
end
end
end
And just add as much code as you need instead of the print-line. And remember to change to the 1, 16, 21 numbers to your Level number and X and Y coordinates of your pressure plate. And of course the item you want instead of dagger.
Re: Trigger Pressure Plates by certain item?
Posted: Sat Oct 13, 2012 10:42 pm
by Brodie301
Could not get this to work with pressure plate but did with this script and alcove instead like Neikun suggested but I used wall alcove and didn't try to flip it to floor since still figuring out scripting.
Re: Trigger Pressure Plates by certain item?
Posted: Sat Oct 13, 2012 11:14 pm
by YpsiNine
Brodie301 wrote:Could not get this to work with pressure plate but did with this script and alcove instead like Neikun suggested but I used wall alcove and didn't try to flip it to floor since still figuring out scripting.
It works fine but you have to set the pressure plate to activate by item only.
Re: Trigger Pressure Plates by certain item?
Posted: Sat Oct 13, 2012 11:36 pm
by Brodie301
When I did it was any item would trigger even with script I'll try it again deeper in my dungeon since it was the first script I actually got to work even if it was a little altered.
Thanks for it.
Re: Trigger Pressure Plates by certain item?
Posted: Sun Oct 14, 2012 6:58 am
by Broken|Glass
viewtopic.php?f=14&t=3620
I posted this a while back, and this works perfectly.