Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 13 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 MP Mapping
CoD 2 mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Playable Piano Tutorial
Major_McCoy
General Member
Since: Jun 12, 2007
Posts: 95
Last: Nov 13, 2007
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Sunday, Jul. 8, 2007 02:06 pm
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!!
Share |
kalieck
General Member
Since: Aug 9, 2006
Posts: 161
Last: Feb 14, 2009
[view latest posts]
Level 4
Category: CoD2 MP Mapping
Posted: Sunday, Jul. 8, 2007 02:38 pm
hey there!

first of all, thx for this toturial ... but here is a question:

when i make the trigger use i have to make it around one key on the piano?
Share |
Major_McCoy
General Member
Since: Jun 12, 2007
Posts: 95
Last: Nov 13, 2007
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Sunday, Jul. 8, 2007 02:53 pm
hm sorry m8 but lol I am new to mapping and dont have much time to deal with it and second I dont know anything more than the basics but i am gonna learn so sorry ask some1 else here there are so many..

Cheers[quake]
Share |
codmp
General Member
Since: Feb 7, 2006
Posts: 905
Last: Aug 1, 2011
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Sunday, Jul. 8, 2007 03:42 pm
Code above was posted wrong, so it got a little messed up.

Heres the full code from other site:
Code:
main()
{
keys = getentarray("piano_key","targetname");
for( i = 0 ; i < keys.size ; i++ )
keys[i] thread pianoThink();

dmg = getentarray("piano_damage","targetname");
for( i = 0 ; i < dmg.size ; i++ )
dmg[i] 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)];
}


edited on Jul. 8, 2007 11:43 am by codmp
Share |
OLD_MAN_WITH_GUN
General Member
Since: May 13, 2006
Posts: 754
Last: Jan 23, 2010
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Sunday, Jul. 8, 2007 04:04 pm
kalieck writes...
Quote:
when i make the trigger use i have to make it around one key on the piano?
Not around each key.
Only place 6 trigger_use along the keys.
Look at this pic


The selected inner triggers are the six trigger_use for the keys and the outer unselected trigger is the trigger_damage.

edited on Jul. 8, 2007 12:05 pm by OLD_MAN_WITH_GUN
Share |
Major_McCoy
General Member
Since: Jun 12, 2007
Posts: 95
Last: Nov 13, 2007
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Sunday, Jul. 8, 2007 04:09 pm
sorry guys I didnt doticed it because it was so big.Kk thanx for the note anyway![thumbs_up]

But could anybody help me besides the tutorials I read her because I am greek and dont know enlish so good :(

It would be very kind ...
Share |
kalieck
General Member
Since: Aug 9, 2006
Posts: 161
Last: Feb 14, 2009
[view latest posts]
Level 4
Category: CoD2 MP Mapping
Posted: Sunday, Jul. 8, 2007 05:57 pm
ok i made everything like it said in the toturial but what i have to make that it works?
Share |
kalieck
General Member
Since: Aug 9, 2006
Posts: 161
Last: Feb 14, 2009
[view latest posts]
Level 4
Category: CoD2 MP Mapping
Posted: Saturday, Jul. 14, 2007 11:27 am
kalieck writes...
Quote:
ok i made everything like it said in the toturial but what i have to make that it works?
+

hello? [cry]
Share |
OLD_MAN_WITH_GUN
General Member
Since: May 13, 2006
Posts: 754
Last: Jan 23, 2010
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Saturday, Jul. 14, 2007 03:39 pm
Are you sure, you made everything?
Do you have created all triggers with all necessary keys/values?
Do you have created a new gsc file in main/maps/mp with the name mp_piano_play.gsc and the content codmp has posted?
Do you have added the line maps\mp\mp_piano_play::main(); to your map gsc file?
Check all these things and also check for any typos.
Share |
Major_McCoy
General Member
Since: Jun 12, 2007
Posts: 95
Last: Nov 13, 2007
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Wednesday, Jul. 18, 2007 04:49 pm
i finally managed to do the triggers with keys and values! i made evrything as the tutorials says then the scripting but when i go bear the piano it makes no sound.I think i must make a file with sounds for the piano when i load the map. some help?????
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 MP Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»