Page 1 of 1

[SOLVED] Teamwork to Move Objects

Posted: Tue Nov 04, 2008 7:39 pm
by shiftey
I would love a feature that prohibits certain objects from being pickup able unless multiple players are activating it. For example: Player 1 wants to pick up an industrial refrigerator because he has a hunch it is covering the exit to the next section of the map, but it's too heavy for just one player to pickup. So he asks Player 2 for help. Player 1 and Player 2 both +Use the object and move in the same direction to get it out of the way and unveil the exit.

Very simple concept; I hope you understand what I mean. As far as I know there is no way to accomplish this in Hammer.

Posted: Tue Nov 04, 2008 8:37 pm
by Ny
Sounds like a good idea, a great mechanic for slowing player down to depend on others rather than rushing ahead

Posted: Wed Nov 05, 2008 8:17 pm
by DaMaN
Actually, you can do it in Hammer. A couple of ways.

First, you can get the same effect by having two buttons far enough that one player can't press both of them, but that's not really what you're looking for.

What I would do is this:
- Have two physics objects (say, two refrigerators)
- Overlap them in front of the new entrance and nocollide them (logic_collision_pair)
- OnPickUp of refrigerator1, add 1 to a math_counter (call it refrigerator_counter or somesuch)
- OnPickUp of refrigerator2, add 1 to refrigerator_counter
- OnDrop of refrigerator1, subtract 1 to refrigerator_counter
- OnDrop of refrigerator2, subtract 1 to refrigerator_counter
- OnDrop of refrigerator1, teleport back to original place (via a point_teleport)
- OnDrop of refrigerator2, teleport back to original place (via another point_teleport)
- OnHitMax of refrigerator_counter, Kill point_teleporters

Tada!

What happens is: when one refrigerator is picked up and dropped, it will be teleported back, so there's no way through. But when both refrigerators are picked up before dropping the other, neither teleport back, and there's now a way through. :D

Posted: Wed Nov 05, 2008 8:39 pm
by shiftey
That is actually a useful plan for one of my problems, but the one I'm having right now is slightly more complicated than that.

I need a specific object of great weight to be moved from point a to point b. But its too heavy for 1 player to lift. Teleports are not useful for this because I want the object to stay where ever they drop it. If I create 2 physboxes (handles maybe) parented to a prop_dynamic, can each player pick up each physbox or will one of them drop it when the other picks it up? Picture a big box with two handles on each side (each handle being a physbox). If player one picks up one handle, will he drop it when player 2 picks up the other?

Posted: Thu Nov 06, 2008 6:50 pm
by DaMaN
shiftey wrote:That is actually a useful plan for one of my problems, but the one I'm having right now is slightly more complicated than that.

I need a specific object of great weight to be moved from point a to point b. But its too heavy for 1 player to lift. Teleports are not useful for this because I want the object to stay where ever they drop it. If I create 2 physboxes (handles maybe) parented to a prop_dynamic, can each player pick up each physbox or will one of them drop it when the other picks it up? Picture a big box with two handles on each side (each handle being a physbox). If player one picks up one handle, will he drop it when player 2 picks up the other?
Actually, that could work! Make 2 physboxes as handles and 1 physbox as the big rock or w/e.

You'd have two "handles" with the same math_counter inputs, except this time when you get the OnHitMax input, you EnableMotion the big rock. OnPickup the handles adds to the counter, and OnDrop the handles subtracts from the counter, and OnDrop DisablesMotion the big rock. Put some phys_constraints (or even springs) from the handles to the big rock (so that you move the handles = you move the rock) and you've got yourself a pretty sweet puzzle!

Posted: Thu Nov 06, 2008 7:06 pm
by shiftey
Thanks DaMaN. Your a life saver! I think this might work I'll try it out next time I load up hammer. Although I'll need help testing it.

Also: I was just playing oc_harvest and i found it really annoying how when you pick up the bucket of water and run with it, it kind of slows you down and lags into the player collision. Know of any ways to get around this? Maybe have OnPickup turns off collision, OnDrop turns it back on? I'm not sure if thats possible though...

Posted: Fri Nov 07, 2008 1:18 am
by Ny
I'm available for testing if anyone needs help - add chigerian to your friends list

Posted: Thu Nov 13, 2008 5:40 am
by shiftey
Sweet tits! I got it to work!

It was a bit of a pain in the ass, but I think I may have gotten it right. I still need to test with another player before anything is final. But everybody is busy tonight. The way its working right now: once two people grab it, it picks up. If one of them drops it, so does the other. I tried it with a prop_dynamic parented but it was screwy. I'm sure it could work but I don't need it to so frak it.

Posted: Thu Nov 13, 2008 9:47 pm
by shiftey
I tested it with w0f0x and it works. This thread can probably be moved to mapping help since it turns out its possible in hammer.

Posted: Thu Nov 13, 2008 11:18 pm
by DaMaN
Sweet! My idea worked! :D