playMaker

Author Topic: click specific object? [SOLVED]  (Read 243 times)

Nietzsche

  • Playmaker Newbie
  • *
  • Posts: 26
    • View Profile
click specific object? [SOLVED]
« on: August 31, 2019, 08:28:09 AM »
hello,
can someone help me please. I am using the action: "getmousebuttondown" a few times in my project. Standard stuff, I want to select a unit before I can move it and so on. My problem is now, that since multiple objects use the command "getmousebuttondown" they all play at the same time, even if they shouldn't.

That is an extreme problem with the ui. Do you guys maybe no a diffrent command for that, that can help me with my problem?
« Last Edit: September 02, 2019, 04:30:07 AM by Nietzsche »

TheNecron

  • Playmaker Newbie
  • *
  • Posts: 11
    • View Profile
Re: click specific object?
« Reply #1 on: August 31, 2019, 10:26:15 AM »
Get Mouse Button Down triggers whenever any click event occurs regardless of where the mouse is. I'm not knowledgeable enough to know what action you're looking for, maybe try Mouse pick?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4582
    • View Profile
    • jinxtergames
Re: click specific object?
« Reply #2 on: August 31, 2019, 10:39:55 AM »
Hi.
As TheNecron mention.

Mouse pick can be useful here

You still need to use mouse button down, to know if the mouse button was clicked.
Then after "getmousebuttondown" do the mouse pick. and store the object in a variable.

With layers you can make sure only certain layers can be picked.
(you can set layers on object in the top right of the inspector, be aware that you have a limit of 32 layers)

You can set a layer an name it for example Units, then you can also set a tag to give  a more specific reference (for example 'melee soldier')

Nietzsche

  • Playmaker Newbie
  • *
  • Posts: 26
    • View Profile
Re: click specific object?
« Reply #3 on: August 31, 2019, 11:55:59 AM »
thank you for the help I will try to implement that  :)

Nietzsche

  • Playmaker Newbie
  • *
  • Posts: 26
    • View Profile
Re: click specific object?
« Reply #4 on: August 31, 2019, 12:51:35 PM »
thank you for the tip with "mousepick" works very well, just to tell, I made it so that I click an object first, safe the object I pick in a viriable and compare that variable to the object I actually wanted to move. With this it worked well so far, or ist there anything bad about it?

And one thing still doesn't work, how do I use the mouse pick for my UI?

So far mouse pick didn't detect the UI but the physical object beneath it, or do I need to ad a physical layer to the UI?
« Last Edit: August 31, 2019, 01:04:21 PM by Nietzsche »

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 731
    • View Profile
Re: click specific object?
« Reply #5 on: August 31, 2019, 07:18:14 PM »

Nietzsche

  • Playmaker Newbie
  • *
  • Posts: 26
    • View Profile
Re: click specific object?
« Reply #6 on: September 01, 2019, 12:47:58 AM »
I will watch them throu, thanks m8

stigma

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: click specific object?
« Reply #7 on: September 01, 2019, 02:46:15 AM »
I had a lot of trouble with that. Now I only use MouseDown and it works very well.

Nietzsche

  • Playmaker Newbie
  • *
  • Posts: 26
    • View Profile
Re: click specific object?
« Reply #8 on: September 01, 2019, 05:21:05 AM »
jo, I watched all of that rts series, and while it was certainly helpfull, it still doesn't solve my button pressing issue.

Same question, do I need to add some kind of physical layer to the buttons?
Or could it be better to not use playmaker for the ui but normal scripting?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4582
    • View Profile
    • jinxtergames
Re: click specific object?
« Reply #9 on: September 01, 2019, 09:45:58 AM »
Hi.
Mouse pick does not work on ui.

You have several dedicated UI actions.
For example : Ui Button On Click Event

Nietzsche

  • Playmaker Newbie
  • *
  • Posts: 26
    • View Profile
Re: click specific object?
« Reply #10 on: September 01, 2019, 01:07:35 PM »
I am sorry, but I don't really understand how this action works. What exactly triggers it? And if it is triggered anytime I press a ui button, then I will end up with the same problem.

more specificly: can I safely trigger only one button with an playmaker action by clicking on it, or is that achievable with "UI Trigger event"
« Last Edit: September 01, 2019, 01:10:50 PM by Nietzsche »

Nietzsche

  • Playmaker Newbie
  • *
  • Posts: 26
    • View Profile
Re: click specific object?
« Reply #11 on: September 02, 2019, 04:29:46 AM »
thanks for you help guys. I got my problem solved