Test Power Core Color

Last modified by KDearnley on 2023/07/31 14:06

Power Stations are capable of accepting Power Cores of any color. If you want to activate different logic based on the color of the given Power Core, you can test the player's droppables before and after then compare the two test results.

The reference map Reference: Test for Powercore (VGFJBZBN) has an example of testing for specific colored Power Cores at a Power Station.

Test the Player's Help Power Cores Before and After

On order to test which droppables the player has beforehand, place a trigger in front of the Power Station. Set it to invisible in the properties by unchecking Show on Start.

WhichCoreTriggerNearReceptor.PNG


On entering the trigger volume, use a Droppable Filter to set a Boolean to true if the player has the Red Power Core and false otherwise. You may need to use an input delay on the Set True to make sure it always happens after setting the Boolean to false, or use Multicasting to ensure the correct order of operations.

WhichCoreTestOnEnter.PNG


After giving the Power Core, test the player's current droppables again. Use a second Boolean variable this time.

WhichCoreTestOnGiven.PNG


Then compare the two Booleans using a Gate. The XOR output will only fire if one of the Booleans is true and one is false. The only case in which this should be true is if a player has a Red Power Core when entering the trigger then doesn't have it anymore after placing the core into the Power Station.

WhichCoreCompareTests.PNG



This logic can be duplicated for each desired color of Power Core.



Note: The map author should take precautions to make sure that a player cannot pick up multiple cores of the same color. The player should also not be able to receive a power core after entering the trigger but before giving the Power Core to the Station.

Tags: Patterns