Page 1 of 2

On click with left Mouse Button

Posted: Fri Sep 27, 2013 3:58 am
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..

Re: On click with left Mouse Button

Posted: Fri Sep 27, 2013 5:19 pm
by Komag
you could have an invisible object there, use onPickUpItem

Re: On click with left Mouse Button

Posted: Sat Sep 28, 2013 1:06 am
by Eleven Warrior
Hi Komag..

That sound like a good idea, I like it. but would the party actually pick the Invisible Item Up??

Re: On click with left Mouse Button

Posted: Sat Sep 28, 2013 2:23 am
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.

Re: On click with left Mouse Button

Posted: Sat Sep 28, 2013 5:54 am
by Eleven Warrior
Thank you Komag will try my best with this Idea..

Re: On click with left Mouse Button

Posted: Sat Sep 28, 2013 7:52 am
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

Re: On click with left Mouse Button

Posted: Sat Sep 28, 2013 2:29 pm
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,
}

Re: On click with left Mouse Button

Posted: Sat Sep 28, 2013 3:26 pm
by Eleven Warrior
Thxs again Doc will give it a try..

Re: On click with left Mouse Button

Posted: Sat Sep 28, 2013 3:53 pm
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

Re: On click with left Mouse Button

Posted: Sat Sep 28, 2013 6:17 pm
by msyblade
you cannot pick up a dragon statue, make it an item, rather than an object.