Author Topic: Playaudio or variable use mistake  (Read 433 times)

What is wrong in this?
I can't seem to get it working like i want.
Code: [Select]
function HCZZombie::onDamage(%this,%obj,%delta)
{
Parent::onDamage(%this,%obj,%delta);
if(isobject(%obj) && isobject(%obj.minigame))
{
if((%HCZpainsoundran) == 1)
{
%obj.playaudio(1,"HCZpain1Sound");
}
else if((%HCZpainsoundran) == 2)
{
%obj.playaudio(1,"HCZpain2Sound");
}
}
}
I created %HCZpainsoundran somewhere else ("%HCZpainsoundran = getrandom(1,2);"), and when i run the add-on, the console reports nothing odd...

I have an alternative way though, but i'd like to know what i did wrong...
It MAY be something else, but i know almost sure there is something with this, what is wrong...

So, yeah...

You need to define the random variable within the function.

You need to define the random variable within the function.
Oh...
Thank you very much.
I am yet learning stuff, so yeah.
I just learned stuff. :)