Welcome, Guest. Please login or register.

Author Topic: TUTORIAL:Ways to let a trigger work for one player  (Read 7822 times)

Offline Helix

  • Sr. Member
  • ****
  • Posts: 842
  • ASOT 600!!!
    • View Profile
TUTORIAL:Ways to let a trigger work for one player
« on: January 21, 2010, 04:38:49 PM »
INDIVIDUAL TRIGGERING. THE "!" OUTPUT AND "TARGETNAME" OUTPUT!
If I made a mistake somewhere or if you think something could be improved, tell me, I have the feeling I forgot something.

So, this is a tutorial for entity workers. Sometimes it is usefull to let only one player get affected by several triggers. This is a very powerfull function in Hammer, you can do things beyond imagination!

There are several ways to let this happen. But all of them have differences. Right now I will only discuss 2 ways. Maybe I can add more later.

Individual triggering: !

! likes you. ! is very usefull. What is ''!'' ?
Well it is hard to describe the absolute correct way, but to say it very simple: "!" is a command towards several entities who are involved with the entity that fires it.

Hehe, yeah don't worry I will give you an example.
Every time you wish to use this, you will let something change in an entity that is involved.

!activator
!activator says it all, pretty much. !activator means that you will let something happen with the individual person that triggers the trigger that will fire the !activator command
So, let's say the players that triggers a trigger_multiple will be set on fire. Only that person, and nobody else unless someone else also hits that trigger. (That means it is still individual)

Recipe:
1 trigger_multiple

Preparation:
trigger_multiple outputs:
-!activator (IS SOMETIMES DISPLAYED IN RED, WORRY NOT! IT WILL WORK. JUST MAKE SURE THE OUTPUT IS 100% CORRECT AND IT WILL WORK)
-Ignite

That's it. Now the person that hits the trigger will be set on fire. It's fun isn't it?

!self
!self means that the entity that fires the !self command will be affected by that same command. It is pretty useless in my opinion because you can either use !self or you can use the targetname of the entity.
about the !self command, it is actually really usefull, in the right situation

say for example, you had 4 entities with all the same target_name and you could not under any circumstances change their target_name, then what you could do is from another entity fire the user1 input, then have an output on each entity,
Onuser1 - !self - do shit
this way, even tho the 4 entitys have the same target name, they could in theory, do different things
So:

Recipe:
1 func_button

Preperation:
func_button outputs:
-!self
-Kill

But it would be the same as:

func_botton outputs:
-func_button
-Kill

That is what I mean.
You can try to experiment with it yourself, as long as you understand what it does. Hopefully you will do that now.

Individual triggering: "targetname"

This is what I personally LOVE. It is so extremely powerfull and usefull. But hang on, please do not try to understand this if you are not an advanced mapper.

What can it do?
Let one individual player get affected by all kinds of stuff, as long as that stuff has a filter.

I am going to give one raw example;

Goal:
When a player hits a trigger_multiple, a trigger_push somewhere else in the map will only affect this player. (same thing as with the "!" trigger. Anyone who ALSO hits this trigger will be affected ALSO, but this time the "!" is required, you will see.)


Recipe:
1 trigger_multiple
1 filter_activator_name
1 trigger_push

Preparation:
filter_activator_name settings:
targetname: <your choice>, will be filter_activator_name in this tut.
filtermode: Allow entities that match criteria (depending on the situation, you might want to allow or disallow, in this case we will allow because we want the player to ALLOW something when it hits the trigger_multiple).
filtername: <your choice>, will be X in this tut.

trigger_push settings:
filtername: filter_activator_name
All the other settings can be adjusted to your own needs.

trigger_multiple outputs:
-!activator
-AddOutput
-targetname X                    [[]]

And there you go. You've just set a player's entity targetname to X. As long as any entity that can have a filter has the filter_activator_name added, this entity will only affect players with entity targetname X. Simple, huh?

It can be used for far more things than this. For example if you have 5 doors and a player has to go through all 5 in a particular order so he can get teleported or something, then:

a player with name X5 can be teleported

door 1 gives the player the name X1
door 2 gives the player the name X2
door 3 gives the player the name X3
door 4 gives the player the name X4
door 5 gives the player the name X5

Get it?

I hope this will open some new doors for you with entity work. It's really fun to make and you can do countless more things with it!
Enjoy.

[[]]: THE FOLLOWING IS IMPORTANT!
Everytime you give a player a targetname then YOU MUST set its targetname to blanco if it is not needed anymore or else you have a shitload of complications.
At a certain point where you know the targetname is not needed anymore, create a trigger_multiple with the same settings as the one that gives a player a targetname, but instead of X you must type: targetname<space><space> (targetname  )
THE TWO SPACES ARE A MUST!
The first space is to seperate the targetname from the name and the second space indicates that the targetname is empty, so it will be set to default.
ALWAYS DO THIS! ALSO DO THIS AT THE SPAWNS BECAUSE IF SOMEONE HAS A TARGETNAME AND THE ROUND ENDS, HE WILL HAVE IT NEXT ROUND ALSO (OR THE PERSON THAT HAS THIS SPAWNPOINT) SO MAKE THAT SAME TRIGGER_MULTIPLE WITH "TARGETNAME  " AT EVERY SPAWN.


Sorry for the big yell but it is very very very important. Or else you will have so many gameplay glitches
« Last Edit: January 21, 2010, 08:27:51 PM by Helix »

Offline Exither.

  • Modders
  • Full Member
  • *
  • Posts: 385
    • View Profile
Re: TUTORIAL:Ways to let a trigger work for one player
« Reply #1 on: January 21, 2010, 06:28:39 PM »
great tutorial  \

but do you think its a problem if I give everyone at spawn the targetname "someone" instead of ""nothing"" ^^

I used this at my two maps and I havent got any problems yet.


Offline svbg869

  • SolidSurf Elite
  • Sr. Member
  • ******
  • Posts: 974
  • [insert witty comment hear]
    • View Profile
Re: TUTORIAL:Ways to let a trigger work for one player
« Reply #2 on: January 21, 2010, 07:15:54 PM »
about the !self command, it is actually really usefull, in the right situation

say for example, you had 4 entities with all the same target_name and you could not under any circumstances change their target_name, then what you could do is from another entity fire the user1 input, then have an output on each entity,
Onuser1 - !self - do shit
this way, even tho the 4 entitys have the same target name, they could in theory, do different things

Offline Helix

  • Sr. Member
  • ****
  • Posts: 842
  • ASOT 600!!!
    • View Profile
Re: TUTORIAL:Ways to let a trigger work for one player
« Reply #3 on: January 21, 2010, 08:27:10 PM »

but do you think its a problem if I give everyone at spawn the targetname "someone" instead of ""nothing"" ^^

I used this at my two maps and I havent got any problems yet.

Of course, you just change the name. But since a space would mean default it is much easier to remember, depending on what you like mostly.

about the !self command, it is actually really usefull, in the right situation

say for example, you had 4 entities with all the same target_name and you could not under any circumstances change their target_name, then what you could do is from another entity fire the user1 input, then have an output on each entity,
Onuser1 - !self - do shit
this way, even tho the 4 entitys have the same target name, they could in theory, do different things

Ah haven't seen it that way, thanks.
« Last Edit: January 21, 2010, 10:27:43 PM by Helix »

Offline unt0uch4bl3

  • Full Member
  • ***
  • Posts: 357
    • View Profile
Re: TUTORIAL:Ways to let a trigger work for one player
« Reply #4 on: January 29, 2010, 10:30:43 PM »
This is very useful and will help tons of people! Good job on making this tutorial.

A little more organization of the tutorial can help though, it was a little hard to follow (because you were telling a story more than teaching).

---------------------------------
Btw.
Quote
ALWAYS DO THIS! ALSO DO THIS AT THE SPAWNS BECAUSE IF SOMEONE HAS A TARGETNAME AND THE ROUND ENDS, HE WILL HAVE IT NEXT ROUND ALSO (OR THE PERSON THAT HAS THIS SPAWNPOINT) SO MAKE THAT SAME TRIGGER_MULTIPLE WITH "TARGETNAME  " AT EVERY SPAWN.

Making a trigger at spawn that resets a targetname is a burden in most situations you will encounter, unless you specifically design your gameplay in a certain way in which people would need to get their targetnames reset if they are brought back to the respawn area. (Which shouldn't be done by some random trigger multiple hanging around at spawn any way).

Basically this is what I suggest you do.

Create a logic_auto, OnMapSpawn -> player -> addoutput -> targetname (space)

It will reset the targetname for absolutely everyone, Alive, dead, in spec... bots?..

First of all it is a cleaner way of doing things as you can obviously tell because you don't need extra triggers. Second, if someone disconnects, they will lose their targetname so you won't have to worry about people that connect. And third people won't lose their targetname if they are teleported to the spawn... lets say by an admin (unless you want them to lose it because your map is structured in a certain way). Either way, you will be absolutely 100% sure that a player will retain a given targetname for the duration of the round and will not lose it unless the client disconnects.'

Your 5 doors example is the mechanism used for the space level on delusion, as I'm sure you probably know but I'm stating it in case others may have wondered how to do it.

nopictoaccompanybigblockoftxt

Offline Jesuswashomeless

  • Sr. Member
  • ****
  • Posts: 407
  • Just do it.
    • View Profile
Re: TUTORIAL:Ways to let a trigger work for one player
« Reply #5 on: March 06, 2010, 06:40:00 PM »
All i want to know is if I can give a single player +left...
mwahaha
hahahahaHA
AHAHAHAAAAAAAAAaaaaaa!!!...




Please respond


I <3 KIM JONG IL

Offline S.T.A.L.K.E.R.

  • The Sexiest Man "Alive"
  • SolidSurf Elite
  • Elder Statesman
    of the Surf
  • ******
  • Posts: 2,830
  • daddy is home :^)
    • View Profile
Re: TUTORIAL:Ways to let a trigger work for one player
« Reply #6 on: March 06, 2010, 06:49:20 PM »
All i want to know is if I can give a single player +left...
mwahaha
hahahahaHA
AHAHAHAAAAAAAAAaaaaaa!!!...




Please respond
Yeah, but they can turn it off lol.

Offline Helix

  • Sr. Member
  • ****
  • Posts: 842
  • ASOT 600!!!
    • View Profile
Re: TUTORIAL:Ways to let a trigger work for one player
« Reply #7 on: March 06, 2010, 06:54:15 PM »
Yeah, but they can turn it off lol.
what he said

Offline Jesuswashomeless

  • Sr. Member
  • ****
  • Posts: 407
  • Just do it.
    • View Profile
Re: TUTORIAL:Ways to let a trigger work for one player
« Reply #8 on: March 06, 2010, 10:50:25 PM »
But... I can always make the trigger repeat itself every second!

\
« Last Edit: March 06, 2010, 11:05:33 PM by Jesuswashomeless »


I <3 KIM JONG IL

Offline PimpJuice

  • Full Member
  • ***
  • Posts: 112
  • i am cheeseburgr
    • View Profile
Re: TUTORIAL:Ways to let a trigger work for one player
« Reply #9 on: March 08, 2010, 03:51:49 PM »
Not that it has anything to do with this topic but
I noticed that sv_accelerate -10 and sv_airaccelerate -1 makes people move backwards
I tried sv_airaccelerate -150 but it fucks it up so you start flying and shit
Maybe if someone could figure it out they could make a map about it :p
How to type here!?

Offline Knife

  • Jerker
  • Elder Statesman
    of the Surf
  • *****
  • Posts: 1,511
  • Stay Classy.
    • View Profile
Re: TUTORIAL:Ways to let a trigger work for one player
« Reply #10 on: March 08, 2010, 06:03:54 PM »
Not that it has anything to do with this topic but
I noticed that sv_accelerate -10 and sv_airaccelerate -1 makes people move backwards
I tried sv_airaccelerate -150 but it fucks it up so you start flying and shit
Maybe if someone could figure it out they could make a map about it :p
Wow you're late to that party...
Why so Ryan?

Offline NamedPlayer

  • Newbie
  • *
  • Posts: 35
  • http://i.imgur.com/BvAuO.jpg
    • View Profile
    • iSpawnedThere
Re: TUTORIAL:Ways to let a trigger work for one player
« Reply #11 on: January 10, 2014, 03:03:41 PM »
Very well made tutorial \ if i may ask, how would i use this activator to set a brush nonsolid to only 1 player? Also is it possible to show certain textures to players with a set targetname and not show it to players without the targetnames?