HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Playing Sounds to 1 Player

06-10-2006, 04:37 AM#1
Pheonix-IV
Is it possible? I assume you'd be able to use some form of local thingy, but i'm hoping theres a way to play a sound so that only 1 player hears it instead of everyone.
06-10-2006, 04:41 AM#2
Jazradel
Yes, use this trigger. Player(0) is the player you want to run it for. 0-11 are players 1-12 and 13-15 are the neutral players.

Trigger:
Custom Script: if GetLocalPlayer() == Player(0) then
-- Run your sound actions in here --
Custom Script: endif
06-10-2006, 07:27 AM#3
blu_da_noob
I suggest you create the sound outside of the Local Player if/then/else and only start it inside.
06-10-2006, 08:13 AM#4
iNfraNe
There is a search button uknow.. this has been asked at least 50 times.
06-10-2006, 08:37 AM#5
Freakazoid
Or use WEU, it has that function.
06-10-2006, 10:17 AM#6
Pheonix-IV
I'm not much good at jass, though i'm trying to learn.

Trigger:
Communication Message Send
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Send Message
Collapse Actions
Set TempPlayerGroup = (Player group((Owner of (Target unit of ability being cast))))
Sound - Play Chat <gen>
Game - Display to TempPlayerGroup for 30.00 seconds the text: ((|c00ffcc00 + (Name of (Owner of (Casting unit)))) + has sent you a message!|r)
Game - Display to TempPlayerGroup for 30.00 seconds the text: MessageString[(Player number of (Owner of (Casting unit)))]
Custom script: call DestroyForce( udg_TempPlayerGroup )

So what exactly do i need to do to that to make it only play the sound to the TempPlayer.
(Anything on how to improve my code without going into full-JASS is appreciated too)

I'm also on the lookout to give each player a String array to store multiple "Messages" with the number of the message stored in the messenger bird via Custom Value, any way to make it so the game can check if a certain Array is in use or not (The messenger bird that references to that array is alive or not) would be greatly appreciated.
06-10-2006, 10:50 AM#7
blu_da_noob
Trigger:
Communication Message Send
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Send Message
Collapse Actions
Set TempPlayerGroup = (Player group((Owner of (Target unit of ability being cast))))
Custom script: if GetLocalPlayer() == GetOwningPlayer(GetSpellTargetUnit()) then
Sound - Play Chat <gen>
Custom script: endif
Game - Display to TempPlayerGroup for 30.00 seconds the text: ((|c00ffcc00 + (Name of (Owner of (Casting unit)))) + has sent you a message!|r)
Game - Display to TempPlayerGroup for 30.00 seconds the text: MessageString[(Player number of (Owner of (Casting unit)))]
Custom script: call DestroyForce( udg_TempPlayerGroup )


For the second part, I'm not sure exactly how your system works, so I can't be sure on that. You could try storing the messenger bird's handle integer as a string at a certain position (0?) in the array and getting it back from there when needed.
06-10-2006, 12:19 PM#8
Pheonix-IV
What i (intend) have is a string array for each player with as many places in it as possible. Each time the player sends a messenger bird, it stores the message in that array somewhere.

What i need is some way to check if an array number is in use or if it can be overwritten.
06-10-2006, 01:01 PM#9
blu_da_noob
I would suggest setting all values in the array to "" (empty string) as an intial value. When you need to put one in the array, loop until you find an empty string and store it in that position. When you are finished using that string (ie. the messenger bird arrives), set the string in that position back to "".
06-11-2006, 03:37 AM#10
Pheonix-IV
That'd work, cheers blu, i probably would have worked that out at some point, but you've just saved me at least several hours of screaming and smacking my head against the wall.


Hmm, is there a way to reference different variables to different players without having to use a series of 12 "If/Then/Else" triggers?
06-11-2006, 11:33 AM#11
Blade.dk
You can maybe use arrays and player numbers.
06-11-2006, 12:10 PM#12
Pheonix-IV
What i need is some way to reference a String Array without actually using the array. For example, i take P1MessageArray(Custom Value of Casting Unit) i'm not actually referencing to any specific part of that array, it'd be great if i could do something like reference P(Player Number of owner of Casting Unit)MessageArray(Custom Value of Casting Unit) that'd work wonders. Is that possible? (I assume i'd need JASS, since i can't do it with GUI)