Page 1 of 1

Healing Crystal : anti-click system

Posted: Wed Mar 13, 2013 10:38 am
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. :?:

Re: Healing Crystal : not pass through walls-doors

Posted: Wed Mar 13, 2013 11:36 am
by Komag
I haven't tried to mess with this before. Maybe you could spawn a large area fake alcove in front of it?

Re: Healing Crystal : not pass through walls-doors

Posted: Wed Mar 13, 2013 11:55 am
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.

Re: Healing Crystal : not pass through walls-doors

Posted: Wed Mar 13, 2013 1:18 pm
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

Re: Healing Crystal : anti-click system

Posted: Fri Mar 15, 2013 9:09 am
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:

Re: Healing Crystal : anti-click system

Posted: Fri Mar 15, 2013 11:19 am
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?

Re: Healing Crystal : anti-click system

Posted: Fri Mar 15, 2013 11:56 am
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.

Re: Healing Crystal : anti-click system

Posted: Sun Mar 17, 2013 5:07 pm
by Alcator
You could always move the crystal one tile further... ;-)

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