Hi there again. So Ive been trying to get my script to where it plays music when the fog starts coming and also again when it leaves. Here is the script:
Code Snippet
Plaintext
reapers_fog() { while(1) { SetVolFog( 75.0, 80.0, 380, -40.0, 0.16, 0.204, 0.274, 7 ); //fog comming SetVolFog( 229.0, 400.0, 115.0, 200.0, 0.16, 0.204, 0.274, 7 ); //fog comming SetVolFog( 229.0, 200.0, 380.0, 200.0, 0.16, 0.204, 0.274, 7 ); //fog comming VisionSetNaked(0, "zombie_sumpf_dogs", 7 ); //fog comming iprintlnbold("^1WARNING: ^7Fog rolling in"); //tells players that the fog is coming, place // at the start if you dont want this to happen
wait 120; //make sure to keep the fog in, change time to your liking
SetVolFog( 404.39, 1543.52, 460.33, -244.014, 0.65, 0.84, 0.79, 6 ); //fog going VisionSetNaked(0, "zombie_sumpf", 4 ); //fog going iprintlnbold("^1WARNING: ^7Fog clearing"); //tells players that the fog is going, place // at the start if you dont want this to happen
wait 120; //make sure to keep the fog away, change time to your liking } }
SetMusicState requires add_sound from init_sounds() in _zombiemode.gsc This is for you to manually call it everytime. You could do a while loop as you did.
I commented DUKIP's code to make it easier to understand what you need to do:
Code Snippet
Plaintext
TheFog() //Change this to the name of your original fog function, reapers_fog() i believe it was { if(level.fog_is_in) //You must add this variable before this line of code { SetVolFog(stuff); //replace "stuff" with the numbers (values) you used in your original fog script here VisionSetNaked("vision", time); //change "vision" to the vision you used for when the fog rolls in and edit the "time" SetMusicState("da_alias"); //change "da_alias" to whatever sound you want to be played upon fog rolling in level.fog_is_in = true; } else { SetVolFog(stuff_out); //Change "stuff_out" to the fog values you used when it goes away VisionSetNaked("vision_out", time); //change "vision_out" to the vision you want when fog goes away, and the time SetMusicState("da_alias_out"); //change "da_alias_out" to the sound you want to play when fog goes away level.fog_is_in = false; } }
Hopefully that might clear up a bit of confusion with the script.
Here is what it might look like with your original values:
Code Snippet
Plaintext
reapers_fog() { level.fog_is_in = false; //game will start with fog equal to false
Once again, i haven't tested this in-game so idk if it will work properly. Also, like DUKIP said, you need to go into _zombiemode.gsc and add an "add_sound" line with the sound(s) you use when the fog comes/goes. Make sure to put them in the init_sounds() function with all the others. Hope this helps
* Edit by harry, there was a missing ; that would have caused a syntax error, just thought id add it in for you *
Last Edit: May 15, 2015, 10:56:34 pm by Harry Bo21
You da man AlecKeaneDUB! Keep your amazing self being amazing! Double Post Merge: May 16, 2015, 07:03:02 pmWelp wait a sec, Bad Syntax error. It doesnt understand
Code Snippet
Plaintext
if(level.fog_is_in = false)
Not sure if something was missing in that spot but thats what was brought up.
Last Edit: May 16, 2015, 07:03:02 pm by MJPWGaming
You da man AlecKeaneDUB! Keep your amazing self being amazing! Double Post Merge: May 16, 2015, 07:03:02 pmWelp wait a sec, Bad Syntax error. It doesnt understand
Code Snippet
Plaintext
if(level.fog_is_in = false)
Not sure if something was missing in that spot but thats what was brought up.
Whoops...that line should be:
Code Snippet
Plaintext
if(level.fog_is_in == false)
Last Edit: May 16, 2015, 07:36:30 pm by AlecKeaneDUB
Also, like DUKIP said, you need to go into _zombiemode.gsc and add an "add_sound" line with the sound(s) you use when the fog comes/goes. Make sure to put them in the init_sounds() function with all the others. Hope this helps