PDA

View Full Version : Spawnsound.cog



ORJ_JoS
04-05-2005, 08:22 PM
Hi all!

I downloaded this cog from massassi, but it doesnt work for multiplayer. Players hear the sound, but only when they respawn themselves, not if another player spawns.

I'm sure this can be fixed! I tried adding the 'flags=0x240' line, but that didn't solve it.




# Jedi Knight Cog Script
#
# Spawnsound.COG
#
# Plays a sound when player (re)spawns
#
#
# 10/6/2000 (c) Sven Solo

symbols

message newplayer

sound wav=

int dummy local

end

# ================================================== ======================================

code
newplayer:
Dummy=PlaySoundLocal(wav, 1.0, 0, 0);

return;

end




Would someone be so nice to implement it for me? :)

Quib Mask
04-05-2005, 08:36 PM
The newplayer: message is local only, meaning when another player respawns your COGs don't receive a newplayer: message. One way you could solve the problem is to fire off a trigger when you respawn that tells the other players to play a respawn sound on their computer.

QM

ORJ_JoS
04-05-2005, 09:49 PM
Hmmmm, I didn't know that. Is that difficult to do?

Hell Raiser
04-05-2005, 10:47 PM
Or just edit the line that plays the sound in kyle.cog?

ORJ_JoS
04-06-2005, 06:29 PM
Kyle.cog? Never heard of that, I hardly know anything about Cog. I'm more of a mapper myself.

The trigger idea sounded good! I can't really write my own cog... I can modify really really basic things only....

darthslaw
04-06-2005, 07:50 PM
Try this and see what happens. I'm assuming newplayer is called whenever A player respawns, not just the local player. Otherwise this might have to be 2 cogs.

# Jedi Knight Cog Script
#
# Spawnsound.COG
#
# Plays a sound when player (re)spawns
#
#
# 10/6/2000 (c) Sven Solo

flags=0x240

symbols

message newplayer
message trigger

sound wav

end

# ==================================================

code
newplayer:
SendTrigger(-1, id, 0, 0, 0, 0);

return;
trigger:
if(GetSourceRef() == id) PlaySoundLocal(wav, 1.0, 0.0, 0x0);

return;

end

ORJ_JoS
04-06-2005, 08:32 PM
:D Wow, thanks, Slaw!

I'm going to test this! It looks like it'll work, hehe.

Your name will be all over the cog credits in my level, lol. You help me out so often!

This level is near completion and will be submitted as soon as I get the AI synced. (A Remote, G-Man is helping me out with it - we have it synced now but it keeps respawning, arg lol. G-Man is in my clan now, by the way :) )

This spawnsound.cog is for my second temple preview... it has this randomambient bell sound ... someone suggested to let it play the bell sound when a player joins the game...instead of just at random intervals.. so here I am, lol.

ok, I'll be back with the test results. ;)

ORJ_JoS
04-07-2005, 04:58 PM
[Li'l Ani] "IT'S WORKING! IT'S WORKING!!!!!" [/Li'l Ani]

:D :D :D

Slaw is da man!!!!

*does the happy dance*

Awesome! my level now plays a temple bell everytime someone joins! And... everybody hears the sound!

Thanks a lot!

darthslaw
04-07-2005, 05:20 PM
w00t!

And when I posted that I thought it probably wouldn't work...!

*dances* <--- (oh now if only I could... prom is going to be interesting :p)