Ask a simple question, get a simple answer

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!
GoldenShadowGS
Posts: 168
Joined: Thu Oct 30, 2014 1:56 am

Re: Ask a simple question, get a simple answer

Post by GoldenShadowGS »

TheLastOrder wrote:How can I teleport to its original starting point a pushable block through a button?

I want to avoid that a player reaches a dead end where the puzzle can´t be solved... because all pushable blockers could be blocking each others.

Thanks in advance guys!

Code: Select all

function resetBlock()
--change "pushable_block_floor_1" to the Id of the floor tile you want your block to reset onto
	local pos = pushable_block_floor_1:getWorldPosition()
--change "pushable_block_1" to the ID of your pushable block 
	local b = pushable_block_1
	spawn("teleportation_effect",b.level,b.x,b.y,b.facing,b.elevation)
	b:setWorldPosition(pos)
	spawn("teleportation_effect",b.level,b.x,b.y,b.facing,b.elevation)
end
User avatar
TheLastOrder
Posts: 104
Joined: Wed Oct 17, 2012 1:56 am

Re: Ask a simple question, get a simple answer

Post by TheLastOrder »

Soaponarope wrote:I don't think you can teleport them, but you can destroy them and spawn new ones in the original positions.
GoldenShadowGS wrote:

Code: Select all

function resetBlock()
--change "pushable_block_floor_1" to the Id of the floor tile you want your block to reset onto
	local pos = pushable_block_floor_1:getWorldPosition()
--change "pushable_block_1" to the ID of your pushable block 
	local b = pushable_block_1
	spawn("teleportation_effect",b.level,b.x,b.y,b.facing,b.elevation)
	b:setWorldPosition(pos)
	spawn("teleportation_effect",b.level,b.x,b.y,b.facing,b.elevation)
end
Thanks truly!!!!!

The puzzle is finished, but I´m facing another problem here:

I can´t walk over the last positions that the pushable blocks had before respawning them, why could this be happening?
The blocks spawns in the original spots apparently right and there´s nothing left on the rest of the floor squares...
User avatar
TheLastOrder
Posts: 104
Joined: Wed Oct 17, 2012 1:56 am

Re: Ask a simple question, get a simple answer

Post by TheLastOrder »

SOLVED ----

How can I destroy the "ghosts" of the pushable blockers once they had respawn into the original positions?
(take a look to previous messages for more info)

Tested a few things with a:destroy() with the local comp but no way to do it.
Cloning the blocks and destroying the old ones isn't working neither.... :| as the reference works only the first time-cycle...

Code: Select all

function dedicadoaBertolucci()
   the_blockers_block_1:destroy()
   the_blockers_block_2:destroy()
   the_blockers_block_3:destroy()
   the_blockers_block_4:destroy()
   spawn("pushable_block", 10, 13, 16, 1, 0, "the_blockers_block_1")
   spawn("pushable_block", 10, 14, 15, 2, 0, "the_blockers_block_2")
   spawn("pushable_block", 10, 14, 16, 3, 0, "the_blockers_block_3")
   spawn("pushable_block", 10, 15, 16, 0, 0, "the_blockers_block_4")
end
Easier way. However, I still don´t know why the engine generates ghost entities tho.
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Re: Ask a simple question, get a simple answer

Post by Soaponarope »

I've made more items usable underwater but I don't want them to have a charge up feature while underwater. For instance being able to throw daggers while on land, but only stab in water. How would I disable aquatic trait for the power attack only?
User avatar
ReFreezed
Posts: 8
Joined: Tue Nov 25, 2014 7:10 pm
Contact:

Re: Ask a simple question, get a simple answer

Post by ReFreezed »

How do I wake up summon_stone_dormant monsters in a script? I can't seem to find a method for it.
GoldenShadowGS
Posts: 168
Joined: Thu Oct 30, 2014 1:56 am

Re: Ask a simple question, get a simple answer

Post by GoldenShadowGS »

ReFreezed wrote:How do I wake up summon_stone_dormant monsters in a script? I can't seem to find a method for it.

Code: Select all

summon_stone_dormant.controller:activate()
User avatar
ReFreezed
Posts: 8
Joined: Tue Nov 25, 2014 7:10 pm
Contact:

Re: Ask a simple question, get a simple answer

Post by ReFreezed »

Oh, that makes sense. Thanks GoldenShadowGS.
User avatar
Thorham
Posts: 80
Joined: Sat May 04, 2013 5:12 pm

Re: Ask a simple question, get a simple answer

Post by Thorham »

What's the light source for dungeons when there are no other light sources such as torches active? Dungeons are never completely dark, so the light has to come from somewhere.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

party.torch
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.
User avatar
Thorham
Posts: 80
Joined: Sat May 04, 2013 5:12 pm

Re: Ask a simple question, get a simple answer

Post by Thorham »

minmay wrote:party.torch
Thanks 8-)
Post Reply