playMaker

Author Topic: [HOW] collecting 5 items with countdown  (Read 2024 times)

dhanze

  • Playmaker Newbie
  • *
  • Posts: 25
[HOW] collecting 5 items with countdown
« on: February 02, 2015, 04:53:32 AM »
Hello, Im newbie and a little knowledge about scripting.

I cant figure on How the player collect 5 items within 5 mins countdown  to finish the stage using fsm

please give me an idea or instruction Im working on a project (adventure)

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Re: [HOW] collecting 5 items with countdown
« Reply #1 on: February 02, 2015, 06:08:33 AM »
Create a global float [items count] and a global bool [5_items]

In the scene create a trigger that sets [items count] to 0 and also starts a count down timer set at 300 (5 x 60 seconds).
On each item set up a trigger to add 1 to your [items count] variable.
Have an FSM that listens to the [items count] variable and when it reaches a count of 5 then set the [5_items] bool to TRUE.
on [5_items] = TRUE have the timer stop and next state = success.
If the countdown timer reaches 0 then next state = fail.

dhanze

  • Playmaker Newbie
  • *
  • Posts: 25
Re: [HOW] collecting 5 items with countdown
« Reply #2 on: February 02, 2015, 08:37:13 AM »
richardh

can you xplain into a diagram?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: [HOW] collecting 5 items with countdown
« Reply #3 on: February 02, 2015, 10:02:32 AM »
a different way you can do is give the 5 items a trigger or collision action and a set bool value that will be set to true when collected

then on a different fsm you can use Countdown timer (this is a custom action and can be found on the Ecosystem and put "bool all true" together with the timer
set bool variables to 5 and and the names you have given to your items
and check every frame on

in this way you can also check what items are still needed if you want to, but if you have many items it might be better to use add int on your items and use int compare like Richardh suggested

here are also several tutorial which can help you.

Friendly Greetings,

Dino

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: [HOW] collecting 5 items with countdown
« Reply #4 on: February 02, 2015, 10:25:15 AM »
I highly suggest you go through these tutorials:

http://www.youtube.com/playlist?list=PLC759306A1E692A10

You need a timer and must maintain a number of collected items. Primitively, you can do the timer with a Wait action, then just have some Int variable which you increase whenever you touch one of the things you must collect. Use an Int Compare on that number and when it reaches 5 then you win.

Simple in practice, design will be a different matter but you should review that tutorial series as it does cover everything you need to know in order to actually make such a system.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D