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

Choosing an output based on the strongest of two inputs?

Archive: 7 posts


So I'm remaking one of my old projects (it's called Paintballin', you can go check it out if you want) and I'm trying to create an AI that follows the nearest player/other AI and shoots at them until their health bar drains out. I'm stuck on the first part though.
I use a basic direction combiner/splitter combination hooked up to different behaviors that activate if a player or an AI is near. The only problem is that when there is a player and another AI nearby, the splitter doesn't choose either behavior. Does anyone know a solution, or should I just use a selector, since it default to an output?
2014-07-21 21:06:00

Author:
YungDaVinci
Posts: 61


Hi! (Random Comment.. don't ask..)2014-07-21 21:11:00

Author:
Painted--Sound
Posts: 197


Well I can think of one solution (though it might be more fun to experiment with more complexity). Based off of what you said I understand you want the sackbots to follow at a distance. For this I would put a controllinator on the sackbot set to the x on the transmitter/receiver setting. Then I would have tag sensors and player sensors looking left 180 degrees and right 180 degrees (play with the minimum distance.) These hook up to an OR gate (possibly XOR gate if you want the AI to flee if there are too many players in an area. Just ask me in a reply if you want more info on that). Hook that or gate to the controllinator's left/right left analogue input. Now it will follow at a distance.

If the level has jumping points, have tags that are at jumping points with tag sensors pointed to see if the AI should jump to follow. Hook these conditions to the X button.

As for firing with this I'd have to experiment as I'm not that great conceptually at rotation.
2014-07-21 21:41:00

Author:
koltonaugust
Posts: 1382


I'm not sure what exactly you're looking for or Id probably be able to assist you.2014-07-22 05:00:00

Author:
Tynz21
Posts: 544


Oh, I totally read your post wrongly. Um... the selector option alone probably wouldn't work as it would be switching between the two behaviors, but it would at least do something even if it's not actually choosing. The first thing I would try is some tag work of certain conditions and hook it up to said selector. Maybe having each behavior have a minimum time would work. That way each behavior has to occur for say 2 seconds before it checks again for what behavior should be happening. The simplest way to try this would have each condition hooked up to an AND gate and a self-resetting timer to the other input. Then hook the AND gate to the selector.

(to force a choice, you must be VERY specific in your conditions. A way to work it out is either to not have intersecting tag sensor locations or have one option overrule another (generally one sensing more players would overrule one sensing less))
Hope this helps a little? It's not the best explanation or work-a-round but it's my first thought process.

EDIT: WOOPS misread it again. This behavior easily set in a sackbot behavior chip though it's not the best. You must make the player a sackbot though so that it can have a tag (unless it's only one player, then just have the tag follow.) There is an option for the sackbot to follow (i believe you can set a distance as well) a tag. Do that.
2014-07-22 05:19:00

Author:
koltonaugust
Posts: 1382


It's hard to tell what you're doing, but your problem may be in the difference between analogue and digital signals. If you pass the splitter outputs through a sequencer with input positional and a battery on the full range, it will give an output whenever the analogue input is not zero.2014-07-22 14:24:00

Author:
Rogar
Posts: 2284


Nevermind, I found my solution. I used a selector because it prioritizes the lowest selected option. Look at Comph's tutorial on Enemy AI if you need help understanding.2014-07-22 18:46:00

Author:
YungDaVinci
Posts: 61


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.