Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Help!
#1

need help w/ cycling logic

Archive: 3 posts


I'm new to the site, well, as far as posting. Been lurking for a little while. lol Anyways, I have a bit of problem that I can't quite solve. I've looked around the site quite a bit, but either I'm missing what I need to do or just blind.
What I'm trying to do is make a weapon select system. There is 3 weapons, 2 of which you pick up later on in the game. By tapping L1 you cycle through your weapons to use the one you want. I've been trying to get it to work properly for hours, even tried remaking the system from scratch a couple times.
So far I've got a bunch of AND gates w/ tag sensors attached, and the occasional NOT gate tossed in as well, and ends with a selector at the end that turns on the appropriate tag. It checks to see if you have the weapon, then to see which weapon you are using, and then selects the next one. It actually works pretty good, except for one major flaw: It cycles through all of the available weapons way too fast. As soon as the tag kicks on, it'll restart the whole logic chain and continue to go through the weapons as fast it can. I've tried messing around with how it starts the logic (different combination of timers, counters, etc.) but just can't get it too stop cycling. Any help would work wonders...
2011-04-28 06:15:00

Author:
Unknown User


The problem is that because logic circuits are processed "instantly", you've built yourself an endless loop. Let's look at your algorithm more closely, and in more readable formatting:

1. The L1 button is depressed
2. Check to see if you have the next weapon in stock/available
3. Check to see which weapon you currently have selected
4. Select the next weapon by activating the cycle input of the selector that chooses which weapon is currently selected.

So from what I can tell, your problem is most likely that as soon as the weapon is changed (step 4), your logic that moves through steps 2 and 3 is still returning TRUE (from whatever inputs are checking the conditions). Somewhere in there, you need to interrupt the circuit so that a single press of L1 results in a single check and change of weapon.

Because I can't see your microchip, I don't really know how you've wired things and can't tell you what to change. However, I will suggest that maybe you buffer your L1 input with a timer or counter that is reset during step 3 or 4. If the circuit auto-cycles even after you let go of L1, then you need to look elsewhere to interrupt your signal loop.

If you still can't get it to work, let me suggest this:

1. Pass your L1 signal through a self-resetting counter or timer, into a 4-input OR gate, which feeds into the cycle input of your selector.
2. Run each selector output through an AND gate that checks whether you have the weapon (3 gates total), and run each of those outputs into the other inputs of the OR gate.

This way, L1 automatically changes to the next weapon, but if that weapon is unavailable, it keeps cycling until it finds a weapon that IS available. Of course, this only works if you can guarantee that you always have at least one (default) weapon available.
2011-04-28 06:59:00

Author:
Thegide
Posts: 1465


Because I can't really understand what you're saying, but I know your problem, I'm gonna start my suggestion from scratch, but I'm presuming you have a button or button(s) in mind for cycling.

Anyways, you're going to need a selector with 3 inputs, one for each of the weapons. If you haven't already, put a tag for what allows the player(s) to obtain the weapons. Make sure you use you use one tag for each of the unlockable weapons. If the weapon is obtained through a timer, link up the timer to a counter with its target count set to 1 and link the counter to the tag. Basically, find a way to keep it on forever. Just for example purposes, this'll be a red tag.

Go back to your weapon logic, and place an AND gate down. Wire the second output of the selector to the AND gate. Place a tag sensor down( depending on your logic, you may need something other than a tag sensor), and wire this to a NOT gate and the other AND gate input. Wire the AND gate to an OR gate, and wire the OR gate to the first input of the selector. Repeat these steps again with a different tag, I'll use teal as an example, and another AND gate, as well as using the third selector output instead of the second, and wire the AND gate to the other OR gate input.

What happens with this AND gate is that if the second weapon is selected and the red tag to have the weapon is NOT picked up OR when the third weapon is selected and you do NOT have tag to have the weapon, then it'll revert back to the first weapon.
2011-04-28 13:42:00

Author:
BIGGamerer
Posts: 182


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.