Inputs and Outputs/pl

From Valve Developer Community
Jump to: navigation, search
Info content.png
This page needs to be translated.

Ta strona albo zawiera informacje, które są tylko częściowo lub niepoprawnie przetłumaczone, albo nie ma jeszcze tłumaczenia.
Jeśli ta strona z jakiegoś powodu nie może zostać przetłumaczona lub pozostaje nieprzetłumaczona przez dłuższy czas po umieszczeniu tego ogłoszenia, należy poprosić o jej usunięcie.

Upewnij się również, że artykuł stara się być zgodny z przewodnikiem po językach alternatywnych.

Wejścia i Wyjścia (razem "I/O") to opcje za pomocą których byty komunikują się między sobą na mapach. Byty mają dwa rodzaje komunikacji: wysyłanie "wyjścia" do innego bytu, lub odbieranie "wejścia" od innego bytu. Jeden byt może wysłać wyjście kiedy zostaje zabity do wejścia innego bytu co spowoduje zmiane koloru. To samo wyjście może też zostać użyte do wywołania wejścia spawnującego, innego bytu. Wyjścia są dopasowane do wyjść przez "połączenie", które kontroluje jakie dodatkowe dane są przekazywane do osbiorcy, jakie ma by opóźnienie przed otrzymaniem wyjścia , i czy wyjście ma być wysłane ponownie później. Wyjście może być połączone z każdym wejściem i odwrotnie. To pozwala na złożone i skuteczne interakcje między bytami.

Spójrzmy na byt logic_timer. Może zostać skonfigurowany żeby "odpalić" wyjście OnTimer kiedy osiągnie limit czasu, co uruchomi wejście ShowSprite obiektu env_sprite. Kiedy czasomierz osiągnie limit czasowy, pojawi się "sprite". Używając właściwości połączeń, możesz spowodować, że wyjście będzie aktywowane z opóźnieniem dwóch sekund, lub będzie aktywowane tylko raz.

Wejścia

Wejścia to komendy powodujące zmianę tego co robi byt. Są aktywowane przez wyjścia - nie mogą być manipulowane zdalnie.

Możesz zobaczyć listę wydarzeń wejść, które osbiera byt w zakładce "Inputs" okna właściwości obiektu. Naciskając przycisk "mark" zostaniesz przeniesiony do bytu z którego odbierane jest wejście.

Wyjścia

Okno "Object Properties" w VHE

Wyjścia to wydarzenia, które uruchamiają się kiedy stan bytu się zmienia. Na przykład, czasomierz będzie miał ustawione wyjście na osiągnięcia końca odliczania, przycisk na bycie wciśniętym, a drzwi na zbliżanie się do zamknięcia.

Wydarzenia wyjść są tworzone w zakładce "Outputs" okna właściwości obiektu. Ten interfejs pokazuje listę wyjść emitowanych z bytu, pola konfiguracji dla zaznaczonych wyjść, i przyciśki do tworzenia nowych lub usuwania starych. Finalnie, przycisk "mark" na dole, z lewej zabierze cię do docelowego bytu zaznaczonego wyjścia. Pola konfiguracji wyjść:

Nazwa wyjścia
Jakie wydarzenie powoduje odpalenie wyjścia. Na przykład, byt trigger_multiple może odpalić wyjście OnTrigger kiedy gracz wejdzie w to.
Byt docelowy
targetname lub classname bytu który otrzyma wejście. Akceptuje znak * jako niewiadoma.
  • Pogrubiona nazwa oznacza, że targetname wskazuje wiele bytów
  • Czerwona nazwa oznacza, że targetname nie wskazuje niczego
    Icon-Bug.pngBłąd:Poprawna wartość zmiennej i classname, oraz special targetnames też wyświetlą się na czerwono. Nie martw się: silnik je rozpozna!
Nazwa wejścia
Wejście w docelowym bycie, które będzie aktywowane. To też będzie kontekstowe. Na przykład, jeśli zostanie wysłane wyjście do obiektu "drzwi", niektóre z dostępnych wejść to będzie "Close" lub "Open".
Parametry
Za pomocą parametrów możesz przesłaś dane do obiekty docelowego. Parametr może być wszystkom: jak głośno zagrać dźwięk, targetname innego bytu, lub może kolor. Wszystko zależy od tego co akceptuje wejście. Jeśli nie akceptuje nic, pole zostanie wyszarzone.
Niektóre wyjścia, jak OutValue obiektu math_counter , generują parametru samemu. Żeby użyć generowanych parametrów, po prostu zostaw pole czytające <none>.
Note.pngUwaga:Jeśli wartość wyjścia to targetname, pamiętaj, że może nie być unikatowy!
Czas opóźnienia
Czas oczekiwania przed odpaleniem po, którym występuje wydarzenie wyjścia.
Odpalenie tylko raz
Wyjście zosanie usunięte po odpaleniu jeśli to jest zaznaczone.

Setting up a simple trigger

This is an example of how to make a simple trigger using inputs and outputs, so a sound is played when the player enters a specific area.

Open up a map and add an ambient_generic (in the Name field, type in "ambient_1"). Go into its Object Properties and choose a sound file for it to play, and on the Flags tab make it set to "Start Silent". Select the "tools/toolstrigger" texture and create a cube brush with this texture. Right-click on this brush and using the "Tie to Entity" command, make it into a trigger_once entity. Go to the Outputs tab and click the Add... button.

Set "My output named" to "OnStartTouch". This causes the output (and thus the trigger) to occur when the player starts touching this brush in the game.

Set "Targets entities named" to "ambient_1" using the pull-down arrow. This makes the trigger output target the ambient_generic you placed earlier.

Set "Via this input" to "PlaySound". This chooses the PlaySound action from the target ambient_generic's list of actions, which of course causes its sound to start playing.

Click the Apply button to save your changes to the trigger, and close it. Now we have the trigger set up so that as soon as the player touches it, it sends a command to the ambient_generic which makes it start playing its sound.

If you open up the properties for the ambient_generic, you can see how the Output from the trigger has automatically been converted to an Input for the ambient_generic.

If you want to compile and test your new trigger, make sure you have all the basics (player start, lighting, etc) and have assigned a sound effect to the ambient_generic.

Debugging

Source provides various debugging tools for when an I/O chain is not working as expected.

Foremost among them is the object properties dialog itself. Invalid inputs outputs are highlighted red in the entity's input or output list; the I/O icons at the bottom of the dialoge also change accordingly. Invalid outputs also show up in Check For Problems (Alt+P). It's a good idea check for problems before every compile.

Icon-Bug.pngBłąd:Valid classname and wildcard values will be flagged as errors. Don't worry: the engine will recognise them!

Away from Hammer, there are a number of console commands and variables that will help you spot errors while your map is running:

developer <0-2>
Developer mode reports all entity I/O to the console, and unless you're playing on a dedicated server that enables cheats (which is needed for all of the commands below). If you are in developer 2, you will also get the last eight lines of the console displayed at the top of your screen.
ent_messages_draw <bool>
This displays the same information as developer mode, except that instead of appearing in the console it's drawn in the 3D world at the location of the entities in question.
ent_fire <targetname or classname> <input> <parameter>
This extremely useful command allows you to manually fire inputs on any entity at any time. If you want to unlock a door ahead of time, you would type ent_fire my_door unlock, followed if you're feeling lazy by ent_fire my_door open.
Like the "output target" field in Hammer, ent_fire supports classnames and wildcards. If you want to ent_fire npc_* ignite, you can!
Tip.pngTip:ent_fire is where the special !picker targetname comes in. Use it to target whatever is under your crosshair.
ent_pause
This command pauses all entities in the map except the player; submit it again to unpause. It is designed for use with ent_step.
ent_step <number of steps>
When used with ent_pause, this command makes entities perform a specified number of I/O steps before pausing again (default is 1).

See also