User Tools

Site Tools


crpl:crpltutorial:interactive:advancedemitter

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
Last revisionBoth sides next revision
crpl:crpltutorial:interactive:advancedemitter [2015/03/20 10:12] – [Leaving stuff behind] Edited the example so it actually uses the defined variables TheDutchercrpl:crpltutorial:interactive:advancedemitter [2018/05/16 16:23] – Added Digitalis support section CatMan33
Line 1: Line 1:
-~~DISCUSSION:off~~ 
 <-[[cw3:creeper_world_3|CW3 Home]] <-[[crpl:start|CRPL Home]] <-[[crpl:crpltutorial:interactive|Interacive tutorials]]\\ <-[[cw3:creeper_world_3|CW3 Home]] <-[[crpl:start|CRPL Home]] <-[[crpl:crpltutorial:interactive|Interacive tutorials]]\\
 ====== Creating a custom emitter ====== ====== Creating a custom emitter ======
Line 24: Line 23:
  
 We want the script to be very portable, so instead of coding the values into the script, we'll use input variables. These will be Amt, Delay, AmtIncrease, AmtMax, DeathMode and DeathAmt. We want the script to be very portable, so instead of coding the values into the script, we'll use input variables. These will be Amt, Delay, AmtIncrease, AmtMax, DeathMode and DeathAmt.
-<hidden><code>$Amt:10+<hidden><code prpl>$Amt:10
 $Delay:15 $Delay:15
 $AmtIncrease:0.1 $AmtIncrease:0.1
Line 31: Line 30:
 $DeathAmt:"50"</code>Note that "DeathAmt" holds a string instead of a number, the game will convert these into integers at runtime when possible</hidden>\\ $DeathAmt:"50"</code>Note that "DeathAmt" holds a string instead of a number, the game will convert these into integers at runtime when possible</hidden>\\
 And as it is an emitter, simple code to make it emit Creeper. And as it is an emitter, simple code to make it emit Creeper.
-<code># Emit the saved amount of Creeper at the specified coordinates,+<code prpl># Emit the saved amount of Creeper at the specified coordinates,
 # but only emit so much so that the creeper level is at least as much as 'Amt', but no more # but only emit so much so that the creeper level is at least as much as 'Amt', but no more
 CurrentCoords <-Amt SetCreeperNoLower CurrentCoords <-Amt SetCreeperNoLower
Line 40: Line 39:
  
 You probably need a good popup text to make sure people think it's a normal emitter. Simply add these 2 lines and you're done. You probably need a good popup text to make sure people think it's a normal emitter. Simply add these 2 lines and you're done.
-<code>"Amt: " <-Amt concat "+<code prpl>"Amt: " <-Amt concat "
 " concat "Interval: " <-Delay 30.00 div 2 Round concat concat SetPopuptext</code> " concat "Interval: " <-Delay 30.00 div 2 Round concat concat SetPopuptext</code>
  
Line 51: Line 50:
 == Set PZ creation on death == == Set PZ creation on death ==
 If you would like to force a PZ to appear or perhaps not to appear, that is done easily with the following snippet:\\ If you would like to force a PZ to appear or perhaps not to appear, that is done easily with the following snippet:\\
-<code>Self CONST_CREATEPZ FALSE SetUnitAttribute</code>+<code prpl>Self CONST_CREATEPZ FALSE SetUnitAttribute</code>
 Explaining in-depth what it does:\\ Explaining in-depth what it does:\\
 __//self//__: Get the current unit (the emitter we're creating);\\ __//self//__: Get the current unit (the emitter we're creating);\\
Line 63: Line 62:
 This function is automatically called the moment the unit is destroyed.\\ This function is automatically called the moment the unit is destroyed.\\
 Since we declared a variable called DeathAmt, lets release that much creeper upon death! Since we declared a variable called DeathAmt, lets release that much creeper upon death!
-<code>:destroyed +<code prpl>:destroyed 
  CurrentCoords <-DeathAmt AddCreeper</code>  CurrentCoords <-DeathAmt AddCreeper</code>
 <note>Functions should always be at the end of your code. Read more about functions at [[crpl:crpltutorial#defining_your_own_functions|the CRPL tutorial]].</note> <note>Functions should always be at the end of your code. Read more about functions at [[crpl:crpltutorial#defining_your_own_functions|the CRPL tutorial]].</note>
 ==== Progressive output ==== ==== Progressive output ====
  
-=== Negative increment ===+== Negative increment == 
 + 
 +FIXME 
 +<hidden> What exactly is supposed to be put here? Progressive how? And why explain what a negative increment value would do? </hidden>
  
 ==== Digitalis support ==== ==== Digitalis support ====
 +Simply add this code to the file to add Digitalis support
 +<code>
 +if(CurrentCoords GetDigitalis eq0 CurrentCoords GetDigitalisGrowth 1 eq eq)
 + CurrentCoords 1 SetDigitalis
 +endif
 +</code>
 +If there is any DigitalisGrowth //(The white Digitalis-like stuff that shows where it will grow)// under the core, Digitalis will grow.
  
 ==== Phantom/slip emitter ==== ==== Phantom/slip emitter ====
  
 ==== Flip emitter ==== ==== Flip emitter ====
crpl/crpltutorial/interactive/advancedemitter.txt · Last modified: 2018/05/16 16:28 by CatMan33