Where did findEntity(), entitiesAt() and allEntities() go?
Where did findEntity(), entitiesAt() and allEntities() go?
These entity-based global functions were in Grim Rock 1 but I cannot seem to get them to work in 2. Does anybody know what happened to them?
Re: Where did findEntity(), entitiesAt() and allEntities() g
theyre still here...
atleast this works for me.
atleast this works for me.
Code: Select all
function test()
print ("findentity")
local x = findEntity("altar_1")
if x then
print(x.id)
end
print ("allentities")
for e in self.go.map:allEntities() do
if e.monster then
print (e.id)
end
end
print ("entitiesat")
for i in self.go.map:entitiesAt(11,15) do
print (i.id)
end
end
Re: Where did findEntity(), entitiesAt() and allEntities() g
I have used them all myself without problems; well some problems but programmer errors. =)
Re: Where did findEntity(), entitiesAt() and allEntities() g
Yes, your code works. Ugh, I am so new to this stuff. So what keeps throwing me is when script reference "go". As in this code:
for i in self.go.map:entitiesAt(14,14) do
print (i.id)
end
So I know "self" would be the object this function is called on. I called it globally so not sure what exactly "self" in this case. But was is "go"?
for i in self.go.map:entitiesAt(14,14) do
print (i.id)
end
So I know "self" would be the object this function is called on. I called it globally so not sure what exactly "self" in this case. But was is "go"?
Re: Where did findEntity(), entitiesAt() and allEntities() g
"go" i think is GameObject
Seems like sometimes they wrap a gameobject inside a messageobject of some kind (just me guessing)
So for instance with "self" and the "sender" parameter in a function, you have to grab the object with ".go"
ie.
Seems like sometimes they wrap a gameobject inside a messageobject of some kind (just me guessing)
So for instance with "self" and the "sender" parameter in a function, you have to grab the object with ".go"
ie.
Code: Select all
function somefunction(sender)
print (sender.go.id)
end