On click with left Mouse Button

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

On click with left Mouse Button

Post by Eleven Warrior »

hi again guys..

Is there a function that allows you to Click on a object and then Play a sound.. I have the onPickUp done but that's different..

EG: Player left clicks on a altar and it plays a sound..

I hope it can be done I have a great idea for this if it works..

Thank You again..
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: On click with left Mouse Button

Post by Komag »

you could have an invisible object there, use onPickUpItem
Finished Dungeons - complete mods to play
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: On click with left Mouse Button

Post by Eleven Warrior »

Hi Komag..

That sound like a good idea, I like it. but would the party actually pick the Invisible Item Up??
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: On click with left Mouse Button

Post by Komag »

after the hook does whatever you want it to you just finish it off with return false (for items of that name) and the item won't be picked up.
Finished Dungeons - complete mods to play
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: On click with left Mouse Button

Post by Eleven Warrior »

Thank you Komag will try my best with this Idea..
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: On click with left Mouse Button

Post by Eleven Warrior »

Hi Komag..

This is the Object I created: well Mysblade made it for me, I just tried to do something as you said..

cloneObject{
name = "Invisible_1",
baseObject = "dragon_statue",
model = "mod_assets/models/invisible_wall.fbx",
onPickUpItem = function (self,item)
playSound("level_up")
return
false
end
}

It does not work, where did I go wrong here???? Do I have to add it to my init.lua file as a onPickup???

Thxs
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: On click with left Mouse Button

Post by Dr.Disaster »

It does not work, where did I go wrong here?
- make sure you have the files referenced in the model and playSound lines
- do not split commands that belong into one line like "return false"
- watch the punctuation

Code: Select all

cloneObject{
     name = "Invisible_1",
     baseObject = "dragon_statue",
     model = "mod_assets/models/invisible_wall.fbx",
     onPickUpItem = function (self,item)
         playSound("level_up")
         return false
     end,
}
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: On click with left Mouse Button

Post by Eleven Warrior »

Thxs again Doc will give it a try..
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: On click with left Mouse Button

Post by Eleven Warrior »

I have done this and it does not work.. All the files are in the right place no probs.. Do I have to add it in my init.lua file ?? I cant understand why the Object wont work.. Any other Object I add a command to does LOL..

I placed it the Dungeon clicked on it and nothing Dammm.. The invisible Object is there I run into it and it blocks me, I click on it and nothing

---- This for on touch waiting for reply ----
cloneObject{
name = "Invisible_1",
baseObject = "dragon_statue",
model = "mod_assets/models/invisible_wall.fbx",
onPickUpItem = function (self,item)
playSound("level_up")
return false
end,
}

Thxs for the help though
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: On click with left Mouse Button

Post by msyblade »

you cannot pick up a dragon statue, make it an item, rather than an object.
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
Post Reply