Help with logic entities for a puzzle

Any aspects of level design for the Source engine.

Help with logic entities for a puzzle

Postby Naticus on Thu Jul 26, 2012 6:27 pm

I’m looking for some advice on how you would set up a puzzle I am working on in the Portal 2 base. It is really more of a player task than a puzzle, but here are the details...

My map will include battery props, charging units and machines that will use up the battery power. The player will be able to pick up the battery prop and place it on the charging unit. The battery prop skin will have a power bar that indicates levels, i.e. Empty, Quarter power, Half power, Full power.

Once the battery prop is received by the charging unit this will trigger a state change on the battery that will switch the power level skin to indicate that the battery has received power. Ideally I would like this sequence to be timed so that the battery would need to be on the charger a fixed amount of time before the state would change. A logic_timer seems like it would work but I’ve never used it for anything like this.

How would you go about having the image change on the battery and also having the prop receive a value to indicate battery level? Could someone explain how to best set up the logic entities?

Next, I’ll need to have a machine that can receive the battery and will drain the power when the battery is present. Like the charging unit, the machine will need to reduce the power in the battery over fixed time intervals.

Lastly, would instancing help me with something like this? I will be making several types of machine props and charging units that will function the same way but with different models and animations.

Thanks in advance for your help!
Naticus
Been Here A While
Been Here A While
 
Joined: Mon May 22, 2006 4:54 pm

Re: Help with logic entities for a puzzle

Postby Duke Nukem on Fri Jul 27, 2012 8:26 pm

Hi Naticus,

first you have to add a logic_timer, math_counter, logic_case, a prop_physics with multiple skins and a trigger.

Setting up the logic_case:
Name it "case"
Set "Case 01" "0"
Set "Case 02" "1"
Set "Case 03" "2"
Set "Case 04" "3"

Outputs:
Image

Setting up the math_counter:
Name it "counter"
Set "Maximum Legal Value" "5"

Outputs:
Image

Setting up the logic_timer:
Name it "timer"
Set it "Start Disabled" "Yes"
Set "Refire Interval" "0.1"

Outputs:
Image

Setting up for the prop_physics:
Name it "container" (I used a container here).

Setting up the Trigger:
Set "Delay Before Reset" "5"

Outputs: OnPressed "timer" enable

Testing Map: Skinchange.vmf

To create loading sequences in which the battery has to be stay in one place for a specific time, then just use a trigger volume that enables/disables the logic timer when the battery touches the trigger volume. the reached value of the loading sequence will be saved in the math counter ergo the loading process will be saved.

To create the situation that the battery charges the machine, you just have to change the order of the skinchanges with the same values in the outputs of the logic case. To change the loading times, change the refire interval in the logic_timer to a higher value. Here its every 0.1 second. changing it to every 0.2 seconds will let the loading sequence take two times longer.

P.S.Check out the magic shelf in the corner that changes the cans colors, depending in which part of the shelf you put the can in it. Any questions? Pm me.

cu
Enjoy your Kartoffelsuppe!

ModDB Profile
User avatar
Duke Nukem
Pheropod
Pheropod
 
Joined: Thu Aug 28, 2008 7:06 pm

Re: Help with logic entities for a puzzle

Postby Naticus on Sat Jul 28, 2012 4:20 pm

Duke this is exactly what I needed! Thanks for explaining the skin change process and the logic_timer. The map was very easy to understand.

I will play around with it a little bit. I'm curious to see if the skin value can be used with logic_compare entities. For instance, if it is possible to create an output based on the skin that the physics object is currently wearing then that would streamline everything for me! Then I wouldn't need to individually name each physics object.

Once I get a working system in place I will post back here so everyone can see it. Thanks again!
Naticus
Been Here A While
Been Here A While
 
Joined: Mon May 22, 2006 4:54 pm

Re: Help with logic entities for a puzzle

Postby Naticus on Sat Jul 28, 2012 4:51 pm

Now I'm having trouble finding an entity that will look at the value of the skin and then deliver an output based on the skin value. It would need to do the following:

If skin = X then fire output Y

Thoughts?
Naticus
Been Here A While
Been Here A While
 
Joined: Mon May 22, 2006 4:54 pm

Re: Help with logic entities for a puzzle

Postby Duke Nukem on Sun Jul 29, 2012 11:29 pm

Hi Naticus,

the following will take a lot of work:
the logic_case entity has to control different trigger volumes that will be enabled or diasbled, depending on the case that has been triggered by the value of the math_counter.

Lets say if the math_counter has the value "2" an triggers the "case 03" that changes the skin to the value of "2" (for example "battery loaded 20%"), then it also has to enable a trigger volume that triggers a message or a signal which tells the player "battery loaded 20%". For this method you need multiple trigger volumes and a huge input/output network...

It would be much easier if you would just enable a trigger volume which tells the player that the battery is completely full when the last case becomes true. The skins should be easy to understand though so you dont have to add any additional information.
Enjoy your Kartoffelsuppe!

ModDB Profile
User avatar
Duke Nukem
Pheropod
Pheropod
 
Joined: Thu Aug 28, 2008 7:06 pm

Re: Help with logic entities for a puzzle

Postby Naticus on Tue Jul 31, 2012 6:58 pm

Duke Nukem wrote:Hi Naticus,

the following will take a lot of work:
the logic_case entity has to control different trigger volumes that will be enabled or diasbled, depending on the case that has been triggered by the value of the math_counter.

Lets say if the math_counter has the value "2" an triggers the "case 03" that changes the skin to the value of "2" (for example "battery loaded 20%"), then it also has to enable a trigger volume that triggers a message or a signal which tells the player "battery loaded 20%". For this method you need multiple trigger volumes and a huge input/output network...

It would be much easier if you would just enable a trigger volume which tells the player that the battery is completely full when the last case becomes true. The skins should be easy to understand though so you dont have to add any additional information.


I think I may need to go the more complex route and assign one or more logic entities to each battery. The logic entity for each battery will retain the value for power level and skin (which will be the same value). There will be multiple batteries in the level and each will be able to retain a different power level at any given time. So you can partially charge a battery but it will only charge a machine for a length of time determined by the charge level.

If there are any bored coders out there who would like to author a logic entity that can send an output from the skin value of a prop, please help me out! :smt023
Naticus
Been Here A While
Been Here A While
 
Joined: Mon May 22, 2006 4:54 pm

Re: Help with logic entities for a puzzle

Postby Knights on Tue Jul 31, 2012 8:42 pm

hehe seems everyone has just done the work for you on this one :lol: I like puzzles...
Image
Random gallery... Knights_Stuff.
Home page --> http://www.knights.interlopers.net/
User avatar
Knights
May Contain Skills
May Contain Skills
 
Joined: Tue Aug 01, 2006 4:35 pm
Location: In a van down by the river

Return to Hammer Editor Help

Who is online

Users browsing this forum: No registered users