force-dropping a cube

Avatar
lord_blex
96 Posts
Posted May 29, 2013
Hey, simple question: how do I make the player drop the cube they are carrying?

Also, I had this in an other thread, but it kind of got overlooked:
"The white parts of some overlays become black if I put them on a darker surface. (For example the bullseye, or the "test subject waiting area" text) Is this fixable?"

Advertisement
Registered users don’t see ads! Register now!
Avatar
FelixGriffin
2,680 Posts
Posted May 29, 2013
Replied 32 minutes later
If you know they're carrying it, send the cube the Use input. You can check using a filter_player_held.
Avatar
josepezdj
2,386 Posts
Posted May 30, 2013
Replied 13 hours later
Felix, man, did you study all entities? :eek: Lol, I'm learning a lot just by reading your suggestions! Thanks mate! :thumbup:

So, on the topic, your suggestion would be to surround the cube with a parented trigger brush filtered by that (awesome, btw)filter and to fire the output TestActivator whenever we need the player to drop the cube plus using "OnPass" into the cube's outputs and.......... what then? what output should we fire to the cube? I mean, this far, all we can do is detecting if we player holds the cube or not, but how to make him drop it? If we fire USE output it might do nothing...

Could a basic script do this though? I mean: we can detect the cube coordinates, also the player's coordinates and set the cube's coordinates a bit further from the player's coordinates, right? how about this suggestion?

Avatar
FelixGriffin
2,680 Posts
Posted May 30, 2013
Replied 4 hours later
Thanks! When the Authoring Tools first came out I read everything I could from the VDC's List of Portal 2 Entities.

The easiest way (with a simple script) might be something like this: when the cube needs to be dropped, have the script iterate through all prop_weighted_cubes (not hard) and, for each one, send a TestActivator input to the filter with that cube as the activator (also not hard). Give the filter one output: OnPass !activator Use.

Then when the loop finds that, in fact, the player is holding one of the cubes, the filter will pass and send the Use input to that cube. Since we know that cube is held, Use will drop it.

(If this is for single-player we can also terminate the loop when that happens, although the delay required in the script might cancel out the efficiency gain.)

Avatar
lord_blex
96 Posts
Posted May 31, 2013
Replied 1 day later
Use doesn't really seem to work for me. Unless I wanted the cube to do some beatboxing, in which case it works just fine :biggrin:
http://www.youtube.com/watch?v=aahkJhZZ9GQ
In this video I had a simple trigger with the "cubename Use" output, without any filters and with 0 reset time.
But even when I was careful not to get spam-attacked by the trigger (ie. increased the reset time), the cube didn't do anything. It made a sound, but it remained in my hand. Shouldn't use drop it? Or did I misunderstand something? headscratching
Avatar
josepezdj
2,386 Posts
Posted May 31, 2013
Replied 40 minutes later

lord_blex wrote:
http://www.youtube.com/watch?v=aahkJhZZ9GQ
In this video I had a simple trigger with the "cubename Use" output, without any filters and with 0 reset time.
But even when I was careful not to get spam-attacked by the trigger (ie. increased the reset time), the cube didn't do anything. It made a sound, but it remained in my hand. Shouldn't use drop it? Or did I misunderstand something? headscratching

HAHAHAHAHAHAHAHA... :lol:

Avatar
FelixGriffin
2,680 Posts
Posted May 31, 2013
Replied 15 minutes later
Try +use;-use in the console?
Avatar
lord_blex
96 Posts
Posted May 31, 2013
Replied 59 minutes later

FelixGriffin wrote:
Try +use;-use in the console?

That does work, thanks. But I can't wrap my head around how filter_player_held actually works. I mean I thought using filters was pretty straight forward, but this doesn't have any properties..

EDIT: Okay, I realized this thread has a 2nd and 3rd post; I may be starting to piece it together :razz:
EDIT: Okay, never mind, I still don't get it :biggrin:

Avatar
FelixGriffin
2,680 Posts
Posted May 31, 2013
Replied 56 minutes later
You can use TestActivator to find out if a certain entity is held or not. That might be the simplest usage. Or make a trigger where you want the box to be dropped, with that filter. OnTrigger there's a held box in that area.
Avatar
josepezdj
2,386 Posts
Posted Jun 01, 2013
Replied 6 hours later
Ok, I made a quick test with this filter upon all information gathered here. It's a very basic test to drop the cube down when the player crosses a line.

Note that if you fire the console command +Use, the player will no longer be able to use the USE button again, unless you fire -Use...

Attachments
lord_blex_test.7z
0.08 MB 27 downloads
Avatar
lord_blex
96 Posts
Posted Jun 01, 2013
Replied 4 hours later
Thank you, this testmap made me realize two things.
One, that something is wrong. I straight up copied your vmf into mine and it didn't work at all. The bsp you uploaded works just fine. 0.o
Two, I can't map. A little test map you made looks more interesting than my whole map :biggrin: (Though it might helps a bit that yours has some lighting.)
Avatar
josepezdj
2,386 Posts
Posted Jun 01, 2013
Replied 40 minutes later
Np. It would be really helpful if you could check out what could be happening when it doesn't work out for you... for the sake of this thread and in order to identify possible details that one can missed in the case of trying a similar thinghy...

If you can reproduce the failure in a small map, you could post it here so we can help you out finding the issue :wink:

Avatar
lord_blex
96 Posts
Posted Jun 01, 2013
Replied 31 minutes later
Just found what the problem was, it's actually quite obvious. It worked in singleplayer, but not in multiplayer. I'm guessing it doesn't know who to run the +use on, because technically the !activator is the cube, not the player. Is there a simple solution for this that I'm missing, or do I have to mess around with a secondary trigger for the player? That would be my fourth brush entity in the same place...
Avatar
josepezdj
2,386 Posts
Posted Jun 01, 2013
Replied 28 minutes later
Oh, true, this was your multiplayer map :biggrin: ... Have you tried using the entity point_broadcastclientcommand * instead of the point_clientcommand* to execute the command +Use/-Use?
Avatar
lord_blex
96 Posts
Posted Jun 01, 2013
Replied 7 minutes later
Won't that E all players? That's not quite ideal..
Avatar
FelixGriffin
2,680 Posts
Posted Jun 01, 2013
Replied 5 hours later
It would. Try putting a logic_register_activator in your intro, with two trigger_onces to register the players as 1 and 2. Then fire your Use output through that entity, and the !activator will become whichever player you want.
Avatar
lord_blex
96 Posts
Posted Jun 06, 2013
Replied 5 days later
For this I should actually know which player is holding the cube, shouldn't I? After reading the wiki it seems to me that I have to manually fire either the first or second registered activator. But if I knew who's holding the cube, I wouldn't have a problem in the first place.
Avatar
FelixGriffin
2,680 Posts
Posted Jun 06, 2013
Replied 15 minutes later
Different triggers for red and blue, filter_activator_team or filter_activator_name?
Avatar
lord_blex
96 Posts
Posted Jun 06, 2013
Replied 17 minutes later
Yes, that would work, but the reason I asked how to do this was because I didn't want to cram a fourth brush entity in the same place. But I guess I'll have to.
I actually had a solution with a second trigger for the player that would start disabled and enable every time the cube triggers its own trigger. Then the player's trigger can have the necessary outputs. It didn't seem too elegant, but it could work.
I certainly can't use team filters. I don't know if you remember this thread, but we are still talking about (more or less) the same 4-player map, so I can't be sure about player colors.
Advertisement
Registered users don’t see ads! Register now!
Avatar
FelixGriffin
2,680 Posts
Posted Jun 06, 2013
Replied 4 hours later
You can use the SetModel hack I described in that thread to distinguish them, or just use the script function SetTeam(int). :wink: