Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Wasn't there a possibillity to scale down the dimensions of a model in the object definition? Kind of an equivalent to setMaterial? I cannot find an entry in the definition reference. But I believe I have read somewhere in a post about that...
Re: Ask a simple question, get a simple answer
You cannot scale individual components. You can translate them with the "offset" field or Component:setOffset() and rotate them with the "rotation" field or Component:setRotationAngles().
You can, however, scale entire GameObjects: get the object's transformation matrix from GameObject:getRotation(), apply whatever changes you want (which could include scaling), and pass it back to GameObject:setRotation().
You can, however, scale entire GameObjects: get the object's transformation matrix from GameObject:getRotation(), apply whatever changes you want (which could include scaling), and pass it back to GameObject:setRotation().
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
Another way to achieve this is to rotate the gate node; this also works in LoG1.Skuggasveinn wrote:If you want a very simple animation for the sarcophagus like moving it backwards one tile then that can probably be done with a script that changes its offset every frame until its in place, scripting is not my strong suit,(so here is hoping someone will jump in with a good model offset move example)
Re: Ask a simple question, get a simple answer
is there a way to get identified, which floortrigger is pressed?
what I want to do is having a line of floortriggers. if a monster steps on one of them I want to have it pushed on the next one. for certain reasons I cannot use teleporters - I want the monster to be moved.
to avoid making several copies of nearly the same script, I'm looking for a way to identify which trigger is activated, send this information to my script and move the monster on that specific floortrigger. But I have no idea how to identify the trigger and send it's coordinates to my script...
script would look something like
local floortrigger = [information about trigger/coordinates]
local monster = [monster on same coordinates of floortrigger]
monster:knockback(0)
what I want to do is having a line of floortriggers. if a monster steps on one of them I want to have it pushed on the next one. for certain reasons I cannot use teleporters - I want the monster to be moved.
to avoid making several copies of nearly the same script, I'm looking for a way to identify which trigger is activated, send this information to my script and move the monster on that specific floortrigger. But I have no idea how to identify the trigger and send it's coordinates to my script...
script would look something like
local floortrigger = [information about trigger/coordinates]
local monster = [monster on same coordinates of floortrigger]
monster:knockback(0)
- Zo Kath Ra
- Posts: 940
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Ask a simple question, get a simple answer
Put this function in a script entity:THOM wrote:is there a way to get identified, which floortrigger is pressed?
what I want to do is having a line of floortriggers. if a monster steps on one of them I want to have it pushed on the next one. for certain reasons I cannot use teleporters - I want the monster to be moved.
to avoid making several copies of nearly the same script, I'm looking for a way to identify which trigger is activated, send this information to my script and move the monster on that specific floortrigger. But I have no idea how to identify the trigger and send it's coordinates to my script...
script would look something like
local floortrigger = [information about trigger/coordinates]
local monster = [monster on same coordinates of floortrigger]
monster:knockback(0)
Code: Select all
function test(caller)
hudPrint(caller.go.id)
end
Re: Ask a simple question, get a simple answer
Danke 
This function works. So, I hoped, I could deduce a simple solution. But sadly "caller.go.monster" doesn't seem to exist.
Will find a more painful way...
EDIT: Nonsense. The result of "caller.go.id" ist the trigger, not the triggering monster...

This function works. So, I hoped, I could deduce a simple solution. But sadly "caller.go.monster" doesn't seem to exist.
Will find a more painful way...
EDIT: Nonsense. The result of "caller.go.id" ist the trigger, not the triggering monster...
Re: Ask a simple question, get a simple answer
You ASKED for the trigger, not the triggering monster. You can find the triggering monster by using trigger.go.map:entitiesAt(trigger.go.x,trigger.go.y).
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
@minmay: I meant with "nonsense" myself... just wanted to edit in, what my earlier writing was...
Still some problems.
I have to do a delayedCall, because I have to stop the monsteranimation (therefore the monster self triggers the script, the knockback won't run while it's moving).
But to to handle this, I have to forward somehow which monster is meant.
I tried this, but caller seems to be an invalid message...

Still some problems.
I have to do a delayedCall, because I have to stop the monsteranimation (therefore the monster self triggers the script, the knockback won't run while it's moving).
But to to handle this, I have to forward somehow which monster is meant.
I tried this, but caller seems to be an invalid message...
Code: Select all
function moveMonsterNorth(caller)
for e in party.map:entitiesAt(caller.go.x, caller.go.y) do
if e.monster then
e.animation:stop()
delayedCall(self.go.id, 0.01, "move2", caller)
end
end
end
function move2(caller)
for e in party.map:entitiesAt(caller.go.x, caller.go.y) do
if e.monster then
e.monster:knockback(0)
end
end
end
Re: Ask a simple question, get a simple answer
Store the caller's id instead of the caller itself (which is unserializable and should NEVER be stored), and use findEntity() to retrieve it. Also you want to use caller.go.map, not party.map, otherwise you will get the wrong map if the party is on the level.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
Thanks.
my final result:
my final result:
Code: Select all
function moveMonsterNorth(caller)
for e in caller.go.map:entitiesAt(caller.go.x, caller.go.y) do
if e.monster then
calling = caller.go.id
e.animation:stop()
delayedCall(self.go.id, 0.01, "move2", calling)
end
end
end
function move2(calling)
for e in party.map:entitiesAt(findEntity(calling).x, findEntity(calling).y) do
if e.monster then
e.monster:knockback(0)
end
end
end