Steve Craft
Member
I'm in doubt if playsample actually have a way to stop it while playing it instead of having to wait for it to end,i searched on legacy manual but i didn't found anything related to it
int sound_id = loadsample("some_sound_file_path");
int channel_id = playsample(sound_id, <priority>, <left vol>, <right vol>, <speed>, <loop>);
setglobalvar("channel_to_stop", channel_id);
int channel_id = getglobalvar("channel_to_stop");
stopchannel(channel_id);
setglobalvar("channel_to_stop", NULL());
if(Animation == openborconstant("ANI_IDLE") ){
if(PAttack){
int Charging1 = loadsample("data/MMXSound/MMXCharge.wav");
int channel_id = playsample(Charging1,0,120,120,100,0);
playsample(Charging1,0,120,120,100,0);
setglobalvar("channel_to_stop", channel_id);
performattack(Self, openborconstant("ANI_FREESPECIAL"), 1);
}
}
if(Animation == openborconstant("ANI_FREESPECIAL") ){
if(NotPAttack){
int channel_id = getglobalvar("channel_to_stop");
stopchannel(channel_id);
setglobalvar("channel_to_stop", NULL());
int ChargeShot = loadsample("data/MMXSound/ChargeShot.wav");
performattack(Self, openborconstant("ANI_FOLLOW1"), 0);
playsample(ChargeShot,0,120,120,100,0);
}
}
}
Steve Craft said:just one question about "channel_to_stop",do i need to put this exact name for the globalvar to stop it or i can use any name that i want?