OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: THobson on 21 Apr 2005, 15:43:55

Title: Creating sound objects
Post by: THobson on 21 Apr 2005, 15:43:55
I want to create a sound object.

I put an empty Abrams and a sound object on an empty map.  In the mission file I found the following:

Code: [Select]
   class Vehicles
   {
      items=2;
      class Item0
      {
         position[]={6208.428223,337.511169,6405.082031};
         id=1;
         side="EMPTY";
         vehicle="Dog";
         skill=0.600000;
      };
      class Item1
      {
         position[]={6221.935547,335.428680,6398.851563};
         id=2;
         side="EMPTY";
         vehicle="M1Abrams";
         skill=0.600000;
      };
   };

So the sound for a Dog and an empty Abrams both just empty objects.
To create another empty Abrams I have a trigger with the code:

Code: [Select]
snd = "M1Abrams" createVehicle getPos playerBut when I try to create a sound object in the same way:
Code: [Select]
snd = "Dog" createVehicle getPos playerOFP crashes to windows.

Does anyone have any experience with this?
Title: Re:Creating sound objects
Post by: ACF on 21 Apr 2005, 16:31:57
Can't quite see where the 'sounds are objects' idea is coming from.
The only 'non-trigger' way I've used to place a sound (as in a cfgSound sample) is to use an invisible object - like a GL or HeliH - and then get that unit to 'Say' the desired sound.  It might also work with on-map objects and it might also work with the looped sound effects in the triggers.
Title: Re:Creating sound objects
Post by: THobson on 21 Apr 2005, 18:04:00
When you place an 'Empty' unit on the map one of the options is 'Sound'.  And it works, it puts a sound object on the map.
Title: Re:Creating sound objects
Post by: macguba on 21 Apr 2005, 18:15:46
More than likely you just can't camCreate a sound object.

Can they be setPossed?
Title: Re:Creating sound objects
Post by: ACF on 21 Apr 2005, 18:24:09
Ahh - didn't read the first post properly, did I!
Have you tried CamCreate-ing the sound, instead of CreateVehicle-ing it?  Could be a difference between an 'object' and a 'unit' thats causing the CTD.  Just a guess - CreateVehicle is not a command I've used.
Title: Re:Creating sound objects
Post by: THobson on 21 Apr 2005, 18:24:40
I hope so setPos was my fall back, but I only really want the CPU load when I have to.

I will also try a camCreate rather than a createVehicle.  What struck me though was the similarity between an Abrams and Dog in the mission file.  I had better tell mikero this ;D
Title: Re:Creating sound objects
Post by: THobson on 21 Apr 2005, 18:41:07
What a pain!

A sound object cannot be camCreated not can it be setPossed.  In fact doing a getPos select x results in the famous scalar boolean thingy.  In other words its location is undefined.

So I now have to either use a trigger that I can setPos in or write a script to loop the sound.

Ho joy.
Title: Re:Creating sound objects
Post by: Planck on 21 Apr 2005, 19:48:17
The class Dog is defined in the config under class Sounds which is under cfgVehicles.

It has no model name though.

Here is something for you to try:

cr = "Crater" createvehicle getpos player

This also has no model defined, but it does have an effect.


Planck
Title: Re:Creating sound objects
Post by: THobson on 22 Apr 2005, 06:43:21
Interesting.  Crater is an odd name for what happens.  I looked through the commented config files and do see that none of the sounds have a model.  It doesn't explain for me why I get a CTD with a sound and not with other things that have no model.  Anyway I will just treat this as a fact of life and work round it.

Thanks.  I seems like you have memorised these config files :)
Title: Re:Creating sound objects
Post by: h- on 22 Apr 2005, 16:00:13
I believe the keyword here is simulation...
The crater has simulation="crater"...

Simulations contain some hardcoded stuff...
It seems to be so that the simulation is what determines which values the game engine uses from the class the simulation has been put under...

For example putting definitions of a tank under a class that has simulation="car" completely ignores those tank related values, unless some of them are used with car class vehicles as well...
Same goes for all simulations...

Title: Re:Creating sound objects
Post by: Planck on 22 Apr 2005, 19:55:54
Quote
Thanks.  I seems like you have memorised these config files

Well, I have poked around them fairly extensively, also doing the P3D Project had me looking at every game P3D file for its list of textures.   ::)  ::)


Planck