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

Variable damage to your controlinator depending on what hits it..

Archive: 12 posts


Have you ever created a controlinator object that you wanted to take different damage, depending on what hits it, or where its hit at? Example would be a tank that takes hard hits from other tanks, but soft hits from ground sackboys with guns.

Well, I sure do. I looked high and low for this online, and even asked a few other creators on LBP2 online, but couldnt find exactly the answer I was looking for. Finally, I was stumble upon a series of gadgets that did the trick perfectly.

Here's a quick screenshot of the small circuit that works before I go on explaining what it does.

http://i8.lbp.me/img/ft/53845bf69933fdad38a2e04aad408651b58a6c63.jpg

This circuit simply takes a single hit and repeats it a set amount of time. Example, if my tank has a HP of 10 i want a single blast from another tank to deal 5 damage. I would have another one of these circuits that would repeat 2 times that would trigger from a grenade explosive or something dealing 2 damage. Single gun shots would not go through a circuit like this since I only want them to deal 1 damage.

First thing you should notice from the above screenshot is a single input (red wire at top left) and a single output (yellow wire at bottom right). The red wire (will be the color of your sensor, I use red for damage) should be coming from a sensor of some kind. When that sensor is triggered, it will start the circuit loop and it will repeat until its predefined count is met, then it will stop. (Beware, if the sensor's output does not turn off, this counter will reset itself once complete and keep going until the sensor is off).

I wont go into specifics about the ANDs OR and NOT gates, as I'm not entirely sure how it all works (like i said earlier, I stumbled upon a solution here).

However, the top center gadget is a counter. This counter must be set to the number of times you want it to loop through this circuit (how much damage to deal per hit) on BOTH the current and target numbers. Also make sure the output is inverted. Visuals are all up to you to decide.

The bottom center gadget is a timer. Its target time should be set at 0.1 second (0.0 will not work) and its current time should be set at 0.0. The input action start/stop. Do not invert output. And of course, visuals are up to you.

Now, the output of this circuit (yellow wire at bottom right) will be attached to all your HP counters. In order to tie multiple circuits to the HP counters the use of OR gates is needed. Here is a screenshot of my Tron tank, with the HP bar circuitry in its entirety.

http://i7.lbp.me/img/ft/9576b193395cd13273171db36d57a1be17e5e2e6.jpg

Notice on the right side of the screenshot I have 3 looping circuits, the output of the 3 go to another circuit containing a bunch of 3 port OR gates. The OR gates circuit then flows to the HP counters circuit. The rest of the screenshot is irrelevant to this subject (but I plan to make a few more tutorials soon explaining the rest of what I've learned in that screenshot and many others).

I hope this has helped someone, as it could have helped me a few days ago when I searched and pulled my hair out for hours trying to find a solution.

TTFN
2011-02-17 08:48:00

Author:
BillyGalbreath
Posts: 38


What is the fastest respond time?

(less than 0.1 i hope?)

Can it handle multiple hits within the same 0.000x second?
2011-02-17 10:48:00

Author:
Luos_83
Posts: 2136


Super, I can see that being useful. I may have another solution which has some limitations yet may be of use. You can supply a coloured key with a certain signal strength, which will then be transmitted to a key sensor - using that method you could have weak projectiles supply a signal strength of, say, 10%, and strong projectiles supply a strength of 30%. I'm not sure how the receiving logic would interpret this to affect your health, and it has issues such as only being able to be hit by one object at a time, and all damage must be between -100 and 100.

E.g. using impact sensors on objects your 'avatar' will collide with, you can give each object a different strength of signal output when hit.
2011-02-17 12:47:00

Author:
merkaba48
Posts: 79


I'm actually working on accomplishing the same goal. I understand the first part of your post, but what is the purpose of the 3 looping circuits you mentioned in your paragraph after the pic?2011-02-17 16:30:00

Author:
Unknown User


Hmm I should ask clay if he wants to explain his var. dmg system.
at the moment it can keep track of 15 kinds of dmg, and has no problem with multiple hits within the same frame.
Enemies can easily have 4096 hp, and with a little efford are also able to recognize up to 4096 hp dmg from various sources at the same time.
2011-02-17 17:43:00

Author:
Luos_83
Posts: 2136


What is the fastest respond time?

(less than 0.1 i hope?)

Can it handle multiple hits within the same 0.000x second?

I havent found a way to make it faster than 0.1 yet. I tried 0.0 and it never triggered.

As for multiple hits at the same time, I'm afraid this method probably isnt the best for that. I havent test multiple hits at the same time, as my level doesnt exist such a circumstance, but thinking about it i dont think it will react to a 2nd hit until the first damage is finished dealing.


I'm actually working on accomplishing the same goal. I understand the first part of your post, but what is the purpose of the 3 looping circuits you mentioned in your paragraph after the pic?

The 3 circuits are all the same circuit as the first picture, except they all have different counts (2,5,10). If my tank gets shot by another tank, it deals 10 damage. If it gets shot by a projectile shot from a cycle, it deals 5 damage. If it runs into a light trail (yes its a tron level) it deals 2 damage. Each circuit is designed to loop a pre-defined number of times, so for 3 different types of damage, I need 3 different circuits of the first screenshot.
2011-02-17 20:21:00

Author:
BillyGalbreath
Posts: 38


I havent found a way to make it faster than 0.1 yet. I tried 0.0 and it never triggered.

sequencers. (think that can get you up to 0.003)
Again, Ill ask clay to explain when hes online!
2011-02-17 20:26:00

Author:
Luos_83
Posts: 2136


sequencers. (think that can get you up to 0.003)

Hmm. I didnt realize sequencers were so precise. I'll see what I can conjur up later today.
2011-02-17 21:01:00

Author:
BillyGalbreath
Posts: 38


Wow, I had to take a second look at that logic pic, looked almost exactly like my original design for my variable damage system.

Just adopted the sequencer, and so far I'm very impressed at its functionality. Still haven't made the damage sensor perfectly yet, but how would you go about allowing for multiple hits at the same time on a sequencer? The positioning would only allow one location at a time. I'm new to sequencers, so excuse my ignorance.

I'm interested in seeing this system your buddy made.
2011-02-18 00:34:00

Author:
SSTAGG1
Posts: 1136


The 3 circuits are all the same circuit as the first picture, except they all have different counts (2,5,10). If my tank gets shot by another tank, it deals 10 damage. If it gets shot by a projectile shot from a cycle, it deals 5 damage. If it runs into a light trail (yes its a tron level) it deals 2 damage. Each circuit is designed to loop a pre-defined number of times, so for 3 different types of damage, I need 3 different circuits of the first screenshot.

Thanks man. Makes much more sense now.
2011-02-18 02:38:00

Author:
Unknown User


Thanks man. Makes much more sense now.

Here's a better picture (better lighting, and background removed) for clarity of my entire HP Bar logics chip:

http://i0.lbp.me/img/ft/2f0f83645ce20201110f33f7cdb626e8763238f5.jpg

And here it is up close and personal with the sub chips minimized:

http://i3.lbp.me/img/ft/8f3d18a2f3c1ef3f198694222301c5b297fb2064.jpg

I still havent got around to trying out that sequencer yet (too busy trying to promote my beta tron lightcycle level to 50 unique plays so i can get my last LBP2 trophy so i can get platinum trophy - hehe) but i still have that queued up on my todo list. faster response is better!
2011-02-18 03:31:00

Author:
BillyGalbreath
Posts: 38


One way to speed it up is replace the Timer with an 'And' Gate + a 'Not' Gate.
The Output of the 'Not' Gate goes into One of the 'And' Gate Inputs. The Output of the 'Or' Gate goes into the other Input.
The Output of the 'And' gate then loops back into the 'Not' Gate Input and is also the Output of the circuit.
**Tested and Confirmed: 2x Faster than current set-up** (And seems to be Equally as Fast as a Sequencer)


EDIT: I was using this circuit in a level I'm working on and I found out the 'Or' Gate in Your original circuit is not required, simply plug the Counter Output into the Timer Increment. In the simplified Version it is fairly simple to see what is going on. I have an updated version with the 2x speed and 'Or' gate removed.


http://i6.lbp.me/img/ft/5b6bcf02a4e42d8724e2a3231d13895c294d87c9.jpg

How it works:
* Since the Counter is Inverted it is not currently Active therefore the 'Not' Gate on the Left sends a signal into the Left 'And' Gate. When the Trigger is activated, an Signal goes into the other Input of the 'And' Gate (Red Cable).
* This Triggers the Counter to Reset. Since the Counter is Inverted it then sends a Signal to the Left 'Not' Gate, turning off that 'And' Gate, meaning it stops being reset. It also feeds into the Right 'And' Gate, which coupled with the 'Not' Gate is a very rapid Pulser. each time it Pulses it sends a signal to the output (the Damage) and another to the Counter, this means the Counter will rapidly Increase to its maximum again.
* When the counter reaches maximum the Left 'Not' Gate will again be triggered and will send a signal to the 'And' Gate, if the Triggering button has been released the the system is back where we started, if it is still triggered it will continue to loop.

Edit: Looping can be disabled by sticking a Self-Resetting Counter (Max count set to 1) between the Input and the 'And' Gate. This means the button must be released before it will trigger again.

Hope that helped, if you can understand what I was saying. I can write a better description if it helps, but hopefully you can understand why it worked now.

This was still a great way of doing it, much simpler than what I was using before.
2011-02-18 04:15:00

Author:
Unknown User


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.