maxman
Well-known member
I wanna play a sound in ondrawscript after the player's MP becomes full. However, after I add playsample under the MP's max limit, there's this buzzing and strange sound that plays unless you consume MP. It sounds kinda distorting after the moment you fill full MP.
This is from the player's draw script.
This is from the player's draw script.
C:
void main(){
playerMP();
}
void playerMP()
{
if(openborvariant("in_level")==1){
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
int P3 = getplayerproperty(2, "entity");
int MP;
int maxMP;
int HP;
void fullMP = loadsample("data/sounds/fullmp.wav");
void aniID;
void effectvol = openborvariant("effectvol");
void Diamond = getglobalvar("Diamond");
if(!Diamond){
Diamond = loadsprite("data/sprites/diamond.gif");
setglobalvar("Diamond", Diamond);
}
if(P1 != NULL()){
MP = getentityproperty(P1, "mp");
maxMP = getentityproperty(P1, "maxmp");
HP = getentityproperty(P1, "health");
aniID = getentityproperty(P1, "animationid");
drawstring(20, 190, 1, "MP:_"+MP);
if(MP == maxMP){ // If MP is full
drawsprite(Diamond, 97, 24, 5000); // Image starts to display
playsample(fullMP, 0, effectvol, effectvol, 100, 0);
}
else if(MP < maxMP){ // If MP is less than its max MP
setglobalvar("Diamond", NULL()); // Image disappears
}
if(HP <= 0){
setglobalvar("Diamond", NULL());
}
}
}
}
