want to open a door when a spell is cast

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
lujan
Posts: 3
Joined: Wed Apr 17, 2013 9:19 pm

want to open a door when a spell is cast

Post 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?
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: want to open a door when a spell is cast

Post by Komag »

You would add an onCastSpell hook to the party (or possibly onCast to the spell itself)
Finished Dungeons - complete mods to play
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: want to open a door when a spell is cast

Post 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)
lujan
Posts: 3
Joined: Wed Apr 17, 2013 9:19 pm

Re: want to open a door when a spell is cast

Post 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.
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: want to open a door when a spell is cast

Post 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,  	  
    }
Orwak - MOD - Beta version 1.0
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: want to open a door when a spell is cast

Post 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.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
lujan
Posts: 3
Joined: Wed Apr 17, 2013 9:19 pm

Re: want to open a door when a spell is cast

Post by lujan »

Thx :)
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: want to open a door when a spell is cast

Post 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
Orwak - MOD - Beta version 1.0
Post Reply