Jump to content

Recommended Posts

Hi, I'm currently trying to create a trigger that will play sound for locally for one specific player who will enter it. This is being made for a multiplayer mission.

My current trigger:

[]spawn {
while {true} do {
 
if (Y inArea t1) then {
playSound "geiger"; uiSleep 1.6;
};
};
};

The trigger activation is set to a custom condition.

(Y inArea t1)


My player is "Y", the trigger is "T1" and the sound which I'm looping is "geiger". Help.

Share this post


Link to post
Share on other sites
30 minutes ago, dreadedentity said:

Is something not working?

Yes, when Y enters the trigger zone, the sound can be heard by other players.

Share this post


Link to post
Share on other sites

Probably running on all clients I assume? Where is it being executed?

 

Considering that, try this:

if (player == Y) then {
  []spawn {
    while {true} do {
      if (Y inArea t1) then {
      	playSound "geiger"; uiSleep 1.6;
      };
    };
  };
};

 

Share this post


Link to post
Share on other sites

Wait, I'm confused. You have the condition Y inArea t1 in the trigger, but you are also checking that condition in an external script loop?

[]spawn {
while {true} do {
 
if (Y inArea t1) then {
playSound "geiger"; uiSleep 1.6;
};
};
};

Depending on where that is running (but why in the first place?) it will execute that code wherever it is told, which might be everywhere.

 

You already have the trigger with the condition in it, just put your playSound in the On Activation field.

Share this post


Link to post
Share on other sites
23 minutes ago, beno_83au said:

Probably running on all clients I assume? Where is it being executed? 

 

Considering that, try this:


if (player == Y) then {
  []spawn {
    while {true} do {
      if (Y inArea t1) then {
      	playSound "geiger"; uiSleep 1.6;
      };
    };
  };
};

 

Thanks, it does seem to be working however I can't really test as I am doing this in singleplayer. This line is being executed in the "on activation" section of the trigger. It is set to repeatable and it is not server only.

Share this post


Link to post
Share on other sites
14 minutes ago, Harzach said:

Wait, I'm confused. You have the condition Y inArea t1 in the trigger, but you are also checking that condition in an external script loop? 

The idea is that the trigger activates from the presence of Y, and the second line being executed in the "on activation" section, will continue to loop as long as Y is still present.

Share this post


Link to post
Share on other sites
1 hour ago, Harzach said:

Depending on where that is running (but why in the first place?) it will execute that code wherever it is told, which might be everywhere.

 

You already have the trigger with the condition in it, just put your playSound in the On Activation field. 

For the reasoning, it's a recurring sound, it's a tick of a Geiger counter belonging to one of the players when they near a "radioactive" object. How do I change if it activates locally or globally?

 

Share this post


Link to post
Share on other sites

Check locality:

 

anyPlayer present

condition : Y in thisList && local Y

 On activation:

[] spawn {
  while {triggerActivated thisTrigger && local Y} do {
    playSound "geiger";
    uiSleep 1.6;
  };
};

Or

script an effect local trigger (makeGlobal set to false, you can't do that in editor)

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, pierremgi said:

Check locality:

 

anyPlayer present

condition : Y in thisList && local Y

 On activation:


[] spawn {
  while {triggerActivated thisTrigger && local Y} do {
    playSound "geiger";
    uiSleep 1.6;
  };
};

Or

script an effect local trigger (makeGlobal set to false, you can't do that in editor)

Seems to be working fine, thanks for the help guys.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×