Healing Crystal : anti-click system

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Healing Crystal : anti-click system

Post by Damonya »

I have a problem with healing crystal. You can heal through a secret-wall, a door or wall grating.

But I wish that we can't do it. How shall we do it ? Maybe with script, but I don't know where to start. First maybe, what is the function that the mouse click on the crystal? I may disable it temporarily if I find the function. :?:
Last edited by Damonya on Wed Mar 13, 2013 3:30 pm, edited 1 time in total.
Orwak - MOD - Beta version 1.0
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Healing Crystal : not pass through walls-doors

Post by Komag »

I haven't tried to mess with this before. Maybe you could spawn a large area fake alcove in front of it?
Finished Dungeons - complete mods to play
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: Healing Crystal : not pass through walls-doors

Post by Damonya »

Perhaps the easiest way is to spawn a fake healing crystal without healing, only the texture.

Of course it is temporary. Example with 2 hidden_pressure, and 1 counter :
SpoilerShow

Code: Select all

function permuthealcryst()
if counter:getValue()==0 then
healing_fake_permut:destroy()
spawn("healing_crystal", L, X, Y, 1,"healing_crystal_permut")
counter:setValue(1)
end
end

Code: Select all

function permuthealfake()
if counter:getValue()==1 then
healing_crystal_permut:destroy()
spawn("fake_crystal", L, X, Y, 1,"healing_fake_permut")
counter:setValue(0)
end
end

But I would like a little help to make a fake crystal in objets.lua

because with it:
SpoilerShow

Code: Select all

cloneObject{
   name = "healing_crystal_fake",
   baseObject = "metal_junk_block",
	model = "assets/models/env/healing_crystal.fbx",
	animation = "assets/animations/env/healing_crystal_spin.fbx",
	particleSystem = "crystal",
	editorIcon = 60,
}
It works fine, but I don't have animation and light on the crystal.
Last edited by Damonya on Wed Mar 13, 2013 2:59 pm, edited 1 time in total.
Orwak - MOD - Beta version 1.0
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: Healing Crystal : not pass through walls-doors

Post by Damonya »

Ok after much testing, the Gobelin is the ideal candidate. So an another solution is to place a gobelin in front the healing crystal. The problem I can't create a gobelin keeps its characteristic mesh (don't onclick), but with invisible texture in GMT. :oops:

I will do it. :lol:

EDIT : Yes ! I redefined the gobelin with the texture dream_fog and it runs impeccably.

In GMT, take the gobelin.model and Tools -> Material Find / Replace. Select "gobelin" from the existing material name dropdown and then type 'anti_click' into the New Material Name box. Close the dialogue and click "Tools -> Reload Material Library". Do the same with "chain_metal_dark" to "invisible". Save your new file to anti_click.model to your mod_assets/models folder.

objects.lua :
SpoilerShow

Code: Select all

defineObject{
	name = "anti_click",
	class = "WallTapestry",
	model = "mod_assets/models/anti_click.fbx",
	brokenModel = "assets/models/env/gobelin_torn.fbx",
	placement = "wall",
	editorIcon = 92,
}
material.lua :
SpoilerShow

Code: Select all

defineMaterial{
	name = "anti_click",
	diffuseMap = "assets/textures/dream/dream_fog_02_dif.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = true,
	blendMode = "Translucent",
	textureAddressMode = "Wrap",
	glossiness = 20,
	depthBias = 0,
}
defineMaterial{
	name = "invisible",
	diffuseMap = "assets/textures/dream/dream_fog_02_dif.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Translucent",
	textureAddressMode = "Wrap",
	glossiness = 60,
	depthBias = 0,
}
You have now a transparent anti_click object. :D

Now the problem is if you attack, the gobelin tears and you can click again. But I've seen posts to prevent attack, so it shouldn't pose more problem. In the init.lua via script with the onAttack = function( self , weapon )

It runs. ;)

PS : I changed the title of the topic
Orwak - MOD - Beta version 1.0
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: Healing Crystal : anti-click system

Post by Damonya »

It is better with :
SpoilerShow

Code: Select all

defineObject{
   name = "anti_click",
   class = "WallTapestry",
   model = "mod_assets/models/anti_click.fbx",
   brokenModel = "mod_assets/models/anti_click.fbx",
   placement = "wall",
   editorIcon = 92,
}
and to prevent attack, the Marble Mouth's script is perfect : viewtopic.php?f=14&t=4886&p=54140&hilit=ghost#p54140

The only problem is with spells. For example, a fire spell, tears the invisible gobelin and you can click again. But I couldn't do better I think. The gobelin's broken model must be hard coded into the game engine.

However, this feature gives me an idea of puzzle :lol:
Orwak - MOD - Beta version 1.0
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: Healing Crystal : anti-click system

Post by JohnWordsworth »

I don't know if you can tell if a Gobelin is broken or not, but could you repeatedly destroy and recreate the Gobelin once per second if and only if you are standing on the space in front of the crystal?
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: Healing Crystal : anti-click system

Post by Damonya »

Yes I thought that putting the same model.fbx in the brokenModel of the gobelin's object.lua, it would spawn the same unused mesh gobelin when you damaged it. But no. I don't know why. The texture of the brokenModel is invisible but I don't have the unused mesh gobelin.
Orwak - MOD - Beta version 1.0
Alcator
Posts: 37
Joined: Fri Apr 13, 2012 9:59 am

Re: Healing Crystal : anti-click system

Post by Alcator »

You could always move the crystal one tile further... ;-)

(Sorry, but that's how I solved it in my maps)
Post Reply