Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Help plzz (https://forums.graalonline.com/forums/showthread.php?t=32655)

Legondary_MyTH 07-01-2002 08:58 AM

Help plzz
 
I have made a script that fades into the level kinda like dustari well it works except it keeps going????
plz help



//#CLIENTSIDE
for (fade.i=0; this.i<=.4; this.i-=.04;) {
seteffect .01,0,0,this.i;sleep .05;}

Falcor 07-01-2002 09:33 AM

fade.i=0 ? try this.i (this isn't the problem, just an error)

but your math is all wrong, what you are doing is saying this

this.i = 0
while(this.i <= .4) {
dostuf;
}
this.i-=.4
it will never stop since you keep subtracting, it will never be greater than .4
Since your this.i is always less than 0, not only will it not stop, but negitive valuse don't fair too well on the alpha.

maybe you should try reworking your math.

first, think of what you want to achive, you want to fade into the level, so you want to start your this.i at .4, since .4 would be the initial darkness of the level. Next, you wanna subtract from .4 untill you reach zero.

figure it out. I gave you some directions. try to do something with it (I wish not to fix your things for you, rather point out what you can do the help it)

Legondary_MyTH 07-01-2002 10:08 AM

thx
 
Thanks i just tried this i didnt know if i could d it but thanks for the help!

Legondary_MyTH 07-01-2002 10:13 AM

umm
 
Now it does what i want but backwards fades into dark....

Falcor 07-01-2002 10:36 AM

then reverse what you are doing?

Legondary_MyTH 07-01-2002 12:26 PM

umm
 
I just added a + where the - was IM SO CONFUSED

Falcor 07-01-2002 01:13 PM

Well something simple like this shouldn't require much thought. You wanna take a value (.4) and make it into 0 gradually. lets think now. How can we do this with the for operative? I know we can start out at .4 and then subtract .04 while it is greater than or equal to 0!!
for(this.i=.4;this.i>=0;this.i-=0.04)


now you have this.i moving down .04 every time it loops... figure out the rest.

Legondary_MyTH 07-01-2002 10:11 PM

YAY
 
Hey it worked and thanks for helping me


All times are GMT +2. The time now is 03:42 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.