Squirrel/Server/Functions/Effects/CreateExplosion

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|CreateExplosion}}
 
This function creates an explosion in the given coordinates.
 
This function creates an explosion in the given coordinates.
  
Line 14: Line 14:
  
 
== Example ==
 
== Example ==
 +
 +
 +
This will create a type-1 explosion 5 x co-ordinate units away from the player.
  
 
<code lang="squirrel">
 
<code lang="squirrel">
 
function onPlayerCommand( player, cmd, text )
 
function onPlayerCommand( player, cmd, text )
 
{
 
{
if ( cmd == "explosion" )
+
    if ( cmd == "explosion" )
{
+
    {
local pos = player.Pos;
+
          local pos = player.Pos;
CreateExplosion( Vector( pos.x + 5, pos.y, pos.z ), 1 );
+
          pos.x += 5.0;
}
+
         
 +
          CreateExplosion( pos, 1 );
 +
    }
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
 
This will create an explosion 5 x co-ordinates away from the player, the type will be type 1.
 
  
 
=== Notes ===
 
=== Notes ===
  
The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page.
+
The function [[Squirrel/Server/Functions/Players/Pos|Player.Pos]] and call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Effects}}
 
{{Squirrel/Server/Functions/Effects}}

Revision as of 04:11, 25 September 2010

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function creates an explosion in the given coordinates.

Syntax

  1. bool CreateExplosion( Vector vPos, int iExplosionType )
  1. bool CreateExplosion( float x, float y, float z, int iExplosionType )

Arguments

  • vPos - The position of the explosion as a vector
  • x, y, z - The coordinates of the wanted explosion as separate float values
  • iExplosionType - The explosion type

Example

This will create a type-1 explosion 5 x co-ordinate units away from the player.

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "explosion" )
  5. {
  6. local pos = player.Pos;
  7. pos.x += 5.0;
  8. CreateExplosion( pos, 1 );
  9. }
  10. return 1;
  11. }
  12.  

Notes

The function Player.Pos and call onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox