Grass-sound sounds good to me

Posted By: Ganderoleg

Grass-sound sounds good to me - 05/05/08 17:20

Hello,

I tried to find something about SCAN_TEXTURE and different walk-sounds depending of different textures under the player but had no luck so far…

Only thing I found is topic on Ask Conitecforum...

http://www.coniserver.net/ubb7/ubbthread...true#Post201471

...and answer form JCL that refers to manual

http://manual.conitec.net/aent_trace.htm

It leads to very unspecific information about c_trace modes and nothing further.

I ‘m sure there is something more informative somewhere so if anyone knows of a tutorial, AUM article or maybe open-script game that has this thing implemented please, please, tell me or send link.

It’s impossible that there is nothing about important topic like this… my player sounds the same on wood, gravel, grass or metal \:\)
Posted By: Quad

Re: Grass-sound sounds good to me - 05/05/08 17:31

Use SCAN_TEXTURE with c_trace, it can return texture name.
Posted By: Ganderoleg

Re: Grass-sound sounds good to me - 05/05/08 17:45

Thanx for your reply Quadraxas,

I was really hopping that there is some tutorial out there that can be used…

I can add +SCAN_TEXTURE to c_trace but I don’t understand how the
texture-name-thing works… Do I need event or action or function or some sort of sound-material attached to the texture…

I could look in to that water-splash-sound-code but I was hopping I get the real thing, real code solution for this somewhere…

Posted By: Ganderoleg

Re: Grass-sound sounds good to me - 05/05/08 21:36

O.k. so I tried some things:

First I have default walk sound thud and different sound I call thudB.

Then I have variable that controls playing of these sounds called korak_zvuk.

I have special function called under_tex and it’s started in action player_walk_fight before player_move2 function and other things…

This is function under_tex()

vec_set(temp, my.x);
temp.z -= 500;
c_trace(my.x,temp,IGNORE_ME|IGNORE_PASSABLE|IGNORE_MODELS|IGNORE_SPRITES|SCAN_TEXTURE);
if( str_cmpni(tex_name,"BZid_04_tga") == 1){korak_zvuk=1;}
if(str_cmpni(tex_name,"Josef_054_bmp") == 1){korak_zvuk=2;}

...it works in a way because it changes the sound but it’s always the one who is last…
…so it doesn’t work

I guess I’m using the wrong comparing code but this is the one that is used in lflare.wdl…

Can anyone help in any way please… \:\/
Posted By: Ganderoleg

Re: Grass-sound sounds good to me - 05/05/08 23:55

Sooo… everything worked out

I replaced my "Josef_054_bmp" comparison texture name from…

if(str_cmpni(tex_name,"Josef_054_bmp") == 1)

…with tex_a that I wrote as…

string tex_a = "Josef_054.bmp";

…and now it’s like this…

if( str_cmpni(tex_name,tex_a) == 1)

…and it all works happily ever after \:D

Just kidding- it has waaaaay tooooooo many bugs \:\(

I’m gona do it another way with sonar. Already tried it and it’s much, much, much better then this SCAN_TEXTURE sh*ty system…
Posted By: MMike

Re: Grass-sound sounds good to me - 05/08/08 16:12

but sonar scans texture too, :S

But you say, if string... then play the sound 1
but you don't exclude others..
you should do this..
if( str_cmpni(tex_name,tex_a) == 1){play sound a}
if( str_cmpni(tex_name,tex_b) == 1){play sound b}
etc.. so if there is no =1 then no sound defined for texture.
Posted By: eleroux

Re: Grass-sound sounds good to me - 05/12/08 22:04

You need to organize your code.

Have you already got to play a single, fixed footstep sound? That's the first step (no pun intended) because it's not as simple as playing the sound on every loop. You have to play the sound at certain points of the animation cycle.

In the same loop with the c_trace, for instance, you could define a skill for the actor that stores the kind of floor he is standing or walking on:
c_trace(my.x,temp,IGNORE_ME|IGNORE_PASSABLE|IGNORE_MODELS|IGNORE_SPRITES|SCAN_TEXTURE);
if( str_cmpni(tex_name,"BZid_04_tga") == 1){my._skillFloorType = 1;}
if(str_cmpni(tex_name,"Josef_054_bmp") == 1){my._skillFloorType=2;}

In my code, I used another skill as a 'sound trigger'. For instance, 0 means NO SOUND, 1 means FOOT STEP, 2 means ATTACK SOUND, etc.

Then in the animation part, you have to make sure the sound isn't played repeatedly, but only twice per walk loop. So I use the skill everytime I need a sound, for instance:
my._skillSoundTrigger = 1;

then I have a permament loop for every actor that has sound, parallel to the other loops. Kinda:

Code:
function actorSound ()
{
while (me)
{
  if (my._skillSoundTrigger ==1)
  {  
      if (my.skillFloorType ==1) {play sound 1}
      if (my.skillFloorType ==2) {play sound 2}
      my._skillSoundTrigger =0 ; (WARRANTS sound will played just once)
   }
   wait(1)
}


And if you get tidy, you can have all your floor types and sound names organized by enumerating them, putting their pointers in arrays, etc. And, in the future, will be very easy to make the characters play attack screams and jump/fall sounds. You will only need to 'if player hit the attack button: {my._skillSoundTrigger = SOUNDATTACK}.' - fire and forget, sound will play just once.

Please note these code snippets are still from C-script, and it's not a plug and play code. I'm just trying to help with some ideas that work.

Emilio


Posted By: Ganderoleg

Re: Grass-sound sounds good to me - 05/18/08 22:00

Thanx for suggestions smile

I made a function that starts in player_walk_fight action and it didn’t work very well frown

It worked but it was not really precise I will try to start it from in the loop with the c_trace (That’s move template from A5 Template scripts right?) and see how it goes.

Thanx for help to both of you.
© 2024 lite-C Forums