playMaker

Author Topic: Set duration of a game object  (Read 1640 times)

unearthly

  • Junior Playmaker
  • **
  • Posts: 62
Set duration of a game object
« on: February 27, 2017, 06:03:22 AM »
Hi

I have used an activate game object action on an FSM to show a gun smoke sprite. It is not triggered by a key or mouse press because I only want it active when the gun has ammo. That works fine, but the sprite hangs in the air too long.

I would like to control it's duration (to about a half second). I think I should be able to do that though a float variable. How could I go about it?

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Set duration of a game object
« Reply #1 on: February 27, 2017, 01:50:00 PM »
Have you tried to action "Wait" ?

Here is a basic tutorial. Wait can take a variable:
« Last Edit: February 27, 2017, 01:51:43 PM by tcmeric »

che1974

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Set duration of a game object
« Reply #2 on: February 27, 2017, 03:48:41 PM »
Here is a custom Action. I think this will help.
Destroy self with a Delay you want.



unearthly

  • Junior Playmaker
  • **
  • Posts: 62
Re: Set duration of a game object
« Reply #3 on: February 27, 2017, 06:27:56 PM »
Thanks again tcmeric.

Used my activate game object (plus a random rotate) with a wait of .1 seconds. Works fine.
I tend to over complicate my fsm's and I had unnecessary actions attached to different states.

che1974 I have downloaded your custom action. To use would I need a create object action followed by your destroyself2 to make my gun smoke?

che1974

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Set duration of a game object
« Reply #4 on: February 28, 2017, 07:57:27 AM »
Yes, my Idee was to spawn(Smoking, Explosion,...) and destroy after delay.