User Tools

Site Tools


4rpl:commands:createmist

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
4rpl:commands:createmist [2021/02/08 15:49] Regallion4rpl:commands:createmist [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ~~NOTOC~~ ~~NOTOC~~
-<=[[4rpl:start| Index]]+<=[[4rpl:start| Index]]\\ 
 +<= [[4rpl:start#Effects]]
  
 ====== CreateMist ====== ====== CreateMist ======
-CreateMist(<-pos <-color <-birthTime <-fadeTime <-lowerSpeed <-upperSpeed)+CreateMist(<-pos <-initParams)
  
 ===== Description ===== ===== Description =====
-Creates a mist at the specifid position. A mist is a small piece of 'fog'. The init params control its behavior.+Creates a mist at the specified position. A mist is a small piece of 'fog'. The init params control its behavior.
 The possible values in initTable are:\\ The possible values in initTable are:\\
   * "color" : The color of the mist. White is the default color. A Vector.   * "color" : The color of the mist. White is the default color. A Vector.
   * "color2" : If specified, the mist color will be randomly lerped from color to color2.   * "color2" : If specified, the mist color will be randomly lerped from color to color2.
-  * "birthTime" : The amount of time, in frames, that the mist will not fade. The mist's total lifetime is birthTime+fadeTime+  * "birthtime" : The amount of time, in frames, that the mist will not fade. The mist's total lifetime is birthtime+fadetime
-  * "fadeTime" : The amount of time, in frames, that the mist fades out. The mist's total lifetime is birthTime+fadeTime.+  * "fadetime" : The amount of time, in frames, that the mist fades out. The mist's total lifetime is birthtime+fadetime.
   * "direction" : The direction and speed that the mist moves. A Vector.   * "direction" : The direction and speed that the mist moves. A Vector.
   * "startradius" : The radius around the starting position that the mist is created. A random location is chosen with the radius. The direction is perpendicular to the plane that the starting point will be in.   * "startradius" : The radius around the starting position that the mist is created. A random location is chosen with the radius. The direction is perpendicular to the plane that the starting point will be in.
   * "endradius" : The radius around the 'ending' position that the mist is created. The ending position is at a distance based on the direction vector. The end is not related to the birth and fade time.   * "endradius" : The radius around the 'ending' position that the mist is created. The ending position is at a distance based on the direction vector. The end is not related to the birth and fade time.
 +
 +Each value in the color and color2 vectors is a floating point number where 1 is full brightness and 0 is minimal brightness. Values over 1 make the mist glow.
 +
 +:NOTE: There is a hidden hard cap for the amount of mist that can exist. When reached, no additional mist will be created.\\
 +Avoid calling this API every frame to avoid reaching this cap. Every 5 frames is far more reasonable.
 ===== Examples ===== ===== Examples =====
 <code 4rpl> <code 4rpl>
Line 27: Line 33:
 endif endif
 CreateMist(V3(10 1 10 ) <-initData) CreateMist(V3(10 1 10 ) <-initData)
 +</code>
 +
 +<code 4rpl>
 +once
 +   Table("color" V3(1 1 1)
 +         "birthtime" 0
 +         "fadetime" 20
 +         "direction" V3(0 1 0)
 +         "startradius" 0
 +         "endradius" 10 ) ->initData
 +   do(50 0)
 +      CreateMist(V3(10 1 10 ) <-initData)
 +   loop
 +endonce
 +
 +#This creates a ring-shaped burst of mist particles near the bottom-left corner of the map
 +#Since "direction" represents a vertical axis (in this case "up"), the ring will expand horizontally around said axis
 +#By swapping the "startradius" and "endradius" values, the ring will instead collapse inward
 +</code>
 +
 +<code 4rpl>
 +if(GetUnitUpdateCount 5 % eq0) #Ensure we don't make uneccessary mist.
 + CreateMist(GetUnitPosition(self) <-initData)
 +endif
 +
 +:Once
 + Table("color" V3(1 0.8 0.8)
 +    "color2" V3(0.2 0 0)
 +    "birthtime" 40
 +    "fadetime" 20
 +    "direction" V3(1 5 1.5)
 +    "startradius" 0.5
 +    "endradius" 1) ->initData
 +</code>
 +
 +==== Copy and paste preset: ====
 +<code 4rpl>
 +Table("color" V3(1 0.8 0.8)
 +    "color2" V3(0.2 0 0)
 +    "birthtime" 40
 +    "fadetime" 20
 +    "direction" V3(1 5 1.5)
 +    "startradius" 0.5
 +    "endradius" 1) ->initData
 </code> </code>
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]
  
4rpl/commands/createmist.1612799379.txt.gz · Last modified: 2025/02/14 14:56 (external edit)