The Dink Network

Reply to Re: Mkbul's code error thread

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
March 24th 2010, 09:41 AM
knightgl.gif
castman
Peasant He/Him Brazil
Some day I'll finish my mod... Some day... 
Maybe this?

Randomly play sound:
void main(void)
{
sp_touch_damage(&current_sprite, -1);
}

void touch(void)
{
sp_touch_damage(&current_sprite, 0);
int &crap;

sound:
&crap = random(4, 1);

if (&crap == 5)
{
playsound(35, 17000, 2000, 0, 0);
}
wait(100);
goto sound;
}
The random will run 10 times per second with a chance of 1 : 5, so, probably, it will sound about 2 or 3 times per second, or not

Random wait time
void main(void)
{
sp_touch_damage(&current_sprite, -1);
}

void touch(void)
{
int &crap;
sp_touch_damage(&current_sprite, 0);

sound:

playsound(35, 17000, 2000, 0, 0);

&crap = random(300, 100);

wait(&crap);
goto sound;
}


The randomised wait timer will surely play the sound with a defined wait minimum time, and you can add the varial as you wish ^^