Scripting/Squirrel/Functions/Object.SetAlpha
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
Syntax
Object.SetAlpha( int alpha, int fadeTime )
Arguments
> Object - The pickup instance.
- integer alpha - The alpha you want to set on object, 0 to 255.
- integer fadeTime - The fadeTime miliseconds, in how much time the alpha fully affect on object.
Example
This example will create a object and you can toggle visible it by commands given below.
function onScriptLoad()
{
myObject <- CreateObject( 334, 1, Vector( -2261.12, 753.12, 211.123 ),255 );
}
function onPlayerCommand(player, cmd, text)
{
if (cmd =="visible")
{
myObject.SetAlpha( 255, 2500); // in 2.5 secs it will be totally visible
MessagePlayer("The object is going to visible now",player);
}
else if (cmd =="invisible")
{
myObject.SetAlpha( 0, 2500);// in 2.5 secs it will be totally invisible
MessagePlayer("The object is going to invisible now",player);
}
}
Notes
Call onPlayerCommand and onScriptLoad were used in this example. More info about them in the corresponding pages.