playMaker

Author Topic: Make game object variable empty and check if it is empty  (Read 2006 times)

masterr

  • Playmaker Newbie
  • *
  • Posts: 17
Make game object variable empty and check if it is empty
« on: March 30, 2016, 04:18:57 AM »
Hi there. I have problem with the game object variables. For instance i have (enemy) AI spaceship which follows another AI (Good) spaceship. And it shoots all the time to it. Enemy spaceship has `move forward` and `smooth look` at action on it and the `target` is GoodSpaceship. Question is how does this enemyAIspaceship would know if its target (goodSpaceship) is dead. How does it know that the target game object variable is now deleted?

I actually have one long solution for it but i want to ask if there is a short way for it. Currently i`m doing it this way. Each ship broadcasts event to all saying im Dead before destroying itself. And each spaceship compare the name of the ship which is dead to their targets. If the name of dead ship and the target ship is identical then attacking ship stops and goes to another direction. Other ships do nothing. This is a long way and i think it is expencive for the device too. That`s why i`m asking for a short solution.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Make game object variable empty and check if it is empty
« Reply #1 on: March 30, 2016, 04:37:19 AM »
Hi,

 Use "GameObjectIsNull" action, you should have this action shipped with PlayMaker

Bye,

 Jean

masterr

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Make game object variable empty and check if it is empty
« Reply #2 on: March 31, 2016, 04:02:32 AM »
Thanks. I`ll check it.

fabzs

  • Playmaker Newbie
  • *
  • Posts: 1
Re: Make game object variable empty and check if it is empty
« Reply #3 on: January 04, 2021, 12:27:12 PM »
Hello,
I'm bumping this up.
To me the "Game Object is Null" logic action doesn't work. It's seems that "null" and "none" is two different thing.

I'm feeding a game object variable (Current target) different games object (Enemies). It can be automatic for primary targets, or the player can manually override it and assign a secondary enemy as the current target.
The problem I have is that once the player kill a secondary target he manually assigned, I would like the game to go back to the automatic selection if the Current Target variable is empty. But the Game Object is Null fonction doesn't seems to work in this case. After the kill the Game object variable display "none" in the debug but doesn't trigger the Is null event.

Thanks to whoever may help me with that.