Page 1 of 2

a little help ;)

Posted: Mon Sep 17, 2012 1:20 am
by papazombie
1 - Well, How can I do a dungeon_alcove only works with a concrete item? f.e. only with a rock.
thanks ;)

2 - I have a problem conecting levels with stairs; when I go down it works but when i want go up it doesnt work; the party stop
thanks again ;)

Re: a little help ;)

Posted: Mon Sep 17, 2012 2:46 am
by Komag
1. I don't understand the question

2. It's easy to mix up the directions on the stairs. It's also easy to forget to keep the stair square empty

Re: a little help ;)

Posted: Mon Sep 17, 2012 8:31 am
by juho
1. See if this helps: viewtopic.php?f=14&t=3099#p31524

2. Make sure that you have correct stairs in a right direction and that you have cleared the the space where the stairs are.

Re: a little help ;)

Posted: Mon Sep 17, 2012 2:15 pm
by papazombie
1 - It works; i had to put stairs on the same square and add empty square on each stair...thanks :D


2 - I need that a concrete item like a dagger put on an alcove opens a door. I dont know how to modificate the link you passed me to make this because i dont know programming in LUA :roll:

Re: a little help ;)

Posted: Mon Sep 17, 2012 3:06 pm
by Billick
If you want to check for a specific item in an alcove, I don't think there's any way around writing a little bit of code. Maybe I can give you an example that's a little bit closer to what you want to do. First off create your alcove and door, if you haven't already. Then create a script_entity object (it has the "lua" icon in the object browser). It doesn't matter where you put it on the map, but you will want to put it close to your door and alcove so that you remember it goes with them. Select you entity, and add this code into your script entity in the big text box in the inspector tab:

Code: Select all

function daggerCheck()
   for i in my_alcove:containedItems() do
      if i.name == "dagger" then
         my_door:open()
      end
   end
end
Replace my_alcove with the ID of your alcove (something like dungeon_alcove_1), and my_door with the ID of your door. You can find the IDs in the inspector tab when you select them. Then select your alcove and click on the add connection button, and select the script_entity you created. At this point, you should be set to go. Placing a dagger on your alcove should open the door for you.

Re: a little help ;)

Posted: Mon Sep 17, 2012 3:31 pm
by Komag
ah, that's nice and clean, I've added it to the script repository :)

Re: a little help ;)

Posted: Mon Sep 17, 2012 7:17 pm
by papazombie
2 - WOW; thanks a lot :D

Re: a little help ;)

Posted: Mon Sep 17, 2012 7:41 pm
by papazombie
I wonder if you could write for 2 or more concretes items in 2 or more alcoves to open a door. For example; to open a door you have to put a dagger on the first alcove and a compass on the second alcove. I have tried to modify what you write but it doesnt work. Thanks again ;)

Re: a little help ;)

Posted: Mon Sep 17, 2012 8:30 pm
by Komag
you can just add in a counter in the process

Re: a little help ;)

Posted: Mon Sep 17, 2012 8:45 pm
by Magus
This should work for you, its basically the same version like Billick posted, just with 2 alcoves and 2 booleans.

Code: Select all

alcoveBool1 = false
alcoveBool2 = false

function alcove1Check()
	for i in my_alcove1:containedItems() do
		if i.name == "dagger" then
			alcoveBool1 = true
			checkAlcove()
		end
	end
end

function alcove2Check()
	for i in my_alcove2:containedItems() do
		if i.name == "compass" then
			alcoveBool2 = true
			checkAlcove()
		end
	end
end

function checkAlcove()
	if alcoveBool1 and alcoveBool2 then
		my_door:open()
	end
end