Page 1 of 1
Hello!! How to check an item position ?
Posted: Sat Jul 20, 2013 9:04 pm
by Vatticson
Hi! im new to this forum
I've finished Legend of Grimrock twice a year ago, but became interested in the editor just a week ago
So... i do have a doubt!!
I've did some alcove item checking thanks to another thread you have here, like "you put a blue gem here, and the door opens, tadaa!!", but my doubt is: how to check if a specific object is at some specific coordinates?
Let's say i want some item at a tile, on the ground, to trigger a teleport [n]after[/n] some torches are correctly put in their holders
Please help me with this!! see ya!
Re: Hello!! How to check an item position ?
Posted: Sun Jul 21, 2013 12:21 am
by remma
you'd want something like this - replace the xxx with the length of your item's name
Code: Select all
function killpillar1()
for i in entitiesAt(self.level,x_position,y_position) do
if i.name:sub(0,xxx)== "your_item_here" then
--do_stuff_here
end
end
end
edit: it's Saturday and I've had a couple sorry
Re: Hello!! How to check an item position ?
Posted: Sun Jul 21, 2013 12:55 pm
by Komag
you don't need to use the sub code unless you plan to search for only part of the name. If you're going to search for the full name, just do
if i.name == "your_item_here" then
sub can be very useful at times, but probably not here
In this case, using the name will work if you don't need it to be a very specific item, such as a particular rock, but any rock will work. This is probably the best approach.
Re: Hello!! How to check an item position ?
Posted: Sun Jul 21, 2013 10:23 pm
by Vatticson
OOOkey! i've decided to use a counter in combination with a script
So, the counter is set at 5, linked to the 4 torches which need to be activated. And then there's the item-thingy.
This is what i've written and doesn't work

:
function plataformacounter()
for i in entitiesAt(2, 8, 10) do
if i.name == "daggerdragon" then
counter_dragon:decrement()
print (counter_dragon:getValue())
break
end
end
end
When i put the said dagger on the floor on that tile, the teleport does not spawn! neither the print message appears. I've tried to use before a simple conector with a hidden plate and the teleported worked... but that's it! i want a specific item to trigger it.
What's happening??

Re: Hello!! How to check an item position ?
Posted: Sun Jul 21, 2013 10:57 pm
by remma
your code seems to work. What you'll need, however, is a trigger for the script. You could either set a timer to run the script every now and then or put in a hidden pressure plate
Re: Hello!! How to check an item position ?
Posted: Mon Jul 22, 2013 1:15 am
by Vatticson
Oh!!! now it works

thanks for the help guys ^^
EDIT!! more doubts :S
For this SPECIAL item, i want a rock with the appearance of the Zhandul orb (meaning, i don't want any stat in it).
Im trying to use the cloneObject{ in my dungeon assets, but i use the rock as baseObject and to change the model to the zhandul i've written "model = "zhandul_orb.fbx"", but it doesn't work. How can i make it right?
Re: Hello!! How to check an item position ?
Posted: Mon Jul 22, 2013 3:45 am
by JohnWordsworth
It needs to be the full path to the item, not just the model name. So something like this;
Code: Select all
cloneObject{
name = "rock_orb",
baseObject = "rock",
uiName = "Defunct Zhandul's Orb",
model = "assets/models/items/zhandul_orb.fbx",
gfxIndex = 157,
}
If you don't want the user to be able to throw it as a weapon, fire it from a sling or to stack it with other objects of the same type, you will need to change some other of the default properties of the basic rock, such as;
throwingWeapon = false
stackable = false
ammoType = nil
Or you can define a whole new object if you want to make something that doesn't share any properties of a rock.