Ok I randomly found this tutorial in a cod2 mapping forum in:
http://map.planetmedalofhonor.gamespy.com/callofduty/forum/index.php?s=df0463c9a7ea4de3ef84c72d9b54485d&showtopic=146
I thought it would be very nice and funny to post it here.
Here is the tutorial:
In this tutorial we will create a playable piano for your SP or MP map.
The SP version is already scripted in maps\_load::main();
So all you will need is that line in your maps .gsc, and almost all custom SP maps have that already.
The MP version needs to be scripted because it is not included in maps\mp\_load::main();
So on with the tutorial.
Step 1: Create the piano model.
Right click in the 2D view and select misc > model.
Select xmodel/furniture_piano.
IPB Image
Step 2: Create the piano keys.
Create a brush to represent one of the keys.
Right click in the 2D view and select trigger > use.
Now give the trigger_use the following keys & values.
Key: targetname Value: piano_key
Key: script_noteworthy Value: a.
Key: cursorhint Value: HINT_NONE
The cursorhint none will keep you from seeing that little hand icon when you get close to the trigger_use.
IPB Image
Step 3: Create some more piano keys.
There are several script_noteworthy values that you can use.
They are a,b,c,d,e,and f. These are the different sounds that will play when you hit the use key in the game.
So clone the first key from step 2, script_noteworthy a. And give it a different script_noteworthy. Do this a few more times. I created one trigger_use for each different script_noteworthy.
Step 4: Create the Damage Trigger.
Create a brush around the piano model.
Right click in the 2D view and select trigger > damage.
Now give the trigger_damage the following keys & values.
Key: targetname Value: piano_damage
You can also check some of the different spawnflag checkboxes in the entity window to set which weapons can cause damage. And you can add other keys & values for threshold and accumulate.
IPB Image
Step 5: GSC Scripting.
The SP version already includes the scripting for the piano in maps\_load::main();
So all you need is that line in your GSC.
And the soundaliases are already usable on any map. So no need to create a .csv for them.
The MP version does not have the scripting for the piano in maps\mp\_load::main();
So you will have to do the scripting for it.
Here is a GSC I made for multi-player playable piano's. I called it mp_piano_play.gsc
CODE
main()
{
keys = getentarray("piano_key","targetname");
for( i = 0 ; i < keys.size ; i++ )
keys
thread pianoThink();
dmg = getentarray("piano_damage","targetname");
for( i = 0 ; i < dmg.size ; i++ )
dmg thread pianoDamageThink();
}
pianoThink()
{
note = "piano_" + self.script_noteworthy;
for (;;)
{
self waittill ("trigger");
self playsound (note);
//iprintln("playing piano sound");
}
}
pianoDamageThink()
{
note[0] = "large";
note[1] = "small";
for (;;)
{
self waittill ("trigger");
self playsound ("bullet_" + random(note) + "_piano", self.origin);
//iprintln("playing piano damage sound");
}
}
random (array)
{
return array [randomint (array.size)];
}
Then you load it from your maps gsc.
main()
{
maps\mp\_load::main();
maps\mp\mp_piano_play::main();
// etc......
}
This new GSC will go in the maps\mp\ directory/folder along with your maps gsc and d3dbsp.
Well that's how to add a playable piano to your SP or MP map.
Download the tests. The Zip includes
The piano prefab
source .maps
mp_piano_play.gsc
sample map gsc's and d3dbsp's
That should make things easier for you.
Enjoy!!