How Do I Make Events Trigger By Chance?

2Wings

L1: Registered
Jul 21, 2015
2
0
--------------------------------------------------------------------------------------------------------------------------------------------------------------
=WARNING=
SKIP THIS IF BACKSTORIES GIVE YOU HIVES...


I recently bought a new computer, but while I was waiting for myself to get off my ass and transfer the map I was working on (cp_aperture) over to it, I started making a new map to pass the time (cp_towers). It's simply a placeholder name.

While I was designing the map, I ran into a problem. One of the areas in the map is an underground area, which serves as a means of travelling the entire map unseen, but with a price. Time. I plan to have eight entrances for it, but for them to exist in pairs, two entrances for each direction, each pair containing entrances relatively close to each other. To travel from one pair to another, you must go through the deepest portion of the labyrinth, which contains one singular room.
--------------------------------------------------------------------------------------------------------------------------------------------------------------

This is where the problem is.
Most maps have sawblades...
or trains...
or cliffs...

Mine has a small temple-like structure housing a large health pack that, when picked up, simultaneously heals you for full health, closes all four doors in the structure, activates a visual fire effect, and enables a trigger_hurt entity set to "Ignite".

The thing is, I want the last three to be set on a chance... percentage... type... thing.
You know, one of them Wat'chamacallums...

Basically, I want the trap to only go off twenty-percent of the time...
So, which one of those bullshit map-logic doohickeys do I need to comb through my entire entity list for this time? :D
 
Last edited:

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
logic_case https://developer.valvesoftware.com/wiki/Logic_case

Put in numbers 0 to n in the cases (IE if you want a 50% chance, put 0 and 1, if you want 10% chance put 0 to 9)

Give the logic_case a single OnCase01 output that fires whatever you want to happen.

Use PickRandom to choose a random case.

If you want >50% chance of an event happening, just put more OnCaseN outputs that fire the same event.