Page 1 of 1
want to open a door when a spell is cast
Posted: Wed Apr 24, 2013 1:19 pm
by lujan
Hi all,
I want to open a door when a spell (light spell) is cast, i looked for in all threads but haven't found the right script,
any tip for me?
Re: want to open a door when a spell is cast
Posted: Wed Apr 24, 2013 4:19 pm
by Komag
You would add an onCastSpell hook to the party (or possibly onCast to the spell itself)
Re: want to open a door when a spell is cast
Posted: Thu Apr 25, 2013 4:23 am
by Grimfan
Or implement the zo spell from the Exsp framework (it is not a light spell however, and you need the exsp framework [and hence the JKos framework] to use it properly I think)
Re: want to open a door when a spell is cast
Posted: Thu Apr 25, 2013 12:23 pm
by lujan
Thx for your answer even if i don't understand anything :p
You would add an onCastSpell hook to the party (or possibly onCast to the spell itself)
i tried that but it does not work, i don't know what is wrong:
hidden treasure plate connected to a script,
script :
function open()
if party:getChampion(1): onCast :"firebusrt"
then
temple_door_1 : open()
else
temple_door_1 : close()
end
I don't know how to do hook.
Re: want to open a door when a spell is cast
Posted: Thu Apr 25, 2013 12:42 pm
by Damonya
onCastSpell is a hook only for party, not in script_entity
http://www.grimrock.net/modding/asset-d ... reference/
You must open the init.lua
and add
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onCastSpell = function( self , spell )
if spell.name == "fireburst" then
your_script_entity.your_function()
end
end,
}
Re: want to open a door when a spell is cast
Posted: Thu Apr 25, 2013 3:12 pm
by msyblade
As an alternative, you could change the spell to fireball, and place a hidden receptor over the door. Damonya's hook will work perfect tho.
Re: want to open a door when a spell is cast
Posted: Fri Apr 26, 2013 12:22 pm
by lujan
Thx

Re: want to open a door when a spell is cast
Posted: Fri Apr 26, 2013 12:50 pm
by Damonya
msyblade wrote:As an alternative, you could change the spell to fireball, and place a hidden receptor over the door. Damonya's hook will work perfect tho.
I think receptor on door doesn't work. Receptors works only against wall.
Otherwise, you have to change the model of the receptor