Railgun.oxp v 1.3 now available

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Re: Railgun.oxp v 1.2 now available

Post by DaddyHoggy »

Commander McLane wrote:
pagroove wrote:
I like the railgun! Good work and very original. It only need one thing more and that is: sound.
Its a bit silent.
... and therefore doesn't fit the Space Is Noisy-trope. :wink:

But seriously, I'd love to have a sound effect, perhaps two sound effects: one for firing, and one for hitting. You're the man for sounds, would you like to provide some?

(And while you're at it, I'd also love to have a sound effect for the fireworks from fireworks.oxp.)
You should still hear the firing mechanism reverberating through the hull of the ship though, should you?
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Railgun.oxp v 1.2 now available

Post by Commander McLane »

As I have never worked with sound effects or music before, how would I script the use of a sound effect let's say in railgun-firing.js? Is it enough to insert

Code: Select all

Sound.playMusic("laser.ogg");
somewhere? If I type this into the console, nothing happens.
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Railgun.oxp v 1.2 now available

Post by Svengali »

As it is a sound that is used inflight and not only one or two times...

Put the sound in customsounds.plist, e.g.

Code: Select all

"[railgun_fire]" = "railgun_fire.ogg";
and in the script

Code: Select all

this.bang = new SoundSource;
this.bang.sound = "[railgun_fire]";
this.bang.play();
or

Code: Select all

var bang = new SoundSource;
bang.sound = "[railgun_fire]";
bang.play();
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Railgun.oxp v 1.2 now available

Post by Cody »

A nice sound effect for the railgun would be very cool.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Railgun.oxp v 1.2 now available

Post by Smivs »

Phut!
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Re: Railgun.oxp v 1.2 now available

Post by Disembodied »

There are some Creative Commons sound-effect libraries out there ... something like this might be good:

http://www.freesound.org/samplesViewSingle.php?id=39023
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Railgun.oxp v 1.2 now available

Post by Commander McLane »

Smivs wrote:
Phut!
Now if you would be so kind and send it to me as an OGG. :D
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Railgun.oxp v 1.2 now available

Post by Commander McLane »

@ Svengali: thanks! :D

(And as it turns out, I should've consulted the SoundSource documentation, not the Sound documentation. D'oh! :oops: )
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Railgun.oxp v 1.2 now available

Post by Smivs »

Commander McLane wrote:
Smivs wrote:
Phut!
Now if you would be so kind and send it to me as an OGG. :D
My pleasure. Here you are :lol:
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Railgun.oxp v 1.2 now available

Post by Commander McLane »

Smivs wrote:
Commander McLane wrote:
Smivs wrote:
Phut!
Now if you would be so kind and send it to me as an OGG. :D
My pleasure. Here you are :lol:
Nothing personal, but I'm not quite convinced yet. :P

But seriously: I am imagining something not completely unlike the missile launching sound, but shorter, and more 'electric'.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Railgun.oxp v 1.2 now available

Post by Smivs »

Hehe, only kidding.

On a serious note (excuse the pun) this might be more suitable.

If it's any help to anyone, I found these here, available as .wav or mp3 files, and used the free online mp3 to ogg converter here.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Railgun.oxp v 1.2 now available

Post by Commander McLane »

Smivs wrote:
Hehe, only kidding.

On a serious note (excuse the pun) this might be more suitable.

If it's any help to anyone, I found these here, available as .wav or mp3 files, and used the free online mp3 to ogg converter here.
Oh, shiny! Nice sound effects. I'll dig through those. :D
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Railgun.oxp v 1.2 now available

Post by Commander McLane »

Svengali wrote:
As it is a sound that is used inflight and not only one or two times...

Put the sound in customsounds.plist, e.g.

Code: Select all

"[railgun_fire]" = "railgun_fire.ogg";
and in the script

Code: Select all

this.bang = new SoundSource;
this.bang.sound = "[railgun_fire]";
this.bang.play();
or

Code: Select all

var bang = new SoundSource;
bang.sound = "[railgun_fire]";
bang.play();
Another question: is it safe and sound to put this into the activated handler?

I have done this with the second version, and at least I don't get errors about a re-defined var bang. I am not sure about the nature of the activated handler. Does it create a new instance of the script each time (so it seems with the lack of an error message), or could I declare the soundSource somewhere else and only once, and then only use the play() in the activated handler?
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: Railgun.oxp v 1.2 now available

Post by JensAyton »

A variable declared with var inside a function exists for the duration of that activation of the function. It ceases to exist when the function returns.

The sound source itself continues to exist until it is garbage collected, which can’t happen while it’s playing (i.e., the game code protects it; this is different from timers, which can randomly stop if you don’t keep a reference to them). In fact, sound sources will keep going even after the game resets (Bug #18108).

In general, it’s better style to set up one sound source, or a small pool, and reuse it. However, the behaviour of equipment scripts is somewhat weird and I don’t actually know if the script is reused or you’re getting a new instance each time (Kaks implemented this stuff).
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Railgun.oxp v 1.2 now available

Post by Svengali »

In the eq script for Cabal_Common_Comms I'm using

Code: Select all

this.activated = function()
{
  if(!this.beep){
    this.beep = new SoundSource;
    this.beep.sound = "[cabal_common_commbeep]";
  }
  // Other stuff
  this.beep.play();
}
Ahruman wrote:
In fact, sound sources will keep going even after the game resets (Bug #18108).
Yep. Gave me some headaches for BGS when the player loads or reloads a savedgame, because BGS uses looped sounds.
Post Reply