Death Music Script? |
Death Music Script? |
Sep 9 2009, 11:54
Post
#1
|
|
Junior Member Group: Members Posts: 20 Joined: 18-March 09 From: San Antonio, TX Member No.: 5,356 |
Is it possible to make it in a mission when you die, it plays a song? (Track) If so, how?
|
|
|
Sep 9 2009, 13:27
Post
#2
|
|
Group: Addon Maker Posts: 1,148 Joined: 4-November 06 Member No.: 13 |
You need to edit the OnPlayerKilled.sqs script, because even if you started playing a custom soundtrack when you die, for example via the trigger, the default death script starts playing its own music and would overwrite yours. I think the script is located in the ca.pbo in your ArmA/AddOns folder. Simply unpbo the file, look for the OnPlayerKilled.sqs script, open it up with a text editor and edit the line which defines which music would be played when the player dies (playMusic "x"). After this, save the script into your mission folder. The script should work automatically whenever the player dies, as long as it's named OnPlayerKilled.sqs and it's located in your mission folder.
|
|
|
Sep 9 2009, 14:51
Post
#3
|
|
Junior Member Group: Members Posts: 20 Joined: 18-March 09 From: San Antonio, TX Member No.: 5,356 |
Hm, on my mission I have it as 5 second respawn as Base, and when I die, music doesn't play. What I was thinking in this special circumstance, when someone dies, a short 5 second song section plays and everyone else in the mission hears it. Some sort of Blufor trigger?
|
|
|
Sep 9 2009, 15:20
Post
#4
|
|
Group: Addon Maker Posts: 1,148 Joined: 4-November 06 Member No.: 13 |
Ah, multiplayer. In that case, try this:
1. Make a trigger on the map, activated repeadetly with condition: !alive player. On the activation field type: player exec "deathmusic.sqs" 2. Save the following into your mission folder as deathmusic.sqs: CODE ?!local _this: exit playMusic "your_track" That should do the trick. This post has been edited by Rellikki: Sep 9 2009, 15:23 |
|
|
Sep 10 2009, 08:10
Post
#5
|
|
Junior Member Group: Members Posts: 20 Joined: 18-March 09 From: San Antonio, TX Member No.: 5,356 |
Ah, multiplayer. In that case, try this: 1. Make a trigger on the map, activated repeadetly with condition: !alive player. On the activation field type: player exec "deathmusic.sqs" 2. Save the following into your mission folder as deathmusic.sqs: CODE ?!local _this: exit playMusic "your_track" That should do the trick. Right on! Works like a charm! Thanks for the help! This post has been edited by semedar: Sep 15 2009, 12:15 |
|
|
Sep 15 2009, 12:15
Post
#6
|
|
Junior Member Group: Members Posts: 20 Joined: 18-March 09 From: San Antonio, TX Member No.: 5,356 |
New:
When you kill enemy, track plays? How to make ArmA play a track play when player kills an enemy Can anyone help me with how to make ArmA play a track when the player (any player in MP) kills an enemy? Example: I see an enemy rifleman and shoot him and kill him, right after I kill him, a sound (track) plays. And when my friend kills and enemy rifleman, a sound plays again. Is this possible in ArmA? |
|
|
Sep 15 2009, 13:34
Post
#7
|
|
ArmA.info Sarcasm Society's Mr. Argentina 2012 Group: Newshound Posts: 498 Joined: 20-October 07 From: Argentina Member No.: 1,502 |
Yes it is, I remember (and I wish I didn't) Cervantes' Zombie Mod, it had a script that, when you killed a zombie by shoting at it's head, the "Headshot" form Unreal Tournament would sound. Really annoying...
So, you want that only the killer hears the sound or all the players? |
|
|
Sep 15 2009, 14:22
Post
#8
|
|
Junior Member Group: Members Posts: 20 Joined: 18-March 09 From: San Antonio, TX Member No.: 5,356 |
Yes it is, I remember (and I wish I didn't) Cervantes' Zombie Mod, it had a script that, when you killed a zombie by shoting at it's head, the "Headshot" form Unreal Tournament would sound. Really annoying... So, you want that only the killer hears the sound or all the players? Preferably just the killer, but it's cool too if all the people hear it too. |
|
|
Sep 18 2009, 05:14
Post
#9
|
|
Junior Member Group: Members Posts: 20 Joined: 18-March 09 From: San Antonio, TX Member No.: 5,356 |
I've got it to work, but only with one guy:
1. Make a trigger on the map, activated repeadetly with condition: !alive enemy. On the activation field type: enemy exec "killmusic.sqs" 2. Save the following into your mission folder as killmusic.sqs: CODE ?!local _this: exit playMusic "your_track" But the enemy, or person who triggers it has to be named "enemy". I can't figure out how to make it for every OPFOR enemy. Anyone have any suggestions? |
|
|
Sep 18 2009, 14:21
Post
#10
|
|
Group: Addon Maker Posts: 1,148 Joined: 4-November 06 Member No.: 13 |
You should give all the OPFOR an event handler "killed". Place a trigger on the map, activated for OPFOR with condition: true. On the activation field type:
CODE {_x addEventHandler ["killed", "(_this select 1) exec ""killmusic.sqs"""] But keep in mind that it might be a bit perfomance demanding to have all the OPFOR units running event handlers. This post has been edited by Rellikki: Sep 18 2009, 14:22 |
|
|
Sep 19 2009, 08:41
Post
#11
|
|
Junior Member Group: Members Posts: 20 Joined: 18-March 09 From: San Antonio, TX Member No.: 5,356 |
You should give all the OPFOR an event handler "killed". Place a trigger on the map, activated for OPFOR with condition: true. On the activation field type: CODE {_x addEventHandler ["killed", "(_this select 1) exec ""killmusic.sqs"""] But keep in mind that it might be a bit perfomance demanding to have all the OPFOR units running event handlers. When I input: CODE {_x addEventHandler ["killed", "(_this select 1) exec ""killmusic.sqs"""] It gives me an error: "Missing }" And when you give a unit an eventhandler, I suppose you put: CODE this addEventHandler ["killed"] In their init field? |
|
|
Sep 19 2009, 13:12
Post
#12
|
|
Group: Addon Maker Posts: 1,148 Joined: 4-November 06 Member No.: 13 |
Ah yes, forgot to put a } at the very end of the command. Do that and it should do the trick.
QUOTE And when you give a unit an eventhandler, I suppose you put: CODE this addEventHandler ["killed"] In their init field? That alone won't do a thing. You'd just give them an eventhandler which effects absolutely nothing. Do as I suggested. |
|
|
Sep 19 2009, 13:35
Post
#13
|
|
Junior Member Group: Members Posts: 20 Joined: 18-March 09 From: San Antonio, TX Member No.: 5,356 |
Ah yes, forgot to put a } at the very end of the command. Do that and it should do the trick. That alone won't do a thing. You'd just give them an eventhandler which effects absolutely nothing. Do as I suggested. I suppose you mean like this?: CODE {_x addEventHandler ["killed", "(_this select 1) exec ""killmusic.sqs"""]} Gives me another error: "Type code, expected Nothing" |
|
|
Sep 20 2009, 16:00
Post
#14
|
|
Group: Addon Maker Posts: 1,148 Joined: 4-November 06 Member No.: 13 |
Excuse me again for my misleading info. Shouldn't be writing on discussion forums half-asleep... Here's the full, hopefully working command, forgot another thing from the end:
CODE {_x addEventHandler ["killed", "(_this select 1) exec ""killmusic.sqs"""]} forEach units thisList
|
|
|
Sep 20 2009, 16:44
Post
#15
|
|
Junior Member Group: Members Posts: 20 Joined: 18-March 09 From: San Antonio, TX Member No.: 5,356 |
Hah it's ok
Right-o, it doesn't give me an error now when I put the trigger in, but in-game when I load my mission up it gives me an error: Error units, Type Array, expected Object,Group and when I kill an OPFOR it doesn't play the track. Sorry if this is a hassle.. |
|
|
Sep 20 2009, 18:18
Post
#16
|
|
Group: Addon Maker Posts: 1,148 Joined: 4-November 06 Member No.: 13 |
Another mistake it seems. This is getting embarassing... Try this:
CODE {_x addEventHandler ["killed", "(_this select 1) exec ""killmusic.sqs"""]} forEach thisList I now tested it in game myself to be absolutely sure and now I'm 101% certain that it works. This post has been edited by Rellikki: Sep 20 2009, 18:21 |
|
|
Sep 20 2009, 18:33
Post
#17
|
|
Junior Member Group: Members Posts: 20 Joined: 18-March 09 From: San Antonio, TX Member No.: 5,356 |
Awesome it works! And it doesn't really lag or bring down the performance, but it just be me.. Thanks for your help! A+++ for you, good sir!
|
|
|
Lo-Fi Version | Time is now: 23rd April 2024 - 22:09 |