Hello all. I have very basic knowledge of SCM coding. Currently, i'm experimenting with some codes for a map i'm working on. I am not using cleo. Basically, i'm trying to have music playing inside a bar, which is not a separate interior.
The way i figured this could work, is by replacing one of the .wav files in the audio folder with a .wav version of the song i chose. Then a code starts the .wav when the player is near a point which has a radius covering the bar. Here is the code so far:
:Label008769 0001: wait 1000 ms 03A4: name_thread "MUSIC1" 03CF: load_wav "GIMME01" as 2 00D6: if 0 00F5: player $PLAYER_CHAR 0 ()near_point -17.0 -33.0 6.5 radius 5.5 5.5 3.0 004D: jump_if_false ££Label0087E5 0050: gosub ££Label0087C2 0050: gosub ££Label0087F7 :Label0087C2 00D6: if 0 83D0: NOT wav 2 loaded 004D: jump_if_false ££Label0087F3 0001: wait 0 ms 00D6: if 0 8256: NOT player $PLAYER_CHAR defined 004D: jump_if_false ££Label0087EC :Label0087E5 0002: jump ££Label008769 :Label0087EC 0002: jump ££Label0087C2 :Label0087F3 03D1: play_wav 2 :Label0087F7 00D6: if 0 03D2: wav 2 ended 0459: end_thread_named "MUSIC1"
It works, and the music starts playing when the player enters the bar. Now i need to modify the code so that when the player is no longer in this radius, the wav ends. I have made numerous unsuccessful attempts at this, and each time the game crashes.
Since it was not difficult to get this far, and i have indeed had the wav stop and restart in some versions of the code (not in the right conditions), i'm assuming it is possible to do exactly what i'm trying to do.
Any help to complete this code would be deeply appreciated. Thanks in advance!