Scripting/Squirrel/Functions/Object.SetAlpha: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary |
|||
Line 14: | Line 14: | ||
This example will create a object and you can toggle visible it by commands given below. | This example will create a object and you can toggle visible it by commands given below. | ||
< | <source lang=squirrel> | ||
function onScriptLoad() | |||
{ | { | ||
myObject <- CreateObject( 334, 1, Vector( -2261.12, 753.12, 211.123 ),255 ); | myObject <- CreateObject( 334, 1, Vector( -2261.12, 753.12, 211.123 ),255 ); | ||
Line 32: | Line 33: | ||
} | } | ||
} | } | ||
</ | </source> | ||
=== Notes === | |||
Call [[onPlayerCommand]] and [[onScriptLoad]] were used in this example. More info about them in the corresponding pages. |
Revision as of 14:57, 9 March 2016
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.