A working Traffic Lights (with 3 env_sprites)

A working Traffic Lights (with 3 env_sprites)

Re: A working Traffic Lights (with 3 env_sprites) Posted by JohnSmith on Sun Jan 9th 2005 at 7:35pm
JohnSmith
3 posts
Posted 2005-01-09 7:35pm
3 posts 0 snarkmarks Registered: Jan 9th 2005
Hi!

I'm trying to make a working "traffic lights", but i'm having some troubles..

I have 3 env_sprites named: Green, Orange, and Red. They show/hide Sprites via the Outputs/Inputs thingy..

My question is about the: My ouptut named ..what should i do with this? (the default choices are OnUser1 (2/3/or 4) but i dunno what does it means and what does it do)...I've checked the SDK doc, but it didn't helped.

And also, how i make start working the traffic lights? Must it be triggered by something (like a trigger_once) or can it starts from its own?

Thanks by advance if you can help me.
Re: A working Traffic Lights (with 3 env_sprites) Posted by Myrk- on Sun Jan 9th 2005 at 7:40pm
Myrk-
2299 posts
Posted 2005-01-09 7:40pm
Myrk-
member
2299 posts 604 snarkmarks Registered: Feb 12th 2002 Occupation: CAD & Graphics Technician Location: Plymouth, UK
Think you'll find thats amber, not orange :razz:
Re: A working Traffic Lights (with 3 env_sprites) Posted by Leperous on Sun Jan 9th 2005 at 7:51pm
Leperous
3382 posts
Posted 2005-01-09 7:51pm
Leperous
Creator of SnarkPit!
member
3382 posts 1635 snarkmarks Registered: Aug 21st 2001 Occupation: Lazy student Location: UK
A logic_auto will trigger things automatically with the OnMapSpawn output. And sprites don't have any outputs really, you will want a logic_relay or other entity to trigger them instead.
Re: A working Traffic Lights (with 3 env_sprites) Posted by JohnSmith on Sun Jan 9th 2005 at 9:00pm
JohnSmith
3 posts
Posted 2005-01-09 9:00pm
3 posts 0 snarkmarks Registered: Jan 9th 2005
Yea...but isn't the logic_relay a kind of Multi_Manager?

Cause i've read somewhere that the Multi_manager is now obsolete because of the Outputs/inputs thingy..And so it now limits the entities in a map..(good for server performance)

So isn't it an "oldshool" method? :confused:

And is there absolutely no way to make it working with only 3 env_sprites and 1 Logic_auto ?

I dont know, because i still absolutely dont understand the field: My ouptut named..

If someone can explain me what does it do, or if it exists a good tutorial about this, let me know :smile:

PS for Myrk: In France, it's orange :biggrin:
Re: A working Traffic Lights (with 3 env_sprites) Posted by Rof on Sun Jan 9th 2005 at 9:43pm
Rof
210 posts
Posted 2005-01-09 9:43pm
Rof
member
210 posts 41 snarkmarks Registered: Dec 3rd 2004
Logic_relays aren't obsolete. They aren't any type of multi_manager,
it's just that with the new entity I/O system, you can use logic_relays
to replace multi_managers.

No, I don't think there's a way to make it work properly with just 3
env_sprites and the logic_auto. You need some way to time the state
changes of the sprites. I'd use a logic_timer, though I'm sure there
are other ways to do it.

Now for what "my output named" means. Almost all entities now have a
variety of inputs and outputs. The inputs are like little commands
other entities can send to that entity. For example if you look at
env_sprite, it has inputs:

Kill - destroys the entity

Alpha - sets the sprite's alpha value

Color - sets the sprite's color (RGB)

HideSprite - hides the sprite

ShowSprite - shows the sprite

ToggleSprite - toggles between hiding and showing the sprite

(there are some other inputs, too, that I'm skipping.)

Now for outputs. Outputs are events that happen to the entity. When the
event happens, they fire. As it happens, env_sprite doesn't have any
outputs (except the OnUserX ones, which are rarely needed and not
useful for what you want to do). So lets look at the outputs of the
func_button entity:

OnDamage: fires when the button is damaged

OnPressed fires when the button is pressed

OnIn: fires when the button reaches the fully-in position

OnOut: fires when the button reaches the fully-out position

So for instance, if you want to have a button that turns on a sprite, on the func_button's output tab you'd set:

My Output Named: OnPressed

Target Entities Named: <the name of the env_sprite>

Via This Input: ShowSprite

Delay: 0

So now, when you press the func_button, the output (OnPressed)
sends a command to the env_sprite to show itself (ShowSprite), and does
it immediately (Delay 0)

Now you could add another output to the func_button:

Output Named: OnPressed

Target: <the env_sprite>

Input: HideSprite

Delay: 5

This will wait 5 seconds (Delay 5) and then send a HideSprite command
to the env_sprite, when the button is pressed. So together with the
first output, pressing the button will turn on the sprite, and after 5
seconds turn it off again.

You can add many outputs one entity, so if you had several sprites
(with different names) you could easily make pressing the button turn
off some of them, and turn on others.
Re: A working Traffic Lights (with 3 env_sprites) Posted by Nanodeath on Sun Jan 9th 2005 at 11:04pm
Nanodeath
356 posts
Posted 2005-01-09 11:04pm
356 posts 66 snarkmarks Registered: Nov 11th 2004 Occupation: Student - Bioengineering Location: Seattle, WA, USA
No, I don't think there's a way to make it work properly with just 3
env_sprites and the logic_auto.
Actually, I believe you can. This would be the perfect case for
using the User1 inputs/outputs. Okay, so all the sprites start
out off, right? You have the logic_auto fire the OnUser1 of, say,
the red sprite. Now, this sprite has outputs something like the
following:

Show red sprite 0.0

Hide red sprite 10.0

Show green sprite 10.0

Hide green sprite 20.0

Show orange sprite 20.0

Hide orange sprite 25.0

Fire OnUser1 of red sprite 25.0

And...that would do it, I think.

EDIT: alternatively, if you want it a little more "decentralized" than that, you could do it as follows:

Logic_auto fires OnUser1 of the red sprite

OnUser1, the red sprite turns itself on for 10 seconds, then turns itself off and executes the OnUser1 of the green sprite.

On the OnUser1 of the green sprite, it turns itself on for 10 seconds,
then turns itself off and executes the OnUser1 of the orange sprite.

On the OnUser1 of the orange sprite, it turns itself on for 5 seconds,
then turns itself off and executes the OnUser1 of the red sprite, and
the cycle continues.

Either way would work...
Re: A working Traffic Lights (with 3 env_sprites) Posted by JohnSmith on Tue Jan 11th 2005 at 3:21pm
JohnSmith
3 posts
Posted 2005-01-11 3:21pm
3 posts 0 snarkmarks Registered: Jan 9th 2005
Thanks for the explanation guys :smile:

Gonna try later.
Re: A working Traffic Lights (with 3 env_sprites) Posted by brett5010 on Tue Jan 11th 2005 at 6:26pm
brett5010
80 posts
Posted 2005-01-11 6:26pm
80 posts 18 snarkmarks Registered: Jan 6th 2005 Occupation: Student Location: Australia
If you manage to get a working traffic light, can you show me exactly
how it works? Our competition site is working on a map and we've been
trying to get traffic lights working for weeks...