Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
function Ghost(st)
fa = party.facing;
le = party.level;
xx = party.x;
yy = party.y;
zz = party.elevation;
dx, dy = getForward(fa);
party:setPosition(xx + dx * st, yy + dy * st, fa, zz, le)
end
The open door function (checking front and back side of a door) not working yet:
function Sesame()
fa = party.facing;
le = party.level;
xx = party.x;
yy = party.y;
dx, dy = getForward(fa)
for e in entitiesAt(le, xx, yy) do
if e.setDoorState and e.facing == fa then e:open()
end
end
for e in entitiesAt(le, xx + dx, yy + dy) do
if e.setDoorState and e.facing == (fa + 2) % 4 then e:open()
end
end
end
Last edited by Frenchie on Thu Jan 15, 2015 1:16 pm, edited 5 times in total.
In LoG2, the objects now have components... the door object for instance, has a door component, so the command to set the door [component] state would be: e.door:setDoorState() .... However... it seems to me that setDoorState() is broken in LoG2
Open() & close() work fine, but when I tried setDoorState("open") the door sunk into the floor.
function ghost(st)
fa = party.facing;
le = party.level;
xx = party.x;
yy = party.y;
dx, dy = getForward(fa);
party:setPosition( xx + dx * st, yy + dy * st, fa, party.elevation, le)
end
Thx Isaac, for clearing that up. I'm not fully understanding it all
As I look at the scripting reference it looks like entitiesAt only needs 2 variables -> Map:entitiesAt(number, number). So it doesn't need party level anymore?
Frenchie wrote:Thx Isaac, for clearing that up. I'm not fully understanding it all
As I look at the scripting reference it looks like entitiesAt only needs 2 variables -> Map:entitiesAt(number, number). So it doesn't need party level anymore?
So, in the Sesame function I need to change the entitiesAt to map:entitiesAt, but do we also need to do something with getOpeningDirection() since your door opened the wrong way?
Frenchie wrote:So, in the Sesame function I need to change the entitiesAt to map:entitiesAt, but do we also need to do something with getOpeningDirection() since your door opened the wrong way?
The door is not supposed to open the wrong way when called... That's an engine bug that Petri needs to look at.