New SFX

Again, yes. Just a series of statements checking to see which armor is worn, then play x effect. Once you know exactly what you want to do, I can send you a script or code for it.
 
Does anyone have a good sound effect of walking in metal armour? Something like a knight walking in plate would do.

Also, can anyone recommend a good way to get decent, free SFX? From movies maybe? Any good free sites?
 
Ok, i've made some progress with this, and am getting some fairly decent results. I've been using the critter_proc. The only problem i find is that the same SFX played continuously can get a bit repetetive after a while. I've had some sucess using 2 or 3 different SFX and assigning them to a random variable but they tend to play simultaneously.

Any ideas or suggestions?

Also - i'm having difficulty making the timed_proc version that Forgotten Knight wrote work:


Code:
procedure timed_event_p_proc
begin
   if(combat_is_initialized == false) then
      begin
         if(dude_is_walking)then
            begin
               play_sfx("ILCNTNRB");
            end
         if(dude_is_running)then
            begin
               play_sfx("ILCNTNRB");
            end
      end
   add_timer_event(Self_obj,game_ticks(1),0);
end

Should this code work as is when put in the timed_event_proc section of the dude_obj script?
 
Ok folks, i've made some decent progress on this with the help of MIB88, but now i need to ask for help again:

So i've decided that a critter_proc in the obj_dude script is the way to go. I've been using Forgotten Knights script from the previous page as a basis:

Code:
procedure critter_p_proc
begin
     if(dude_is_walking)then
      begin
         play_sfx("ILCNTNRB");
      end
   if(dude_is_running)then
      begin
         play_sfx("ILCNTNRB");
   end
end

So as you can see it's a simple bit of code: if the player is walking, every time the critter proc is called (several times a second) the selected 'footstep' sfx is played. Simple. So the problem is that final result is a rather jumbled, echoing sound mess because the sound is called too often. So MIB88 came up with the good idea that i could add a basic variable that increases by 1 every time the critter_proc gets called. When it reaches a certain number, it calls the sound. Again - simple. So simple that i can't figure out how to do it. So i'm not looking for anything complicated here: could someone write me an example of the code above that does what i want pleeeeeeze? In case anyone doesn't already know, i'm just a noob scripter (hence why i'm asking for help) :mrgreen:
 
Josan12 said:
So the problem is that final result is a rather jumbled, echoing sound mess because the sound is called too often. So MIB88 came up with the good idea that i could add a basic variable that increases by 1 every time the critter_proc gets called. When it reaches a certain number, it calls the sound. Again - simple. So simple that i can't figure out how to do it. So i'm not looking for anything complicated here: could someone write me an example of the code above that does what i want pleeeeeeze? In case anyone doesn't already know, i'm just a noob scripter (hence why i'm asking for help) :mrgreen:
Would playing every second be good? if so, you can do this:

add this near the top of the obj_dude script where other variables are defined;
Code:
variable time;

add this to critter_p_proc
Code:
   if ( (time+1) == GAME_TIME_IN_SECONDS ) then begin
      //display_msg("hello per second: " + time);
      //put your code here
      time := GAME_TIME_IN_SECONDS;
   end

add this to map_enter_p_proc
Code:
time:= GAME_TIME_IN_SECONDS;

Only problem I see is that the variable might overflow when the time gets really large...meh, isn't a problem with what we are trying to do here. Either way, you can see from this how variables can be defined and used so you can alter this anyway you wish.
 
Ho! Thanks Killap. But i can't get it to work :(

Here's what i put in my script:


Code:
procedure start;
procedure critter_p_proc;
procedure map_enter_p_proc;
procedure combat_p_proc;
procedure map_update_p_proc;
procedure is_dropping_p_proc;
variable time;

at the top with the other procs

Code:
procedure critter_p_proc begin
      
   if ( (time+1) == GAME_TIME_IN_SECONDS ) then begin
      display_msg("hello per second: " + time);
      play_sfx("maxflr");
      time := GAME_TIME_IN_SECONDS;
   end

Critter_proc (it should display a message every second? and also play sfx)

Code:
procedure map_enter_p_proc
begin

time:= GAME_TIME_IN_SECONDS; 
end

Under map_update_proc

It compiles fine, but i get nothing.

Can you see what i'm doing wrong?
 
Oh, for some reason it seems that even though you start the game, enter_map_p_proc for obj_dude is not run until you renter the map (I swear it is run for other scripts). Try exiting and entering a map - it should work then.
 
killap said:
Oh, for some reason it seems that even though you start the game, enter_map_p_proc for obj_dude is not run until you renter the map (I swear it is run for other scripts). Try exiting and entering a map - it should work then.

Ah ha! That did it.

But .... if i change the code to this (i just put in a 'dude_is_walking' check):

Code:
procedure critter_p_proc begin
     
   if ( (time+1) == GAME_TIME_IN_SECONDS ) and (dude_is_walking) then begin

      display_msg("hello per second: " + time);
      play_sfx("maxflr");
      time := GAME_TIME_IN_SECONDS;
   end

Then it will only run the script when the player first enters the map and walks. Once you stop walking on the new map it stops running the script until you enter a new map!

To change focus a little - my main objective here is to be able to tweak the timing of exactly when the game calls the 'play_sfx' so i can match it to the footsteps in the walking animation. I'm not sure linking it to game_time_in_seconds will help me do that....

So going back to MIB88's idea of adding a variable that is increased every time the critter_proc is called, here's what i was thinking (but i can't get it to compile):


Code:
procedure critter_p_proc begin      

if (dude_is_walking) then begin
      set_local_var (LVAR_steps, + 1);
      end
     
      if (LVAR_steps == 5) and (dude_is_walking)and (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_LEATHER_JACKET) then begin
      play_sfx("maxflr");   
      end

Any idea why this doesn't compile? I now realise i don't neccessarily need to use an LVAR - any regular variable would work. But i need it to increase the variable by 1 every time the critter_proc is called. Then i can tweak it to call the sfx when the variable reaches any number i like (as you can see - in the above script it's 5)

Does this idea seem like it could work? And if so, could you modify the above script to make it do what i want!?

noob alert!! :crazy:
 
Josan12 said:
I'm not sure linking it to game_time_in_seconds will help me do that....
Sure, just throwing that idea out there


Josan12 said:
So going back to MIB88's idea of adding a variable that is increased every time the critter_proc is called, here's what i was thinking (but i can't get it to compile):
Syntax errors.

First, you need to declare the local var (make sure the value is one higher than the last local var (in this case I am setting it to 2)):
Code:
#define LVAR_myvar              (2)

When you set a local variable you want it to look like this:
Code:
set_local_var(LVAR_myvar,5);

If you want to increment the local var by 1, then do something like this:
Code:
set_local_var(LVAR_myvar,local_var(LVAR_myvar)+1);

When you want to check the value of a local var, then do something like this:
Code:
if (local_var(LVAR_myvar) == some_value) then begin
//your fun code
end

I don't think you want to use a local variable here. The only reason for using one is if you want to save the value when you leave the map. For what you are doing, I don't think you care about this. Instead use temporary variables (or whatever Fallout considers them)

declare a variable:
Code:
variable foo;

set a variable to some value:
Code:
foo := 5;

increment some variable by 1:
Code:
foo := foo + 1;

check the value of a variable:
Code:
if (foo == some_value) then begin
//your fun code here
end
 
Ahhh - tha's the good stuff. Thanks for helping a noob out, Killap. :D I'll post my progress and any more questions ...
 
Here's my code so far (i know, i know - thankyou, thankyou. *bow*)

Code:
procedure critter_p_proc begin
variable step;
step := 0;
      
     if (dude_is_walking) then begin
     step := step + 1;
     //display_msg("hello per second: ");
     end
      
     if (dude_is_walking) and (step == 2) then begin
     play_sfx("maxflr");
     end
end

As you can see it doesn't do what i want it to do because the variable can never get above 1!!! (but at least it compiles!)

How do i make it so the variable accumalates?
 
Josan12 said:
As you can see it doesn't do what i want it to do because the variable can never get above 1!!! (but at least it compiles!)
The problem is you have the variable "step" being declared in critter_p_proc. This means that every time critter p_proc is called step is reset to 0. This is a problem.

What you want to do is move

Code:
variable step;
step := 0

to the top of the script. Look for the area where local variables are declared and put the code below them.
 
Thanks Killap. That did it. You get +10 karma for every noob you help out you know .... :)

So - i think i got it to work as i want. It appears the critter_proc is called about 3000 times a second!! :shock: If i set the variable cap to 3000 it plays the SFX about once per second.

But even then it is strangely inconsistent - apparently very different on different maps .... and not consistent even on a single map .....

Stupid game .... :x *frustrated*
 
I think you can get that leather creaking noise from... what was that game. I know theres a game I have that uses it. Counter Strike Source? Thief? Splinter Cell? One of those I think.... I'm not sure which. Sorry...
 
Judaeus Apella said:
I think you can get that leather creaking noise from... what was that game. I know theres a game I have that uses it. Counter Strike Source? Thief? Splinter Cell? One of those I think.... I'm not sure which. Sorry...

I have sounds all ready to go. The problem is how to script them... i just can't seem to find a way to accurately 'time' the playing of a sound.
 
Ah, I see. I had problems when I was making sound effects for an HL1 mod. I had to get a special program that put flags in the audio files, that told the program where to start playing them, where to loop them, etc. I also had to save them to a normal wav format but with that same program and it had to be with all the right settings. Pain in the butt it was....

I was doing voice acting for teamate radio communication, commands, and responces. Did a great job with that, but the mod team didn't have their act together and the mod died... I think it was a player team vs AI mod, with online mission maps. Don't remember much about it, was a looooong time ago.
 
Josan12 said:
The problem is how to script them... i just can't seem to find a way to accurately 'time' the playing of a sound.

Also, they should play different if you're walking or running.
 
Can anyone tell me why this sfall GL script:

Code:
procedure start;

procedure start begin
   if (game_loaded) then begin
      set_global_script_repeat(2);
   end 
   else begin
      if (dude_is_walking) then begin
                // play_sfx("maxflr");
                display_msg("walk");
               
      
   end
end

Won't compile?

If i comment out

Code:
if (dude_is_walking) then begin

Then it compiles. But i cannot for the life of me see anything wrong with the line above. Is it not recognised as an sfall argument?
 
Uh, not that I am the expert, but.... shall that work?

Code:
procedure start begin
   if (game_loaded) then begin
      set_global_script_repeat(2);
   end
   else begin
      if (dude_is_walking) then begin
         // play_sfx("maxflr");
         display_msg("walk");
      end
   end
end

There has been a missing "end" after the "if".

/Edit: Better this:

Code:
procedure start begin
   if (game_loaded) then begin
      set_global_script_repeat(2);
   end
   else if (dude_is_walking) then begin
      // play_sfx("maxflr");
      display_msg("walk");
   end
end
 
Back
Top