Can someone help me with ending the game once i have a certain number a an item?

i have a game where the main idea is to collect bananas and if someone gets ten bananas the game ends

1 Like

can someone help with that?

make a counter
and make it so when you collect that item (a banana)
it goes up 1 number
make the target of the counter 10
and then make another wire to an end game device that says
when counter reaches 10,end the game

2 Likes

thank u!! :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1:

average should have the solution. Js a little extra thing for the leaderboard. Make the counter track a property and go into map settings so that the score is the property. name the score bananas or number of bananas

hold up but how do i make the counter go up when a banana is collected

how are bananas collected?

Use an inventory item manager, and change the settings so when a player has # items (for example 10 bananas), it triggers. Connect it to a game end and you end the game when you have that amount of items.

just by picking them up

but like do u use zones, buttons, triggers, vending machines…?

im using what average said

sorry bad wording

edit: for picking up bananas

Why don’t you make a mechanism that loops and triggers a checker every 0.5 seconds? The checker should check if you have more than 9 bananas, and if you do, end the game.

2 Likes

I’m not the best at wire repeaters but if you use a lifecycle (game start) connected to a wire repeater with 0.5 second delay (event happens → repeat wire pulse). Then you wire the wire repeater to the checker (pulse repeated → check) and wire the checker back to the wire repeater (check fails → repeat wire pulse). Then connect the checker to an end game device so if check passes then end game. Could you verify this for me ClicClac? And if this works mark ClicClac as solution

why not 0.1 seconds?

That isn’t a loop. What that would do is trigger the checker once. You want to wire a second wire repeater back to the first one.

1 Like

I don’t know, 0.5 was the first small number that came to mind.

2 Likes

thats pretty complicated but i will try it

This seems overly complicated.

1 Like

Ok here goes,

Materials:
Lifecycle 1
Checker 1
wire repeater 1
end game device 1

get a checker:

1 check:

item amount,
equal to,
(your selected item amount)

Now get a lifecycle (game start) and wire it to the checker:
Event occurs —> run check

now get the wire repeater and set it to 0.1 second delay

connect the checker to the wire repeater, and vice versa:

checker, wire repeater: check fails —> send wire pulse
wire repeater, checker: received pulse —> run check

now get end game device, and have the check connect to the end game device:
checker, end game device: check fails —> end game[quote=“chrysostom, post:21, topic:44967, full:true”]
Ok here goes,

Materials:
Lifecycle 1
Checker 1
wire repeater 1
end game device 1

get a checker:

1 check:

item amount,
equal to,
(your selected item amount)

Now get a lifecycle (game start) and wire it to the checker:
Event occurs —> run check

now get the wire repeater and set it to 0.1 second delay

connect the checker to the wire repeater, and vice versa:

checker, wire repeater: check fails —> send wire pulse
wire repeater, checker: received pulse —> run check

now get end game device, and have the check connect to the end game device:
checker, end game device: check fails —> end game

3 Likes