Questions about random numbers, spawning, and keeping track of a certain number of items and more

Hey guys,

for a project for class, I am making a machine that constantly spawns items one at a time, at which point the player presses one of two buttons that push the item aside or destroys it.

To differentiate the items, I would like to know how to color a prop using entities. Just to give it a red or green tint.

The colors need to be randomized being either red or green, which I imagine isn’t too difficult, and disposed of as soon as they reach a brush based trigger. I’m thinking it would probably be best for there to be 3-4 items visible at all times.

Also, how would I go about making the movement of these items like a conveyor belt? So they stop and start moving every time an item is in the selection range. I don’t really want to rely on a func_push because that would look a bit ugly and awkward looking.

Also, is it possible to adjust the level of light from a source when triggered? So if I wanted a light’s intensity to be reduced by 1/3 on the fly, would that be possible?

Thanks for any help you can give!

So kind of like Tedium? Seems like a cool idea. Hopefully someone can help you out.

  1. You will probably have to make a skin for each colour, then fire the skin via the skin parameter
  2. func_remove will remove any items in it’s boundaries
  3. func_push is your only way of making it work properly. You could do something with func_traintrain entities and paths, but it could end up taking ages and being a little dubious if it works properly. Mate a texture for your convayor, give it an ice surface property, and use func_push to move objects on it.
  4. Math_counter will help keep track of how many objects are spawned of each colour, and stop spawning if the counter maxes our or whatever.
  5. You may have a single dynamic light in a source level. Other that that, the only controls you can have are light on, or light off.

For that one, you could also just use a trigger_multiple and had an output for: OnTriggered > !activator > Color > [R,G,B]. Replacing [R,G,B] with the required RGB values e.g. 255 0 0 would give you a deep red.

I’ve used this method in my cube map for coloring stuff, and although crude, is probably easier.

Are you sure I would need a new skin to change the color of the skins? I could have sworn there was a way to just have some small overlay applied to the model.

Also, by keeping track of how many objects are spawned of each color, do you mean which models have a specific skin configuration?

But thanks for the other tips, I’ll give it a shot. I may ask again later about how exactly to set this machine up, but I think I have an idea of how it would work.

[editline]10th April 2012[/editline]

AH! There we go, I knew there was a way.

I’m not all that worried about how crude it may be, for the purposes of the project it will just be changing the color of the newspaper model to either red or green.

You can assign a point_template to add 1 to the math_counter every time a prop with a certain name is spawned.

You would have a red and a green prop (red_box and green_box), and the counter would track the amount of each.

I have another question; What is the maximum number of lights you can have in a level?

The way I was going to try to get the effect of lights in a house dimming by 1/3 or 1/2 would be to just have two lights in the house and to just turn one of them off for every one that was chosen.

I was going to have 50 houses total however, so I’m not sure how much of a good idea this would be. Also taking into account that there would be a few lights in the control ‘booth’ as well.

You could use an env_projectedtexture and it’d look cooler.

To show the light pools you mean?

I like that idea, as it would definitely save on engine strain I think, but you will also be able to go down to the houses, where some information will also be made available.

Actually, is it possible to make the texture on a prop emit light, like a glow? Because I may just model window frames with an ‘on’ skin and an ‘off’ skin. Although will that also make the frame glow, or just the glass?

[editline]11th April 2012[/editline]

Also, is there a way to change the skin of a static or physics model?
Doesn’t seem like there is a name to refer to it.

I’m trying to change the Ep 2 white monitor’s off skin to the green glowy text ‘on’ skin.

I’ll use a dynamic prop for now, but I would prefer to use the other model.

You need to use prop_dynamic for texture changes.

You could use the soda cans, they have like 3-4 different colors

OK now I have a new question;

I’m trying to get a trigger_multiple to randomly choose between coloring a physics prop red or coloring it green.

What I would have had so far would have been to put both choices in a logic_case so that when the paper goes through the trigger_multiple the logic_case would randomly decide if the trigger colored it:

255 0 0 or
0 255 0

What I hoped to achieve was this:


On Triggered - logic_case -pick random shuffle

OnCase1 - Trigger_multiple- Color - with an override of 255 0 0
OnCase2 - Trigger_multiple- Color - with an override of 0 255 0

But this does not seem possible. Any other way to do this? I have another idea, but it will involve two trigger multiples, one being disabled and then enabled again.

[editline]15th April 2012[/editline]

Nevermind! I solved it!

Small point

OnCase1 - Trigger_multiple- Color - with an override of 255 0 0

That would change the colour of the trigger_multiple, not your target prop.

OK new question:

Is there a way to force a case to happen?

For example, If I have one red item spawn from the red spawner, I want to unlock the red button and lock the green button.

Likewise, if a green item spawns from the green spawner, I want to lock the red and unlock the green.

[editline]15th April 2012[/editline]

Ah, I see. Is there a way to do it with less entities? Right now I have 2 templates and spawners, one for each color.

[editline]16th April 2012[/editline]

Alright, well I ‘figured it out’ again, but I feel like a big goofy jackass, because I just used two different logic_cases with one case in each.

I’m not all that familiar with entities so I would appreciate it if someone could point me in the direction of a better method/entity set so I don’t feel like an idiot with a million logic_cases floating around.

It helps if you think about it logically from start to end.

So…you have a trigger to start an event. That causes a prop of a random colour to spawn.

So, trigger linked to ONE logic_case. Each case is linked to a point_template, each is spawning a named crate (red_crate, green_crate). You can use the onspawned entry in the point_template to change the colour of each crate. Also in the case for the spawn of each item, you can run your locking and unloacking of buttons. You can have multiple entries per case.

All right, I’ll keep that in mind when I look at it again this morning.

On a slightly unrelated note, how do I make my own soundscapes? Or how do I play a single sound that is not looped? For example, I have the voice recordings of someone who was interviewed that I want to be played when the player hits a button.

What is involved in importing your own soundscapes?

use an ambient_generic and check the “is not looped” box.

Alright, thanks I will do this.

OK, I have a question about setting a timed cycle in motion where each start is initiated by the player.

So for example;

The player hits a button. Then like 2 seconds later a light goes on and a few events happen, and then 2 seconds later a similar event happens in another spot, and then after another 2 seconds another thing happens.

The cycle runs ONCE, until the player hits a button. I’m thinking I need logic_timers. Although I have a sneaking suspension this could also just be accomplished via delaying the output.

So that when something happens the receiving entity would have to wait 2 seconds before it could do something with the information.

So, how correct are my thoughts?

Why don’t you just use the question megathread rather than having a personal “assist me” thread?