Ok, since there didn't seem to be any script for fading objects I tried to do one myself:
int trnsp;
function FadeObjectOut (int object) {
while (trnsp <= 100) {
SetObjectTransparency (object, trnsp);
trnsp += 1;
Wait (1); }
}
function FadeObjectIn (int object) {
while (trnsp >= 0) {
SetObjectTransparency (object, trnsp);
trnsp -= 1;
Wait (1); }
}
Now, the first one works but I can't get the second one to work. When I tried it, my game crashed.
What's wrong with it?
Well, how did it crash? Any error messages?
Looks allright, since it is basically the same than the first function except it goes the other way...
Oh yeah, forgot to show you the error message :P
Error: SetObjectTransparent: tranparency value must be between 0 and 100
I don't get it. It IS between 0 and 100. Isn't it?
try that:
function FadeObjectIn (int object) {
trnsp = 100;
while (trnsp > 0) {
SetObjectTransparency (object, trnsp);
trnsp -= 1;
Wait (1); }
}
notice that I got rid of the >= in the while loop and that I put simply a safety command trnps = 100; at the beginning of the function.. you could also simply use if conditions to check if trnsp is between 0 and 100...
Yes, now it works! Thank you very much! :)