x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Game Mode Winning Conditions

I'm trying to make a game mode where you need to collect all of the coins in the level to win and the time you took to collect them is recorded.

http://www.torquemod.com/BP_CoinCollector.jpg

I've got a blueprint for the coins set up so you can collect them and the timer counting up at level start. The problem is that I don't know how to go about tracking how many coins are in the level and capturing the time when the last coin is touched to display on the scoreboard.

Anyone able to help out with this?

Product Version: Not Selected
Tags:
more ▼

asked Nov 25 '14 at 09:01 AM in Blueprint Scripting

avatar image

TorQueMoD
1.1k 82 112 143

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You can use "Get all Actors of Class" and choose the Coin Class. This will return an array of all coins. You could check the Length of the Array every tick (or maybe everytime a coin was picked up) and if the Length is 0, the player collected all coins. All of this works providing that you delete the Coin Actor if it gets picked up.

more ▼

answered Nov 25 '14 at 02:50 PM

avatar image

eXi
6.8k 332 184 465

avatar image Shadowriver Nov 25 '14 at 02:51 PM

Or just make coin send info to game mode class when it's collected and gamemode just substracts the number, i think that would be liter

avatar image eXi Nov 25 '14 at 03:04 PM

Yeah, for sure, he could either have an Int Variable set by hand (like 10 coints) and substract everytime he finds a coin, or let the Variable be set by the "Get all Actors of Class" on Begin Play, so he could have different amounts of Coins. (Still letting the Coin Pick Up function reduce the Variable).

Then he would need to check the Int Variable and if this get's 0, the game would be finished.

I guess both ways work. Somehow :D

avatar image TorQueMoD Nov 25 '14 at 04:39 PM

Thanks guys! Actually I'm going to try to get it to work using eXi's suggestion as I want to be able to have a different number of coins with every level as the game's difficulty increases. I'll post back here once I've made some progress.

avatar image TorQueMoD Nov 25 '14 at 05:44 PM

Wow that was a lot easier than I thought it would be! Thanks for pointing me in the right direction guys! Here's what I did: http://torquemod.com/winscreen.jpg alt text

Now I just need to figure out how I can take what the current time is from my timer and print that to the screen along with the "You Win" text. I'm going to look at the Time Attack tutorial Epic posted to see if I can figure this out. https://www.youtube.com/playlist?list=PLZlv_N0_O1gZAjYuGIwtOHigppYa3CVLh When I do I'll create a tutorial on how to do the entire thing.

avatar image themrpalmer May 25 '17 at 08:42 PM

Hi, I've tried to follow this solution but I just don't seem to be able to hook it into my blueprint correctly. I've got a function to count items, destroy them on overlap and display the number in HUD. The game has a timer which ends the game on 00:00 and is again displayed in HUD. What I can't figure out is where to connect the logic that says when all actors of the acorn class have been destroyed end game. I've tried plugging the BP abov into the game mode but the event tick is already driving the timer the event begin play is driving the HUD. I tried plugging it into the Acorn BP before and after the actor is destroyed but it still doesn't work. Any help is much appreciated. Andyalt text

acorn bp.jpg (218.1 kB)
avatar image TorQueMoD May 25 '17 at 09:04 PM

Ok so I'm guessing that your dash dog bp is your player character? Always add a print string to the end of the Cast Failed to make sure it's succeeding but in your case your get all actors of class isn't connected to anything. Just plug the pin from Destroy actor into Get all actors of class and it should work. Also, You want to quit the game when the player wins? That might be a bit harsh but I'm guessing it's just for testing purposes?

avatar image themrpalmer Jun 14 '17 at 02:41 PM

Sorry for delayed response I've been working on other parts and didn't see the update. Your advice worked great thank you. Yes quit game is just for test as win screen and main menu is yet to be built. Thanks again, Andy

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question