Squirrel/Server/Functions/Effects/CreateFire

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
 
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|CreateFire}}
This function creates an scripted fire at the given coordinates.
+
This function creates a scripted fire at the given coordinates.
  
 
== Syntax ==
 
== Syntax ==
Line 14: Line 14:
  
 
== Example ==
 
== Example ==
 +
 +
This will create a fire with a radius of 5.0 10 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 == "fire" )
+
    if ( cmd == "fire" )
{
+
    {
local pos = player.Pos;
+
          local pos = player.Pos;
CreateFire( Vector( pos.x + 5, pos.y, pos.z ), 5.00 );
+
          CreateFire( pos.x + 10.0, pos.y, pos.z, 5.0 );
}
+
    }
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
 
This will create a fire 5 x co-ordinates away from the player with a radius of 5.00.
 
  
 
=== 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}}

Latest revision as of 04:14, 25 September 2010

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

This function creates a scripted fire at the given coordinates.

[edit] Syntax

  1. bool CreateFire( Vector vPos, float fRadius )
  1. bool CreateFire( float x, float y, float z, float fRadius )

[edit] Arguments

  • vPos - The position of the script fire as a vector
  • x, y, z - The coordinates of the fire as separate float values
  • fRadius - The radius of the fire

[edit] Example

This will create a fire with a radius of 5.0 10 x co-ordinate units away from the player.

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

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox