Home   Help Search Login Register  

Author Topic: How do you get the name of the player that activated a trigger?  (Read 2441 times)

0 Members and 1 Guest are viewing this topic.

Offline jphilapy

  • Members
  • *
  • I'm a llama!
I want to simulate a player making a radio call via sidechat when he enters into a trigger. Say the players name is "jphilapy" then when he enters into the trigger the sidechat will show something similar to Jphilapy: "need a chopper pickup."

Essentially this needs to be able to get the name of whatever player enters into the trigger since this is a multiplayer mission.

Thanks,
Jeff

Offline XCess

  • Former Staff
  • ****
try:

((list triggerName) select 0)

toget the unit that triggered it. Not 100% sure whether it will work as it will get a list of anyone in the trigger, but I'm hoping that the list will start from first to enter thru last. But I'm dreading that won't be the case.

Worth a try though ;)
« Last Edit: 25 Jan 2006, 11:51:47 by XCess »

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
You need one trigger:
Condition: ("Man" counttype thislist) > 0
Activation: speaker = thislist select 0; speaker sideChat format ["%1: I need a chopper", name speaker]

This is what happens:
*The trigger reacts when any man class unit enters the trigger area (it will not react to cars or air units; if you want to include cars you change "Man" to "Land").
*The unit who made the trigger "fire" is thislist select 0. The first line of the activation field labels him speaker.
*The format command checks the name used by the player who is labeled speaker and adds it to the text displayed by the sideChat.

Syntax from memory, but technique is tested and working in MP without publicVariable.
« Last Edit: 25 Jan 2006, 14:51:13 by nominesine »
OFPEC | Intel Depot
RETARDED Ooops... Retired!

ROBINO

  • Guest
would this also work for radio triggers nominesine ?

what i want to do is have a radio trigger activate a script in the normal way - but for this to happen ONLY on the client/player which activates the radio trigger.

so would this work ?

Code: [Select]
radio alpha
repeatedly
condition:  this
activation: activator = thislist select 0; [activator] exec "radioscript.sqs"

then inside radioscript.sqs the top line will be:

Code: [Select]
?!(player == activator): exit

hence the script has the ability to sort-out the caller from the non-callers
« Last Edit: 26 Jan 2006, 22:15:13 by ROBINO »

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
would this also work for radio triggers nominesine ?

I've never tried it, but my guess is: Yes it works.

I can't see any reason why a radiotrigger would be different.

EDIT: I would change the line inside the radioscript.sqs to
Code: [Select]
? player != activator: exit
I'm not sure if your quoted syntax will work.
« Last Edit: 27 Jan 2006, 12:12:13 by nominesine »
OFPEC | Intel Depot
RETARDED Ooops... Retired!

ROBINO

  • Guest
has anyone tried this yet ?

my access to a dedicated server is still not satisfactory....

MANVIN

  • Guest
The List of a Radio trigger is empty when activated, so I basicly assume that this method does not work.

I have an old method using two triggers, a Delay, and a two Public Variables that can tell you who activated it.

On a side note, the application I used it for ended up resulting in INSATIABLE amounts of LAG for the server computer, to the point of AI (no matter their skill) becoming as stupid as one can get, including reaction times of up to 1 full minute.

Needless to say, I need to look into that a little more.

I'll probably post the procedure in about a day or so, when I get home.