Jump to content
The Dark Mod Forums

Need help with light switches


grayman

Recommended Posts

I have light switches on a wall that's 8 thick.

 

The player can frob them from the other side of the wall.

 

I tried putting a frob blocker func_static on the opposite side of the wall, but ...

 

-- giving it a frob_distance large enough to block the frob from the wrong side also grabs the frob from the correct side, so the switches don't trigger

 

-- giving it a frob_distance small enough to not catch the frob from the front also doesn't catch the frob from the back

 

Does anyone have a proven method to solve this problem?

Link to comment
Share on other sites

The times I've had such issues I've turned off the frob, only to turn it on when it should be accessible to the player. That may or may not be practical depending how many you have in the space.

"The measure of a man's character is what he would do if he knew he never would be found out."

- Baron Thomas Babington Macauley

Link to comment
Share on other sites

Have you tried tweaking frobbox_size?

 

Yes. I started with 12 and worked it down. It has the same problems: too large and it grabs the frob from both sides, too small, and you can frob the switches from the back.

 

Do you remember where in your map you had this problem? I could look and see what you did.

Link to comment
Share on other sites

Yes. I started with 12 and worked it down. It has the same problems: too large and it grabs the frob from both sides, too small, and you can frob the switches from the back.

 

Do you remember where in your map you had this problem? I could look and see what you did.

 

I think it was the button inside the dressing cabinet upstairs, I had trouble with it being frobable through the doors. It could be that I fixed it with a block of target_setfrobable though, can't go check right now as this computer doesn't have DR installed.

 

Could you make it into a sort of fake button?

 

Have your current button on the wall, but set its frob_distance to 0 (or maybe 1 is the minimum?). Then make another button that is nodraw and non-solid, and make the visible button it's frob_peer. Then you can position the invisible button so that it gives the illusion of pressing the actual visible button, but so that it can't be reached from the other side.

Edited by kyyrma
Link to comment
Share on other sites

Ok my idea dosent work because once the trigger is triggered the switch is then frobable. A trigger than might work is a trigger_touch were it calls a script, said script could dictate only trigger once while the player is touching the trigger and then trigger again once the player un-touches the trigger. That way the switch would only be frobbable when the player is touching the trigger etc.

 

As you a wizzard at sripting I imagine you can figure that part out.

 

triggerswitch.map.txt

Link to comment
Share on other sites

What's complicating the situation is that I have 35 of these switches. That doesn't lend itself to solutions that involve fake switches and scripting and trigger brushes.

 

It prolly would have been better to originally allow frobbing only on things that the player has LOS to, but doing so now would most likely endanger a few things mappers have done in the past 4 years.

 

Unless something simple pops up, I'll prolly leave things as they are.

Link to comment
Share on other sites

I have light switches on a wall that's 8 thick.

 

The player can frob them from the other side of the wall.

 

I tried putting a frob blocker func_static on the opposite side of the wall, but ...

 

-- giving it a frob_distance large enough to block the frob from the wrong side also grabs the frob from the correct side, so the switches don't trigger

 

-- giving it a frob_distance small enough to not catch the frob from the front also doesn't catch the frob from the back

 

Does anyone have a proven method to solve this problem?

 

Well, I tried your original method and got something... barely workable.

 

The key seemed to be in giving the blocking func_static a higher frob_bias combined with a longer frob_distance.

button_frob.map.txt

Edited by kyyrma
Link to comment
Share on other sites

35? Ugh, yeah...

 

Fortunately all those I've done I've just targeted from a door with a set frob response, so little to set up in DR (and I haven't needed to remove frob ability once given). In this case, a trigger turning frob on by the switch, but off would be annoying to place, presumably at each exit. (While reducing frob distance works too, I might totally miss a switch if I had to put my nose to it for it to be frobable.)

 

To ease the assembly, would the visibility stim help?

 

Sadly no, "Event overflow. Possible infinite loop in script." :-( Ah, apparently that's due to a bug with lights.

 

OK, targeting an object and changing it's frob doesn't seem to work well with the visual stim, as it fires even if the trigger object isn't visible and doesn't respond to limiting it's range. :-( Which brings me back to the same trigger recommendation again, which is a pain, but easier than setting up a bunch of stims/responses anyway.

"The measure of a man's character is what he would do if he knew he never would be found out."

- Baron Thomas Babington Macauley

Link to comment
Share on other sites

I'm pretty sure I found a solution.

 

Test map is attached.

 

blockfrob.map.txt

 

Details if you want to read on:

 

Goal: A solution that allows the frob blocker to be chosen when frobbing from behind the wall, and allows the switch to be chosen when frobbing from the switch side of the wall.

 

Frobbing is done by tracing a ray from the player's eye, along the view axis, to see what the player is looking at. If he's looking right at the switch, the switch is chosen. If he's looking off to one side, and the trace hits the wall, the frob code creates a 20x20x20 box at the point of impact, and looks for frobable entities whose "frob boxes" intersect that box. If there are two or more entities inside, the code selects the one that's visually closest to the point of impact. ("Visually closest" is different than "closest in distance".) Putting a frob_bias >1 on an entity makes it seem visually closer than other entities.

 

So we give the switch "frob_bias/2".

 

From the switch side:

 

1 - If looking directly at the switch, the switch is frobbed

2 - If looking off to the side of the switch, the box is created, and both the switch and the frob blocker on the other side of the wall are inside. The frob_bias setting on the switch gives it an advantage over the frob blocker, so the switch is frobbed.

 

From the back of the wall:

 

1 - If you make the frob blocking entity large enough, it catches the trace regardless of where the player is. Since there's a direct hit on a frobable entity, the frob blocker is frobbed (which does nothing).

 

Now, the odd thing is that if you use a "nodraw" texture on the frob blocker, the trace doesn't see it, and the switch is frobable. If you use a "nodraw_solid" texture, the trace sees it, and the blocker is frobbed. The code says that if the trace hits something that's frobable, the trace should see it, but apparently that doesn't work if the thing is non-solid.

 

This doesn't jive with the "nodraw" frob blockers you see on the sides and surfaces of the prefab writing cabinet. I wouldn't expect them to work. But since I've got a solution to my problem, I'll leave that for another day.

 

Since the frob_blocker is now solid to the player, it's best to make it thin. The sample map shows I gave it a thickness of 1 unit, so when the player presses up against the wall, it's not noticeable. And using a nodraw that matches the wall material, I can have consistent results if I fire a broadhead at it.

 

Thanks for the suggestions.

Link to comment
Share on other sites

  • 2 months later...

I just found this while searching for another issue. Seems like the same basic idea you discovered, although it doesn't require any changes to bias:

 

 

 

Just needs a thin panel of caulk entity between the object you don't want frobbed and the player. I forgot to mention, you need to give it frobable 1 to make it frobable and so block frobbing through it.

 

Just tried this and can confirm that it works, at least to keep people from frobbing through a wardrobe wall when the door is open.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...