Re: A working Traffic Lights (with 3 env_sprites)
Posted by JohnSmith on
Sun Jan 9th 2005 at 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-
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
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 Rof on
Sun Jan 9th 2005 at 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 JohnSmith on
Tue Jan 11th 2005 at 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
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...