HayashibaraN Posted November 25, 2008 Share Posted November 25, 2008 (edited) Hello Everyone! As you have probably deduced by now, I am a new member. So, allow me to introduce myself. My name is HayashibaraN (Short for Hayashibara Namida), and I aspire to become a decent (or maybe even advanced ) scripter for my own benefit and for the benefit of others. Although I have alot of coding experience with GM, I realize that the road to becoming a GTASA scripter is not the most smooth. I am ready to take the time to learn this new language and step into the world of GTASA Modding. As of now, I only have a few days experience with Sannybuilder and all that, and it's been pretty straightforward. I have read various tutorials and spent quite some time pouring through MAIN.scm and other decompiled CLEO scripts and I pretty much get the gist of opcodes and such. But onto the actual problem at hand: // This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------thread 'AMBIENTSOUNDS' :AMB1wait 0 0AAE: release_mp3 $HMP3 0AAC: $HMP3 = load_mp3 "CLEO\AMBIENT\BATTLE.MP3" 0AAD: set_mp3 $HMP3 perform_action 1wait 117000 msjump @AMB10A93: end_custom_thread What I wanted to accomplish with this code was this: -Loop an MP3 sound clip of a battle raging in the background -Loop an MP3 sound clip of an indoor ambience sound -Only play the battle sound when outside -Only play the indoor ambience when inside However, the problem with this is: 1) I am unsure of how to only play sounds when indoors/ outdoors 2) The game seems to crash/ hang upon exit. What hapens exactly is that I hear a windows "error sound" and the screen turns black. I must hold ALT+F4 to close everything, including SA. Aside from that, I wanted to code several other things, but do not know the opcode(s) necessary: 1) Make it foggy all the time 2) Ped Riot All the time (think the stateofemergency cheat) 3) Spawn Waltons in traffic with a Gang Member in the back (equipped with with an AK47 or an RPG). Other things to note: I have edited the data files to make sure that any car of any type is rare. And that peds are scarce and most of the time non-existant. Not even police vehicles spawn. Edited November 25, 2008 by HayashibaraN Link to comment Share on other sites More sharing options...
spaceeinstein Posted November 25, 2008 Share Posted November 25, 2008 Instead of waiting 117 seconds, you could check if the mp3 is finished playing instead. You can check if the player is in an interior by getting his current interior and constantly checking if the current interior is 0 (outside) or not 0 (inside). Link to comment Share on other sites More sharing options...
HayashibaraN Posted November 25, 2008 Author Share Posted November 25, 2008 (edited) Instead of waiting 117 seconds, you could check if the mp3 is finished playing instead. You can check if the player is in an interior by getting his current interior and constantly checking if the current interior is 0 (outside) or not 0 (inside). What is the opCode for checking if the MP3 has finished? And what are the opCodes for checking whether or not the player is inside or outside? EDIT: Not sure I need the MP3 opCode, since 117 seconds is the EXACT length of the clip. EDIT2: Hmmm, I have tried peicing some sort of detection code for the ambience. Doesn't work. // This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------0000::AMB1 //This whole label loads the MP3 and inits integers needed for the scriptwait 0 0AAE: release_mp3 $HMP3 0AAC: $HMP3 = load_mp3 "CLEO\AMBIENT\BATTLE.MP3" 0AB9: get_mp3 $HMP3 state_to [email protected] //Calls and stores the status of the MP3 we have just loaded077E: get_active_interior_to [email protected] //Calls and stores the active interior to the integer "[email protected]"//The opCodes below check to see whether or not to play the damn MP3 file (so it doesn't repeat each and every step)if [email protected] == -1 // Checks if the MP3 is not playing (stopped)jump @AMB2 //Playif [email protected] == 2 // Checks if the MP3 is not playing (paused)jump @AMB4 //Check whether to resume at AMB4:AMB2 //Plays the MP30AAD: set_mp3 $HMP3 perform_action 1jump @AMB1:AMB3 //Resumes the MP30AAD: set_mp3 $HMP3 perform_action 3jump @AMB4:AMB4if [email protected] == 0 // Checks if player is in an interior or not by checking the integer "[email protected]"jump @AMB3else_jump @AMB5 //jumps to the part of the script that pauses the ambience sound if insideif [email protected] == -1 //Plays MP3 if it is stoppedjump @AMB2 :AMB5 //Pause the MP30AAD: set_mp3 $HMP3 perform_action 2jump @AMB1 Edited November 25, 2008 by HayashibaraN Link to comment Share on other sites More sharing options...
ZAZ Posted November 25, 2008 Share Posted November 25, 2008 Instead of waiting 117 seconds, you could check if the mp3 is finished playing instead. You can check if the player is in an interior by getting his current interior and constantly checking if the current interior is 0 (outside) or not 0 (inside). What is the opCode for checking if the MP3 has finished? And what are the opCodes for checking whether or not the player is inside or outside? EDIT: Not sure I need the MP3 opCode, since 117 seconds is the EXACT length of the clip. EDIT2: Hmmm, I have tried peicing some sort of detection code for the ambience. Doesn't work. Have seen this exemble at www.gtaforums.com/index.php?showtopic=377082&st=0entry1058665513 ? CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
HayashibaraN Posted November 26, 2008 Author Share Posted November 26, 2008 Yes, I have seen that topic. Unfortunately, I didn't really understand what was going on in the script. I do not understand that "Player Defined" tidbit and I do not see how it's an example of how to play MP3's only outdoors. Link to comment Share on other sites More sharing options...
spaceeinstein Posted November 26, 2008 Share Posted November 26, 2008 Search for interior-related opcodes to get your current interior (like check the modding wiki at least). You can ignore the player defined thing for now. Link to comment Share on other sites More sharing options...
HayashibaraN Posted November 26, 2008 Author Share Posted November 26, 2008 Search for interior-related opcodes to get your current interior (like check the modding wiki at least). You can ignore the player defined thing for now. I found this opCode, but I am not sure if this is what you were referring to. I attempted to make the "pause if inside, but resume if outside" script above, but it doesn't work. I'm not sure how frequently CLEO scripts are run, but I was assuming that it is checked every step, and tried coding it as such. Idk, I'll have another go at it and see what I can do. 077E: get_active_interior_to [email protected] Link to comment Share on other sites More sharing options...
spaceeinstein Posted November 26, 2008 Share Posted November 26, 2008 :something wait 0 get active interior store to [email protected] if [email protected] == 0 // outside jf @nextlabel do something outside jump @end :nextlabel do something inside (since [email protected] is not 0, you're inside) :end jump @something Link to comment Share on other sites More sharing options...
HayashibaraN Posted November 26, 2008 Author Share Posted November 26, 2008 (edited) :somethingwait 0 get active interior store to [email protected] if [email protected] == 0 // outside jf @nextlabel do something outside jump @end :nextlabel do something inside (since [email protected] is not 0, you're inside) :end jump @something Okay, from your post, I made this: // This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------wait 00AAE: release_mp3 $HMP30AAC: $HMP3 = load_mp3 "CLEO\AMBIENT\BATTLE.MP3"0AAD: set_mp3 $HMP3 perform_action 1:something077E: get_active_interior_to [email protected]: get_mp3 $HMP3 state_to [email protected]@ == 0 // outsidejf @nextlabel//do something [email protected] == -10AAD: set_mp3 $HMP3 perform_action 1jf @end:nextlabel//do something [email protected] == 10AAD: set_mp3 $HMP3 perform_action 0:endjump @something However, It doesn't seem to work. Edited November 26, 2008 by HayashibaraN Link to comment Share on other sites More sharing options...
spaceeinstein Posted November 27, 2008 Share Posted November 27, 2008 You should practice if statements more. Like if [email protected] == [email protected] == 1jump_if_false @next0AAD: set_mp3 $HMP3 perform_action 1:next Should be equivalent to if [email protected] == 0 && [email protected] == 10AAD: set_mp3 $HMP3 perform_action 1end I think. Link to comment Share on other sites More sharing options...
HayashibaraN Posted November 27, 2008 Author Share Posted November 27, 2008 You should practice if statements more. Like if [email protected] == [email protected] == 1jump_if_false @next0AAD: set_mp3 $HMP3 perform_action 1:next Should be equivalent to if [email protected] == 0 && [email protected] == 10AAD: set_mp3 $HMP3 perform_action 1end I think. Yeah, I'm not sure what I can and cannot use in GTA codes. I was under the assumption that "if and" was the proper way to use it. So if what your saying is true, you can also use "if [email protected] == 1 || [email protected]= 4" instead of "if or [email protected] == 1 [email protected] == 4" And btw thanks for all your help! Link to comment Share on other sites More sharing options...
spaceeinstein Posted November 28, 2008 Share Posted November 28, 2008 (edited) Glad I can help out. Just a note Sanny Builder can't read the equivalent. I showed the equivalent for reference. Edited November 28, 2008 by spaceeinstein Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now