Hello!! How to check an item position ?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Vatticson
Posts: 3
Joined: Sat Jul 20, 2013 8:57 pm

Hello!! How to check an item position ?

Post by Vatticson »

Hi! im new to this forum :D

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!
User avatar
remma
Posts: 36
Joined: Mon Apr 15, 2013 11:03 pm
Location: Newcastle upon Tyne, England

Re: Hello!! How to check an item position ?

Post 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
User avatar
Komag
Posts: 3656
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Hello!! How to check an item position ?

Post 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.
Finished Dungeons - complete mods to play
Vatticson
Posts: 3
Joined: Sat Jul 20, 2013 8:57 pm

Re: Hello!! How to check an item position ?

Post 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?? :o
User avatar
remma
Posts: 36
Joined: Mon Apr 15, 2013 11:03 pm
Location: Newcastle upon Tyne, England

Re: Hello!! How to check an item position ?

Post 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
Vatticson
Posts: 3
Joined: Sat Jul 20, 2013 8:57 pm

Re: Hello!! How to check an item position ?

Post by Vatticson »

Oh!!! now it works :D 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?
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: Hello!! How to check an item position ?

Post 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.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Post Reply