My own E2 fader.
I programmed this for over two hours to make sure all the bugs were fixed.
To be honest I don't believe there is such an E2 programmed yet.
Anyways, here is what it does.
It makes an object slowly fade away and back. (Just watch the video.)
There are three versions of the E2.
The first one will make you able to walk through it when it's fading away and when it's hidden, but not when its fading back to normal or is solid.
Code:
@name Fader(By EmilHem)
@inputs EM:entity Activate
@outputs NoCollide
@persist Alpha Used Dir In Sel
interval(100)
if(duped() | first())
{
Activate=0
Used=0
NoCollide=0
In=0
Sel=1
EM:setAlpha(256)
}
if(Activate & !Used & (Sel==2))
{
NoCollide=1
timer("Timer",1)
Dir=1
Used=1
Sel=1
}
if(!Activate & !Used & (Sel==1))
{
NoCollide=0
timer("Timer",1)
Dir=2
Used=1
Sel=2
}
if(clk("Timer"))
{
if(Dir==1)
{
if(!In){Alpha=256 In=1}
EM:setAlpha(Alpha)
Alpha=Alpha-1
if(Alpha>0){timer("Timer",1)}
else{Used=0 Dir=0 In=0 EM:setAlpha(0)}
}
elseif(Dir==2)
{
if(!In){Alpha=0 In=1}
EM:setAlpha(Alpha)
Alpha=Alpha+1
if(Alpha<256){timer("Timer",1)}
else{Used=0 Dir=0 In=0 EM:setAlpha(256)}
}
} The second code can't be walked through except when the object is hidden.
Code:
@name Fader2(By: EmilHem)
@inputs EM:entity Activate
@outputs NoCollide
@persist Alpha Used Dir In Sel
interval(100)
if(duped() | first())
{
Activate=0
Used=0
NoCollide=0
In=0
Sel=1
EM:setAlpha(256)
}
if(Activate & !Used & (Sel==2))
{
timer("Timer",1)
Dir=1
Used=1
Sel=1
}
if(!Activate & !Used & (Sel==1))
{
NoCollide=0
timer("Timer",1)
Dir=2
Used=1
Sel=2
}
if(clk("Timer"))
{
if(Dir==1)
{
if(!In){Alpha=256 In=1}
EM:setAlpha(Alpha)
Alpha=Alpha-1
if(Alpha>0){timer("Timer",1)}
else{In=0 Used=0 Dir=0 NoCollide=1 EM:setAlpha(0)}
}
elseif(Dir==2)
{
if(!In){Alpha=0 In=1}
EM:setAlpha(Alpha)
Alpha=Alpha+1
if(Alpha<256){timer("Timer",1)}
else{In=0 Used=0 Dir=0 EM:setAlpha(256)}
}
} The third code can be walked through all the time except when it's solid.
Code:
@name Fader3(By: EmilHem)
@inputs EM:entity Activate
@outputs NoCollide
@persist Alpha Used Dir In Sel
interval(100)
if(duped() | first())
{
Activate=0
Used=0
NoCollide=0
In=0
Sel=1
EM:setAlpha(256)
}
if(Activate & !Used & (Sel==2))
{
timer("Timer",1)
Dir=1
Used=1
Sel=1
NoCollide=1
}
if(!Activate & !Used & (Sel==1))
{
NoCollide=1
timer("Timer",1)
Dir=2
Used=1
Sel=2
}
if(clk("Timer"))
{
if(Dir==1)
{
if(!In){Alpha=256 In=1}
EM:setAlpha(Alpha)
Alpha=Alpha-1
if(Alpha>0){timer("Timer",1)}
else{In=0 Used=0 Dir=0 EM:setAlpha(0)}
}
elseif(Dir==2)
{
if(!In){Alpha=0 In=1}
EM:setAlpha(Alpha)
Alpha=Alpha+1
if(Alpha<256){timer("Timer",1)}
else{In=0 Used=0 Dir=0 NoCollide=0 EM:setAlpha(256)}
}
} FacePunch Thread:
E2: Fader - Facepunch
Video:
YouTube - E2 Fader
You can download it here:
Bookmarks