This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| crpl:docs:setscriptvar [2014/01/13 09:38] – added variable names for Runner Nests in example section eduran | crpl:docs:setscriptvar [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ~~DISCUSSION~~ | + | ~~DISCUSSION:off~~ |
| <- [[crpl: | <- [[crpl: | ||
| ===== SetScriptVar | ===== SetScriptVar | ||
| Line 8: | Line 8: | ||
| === Description === | === Description === | ||
| - | Sets the named variable on the specified unit script to a value. | + | Sets the named variable on the specified unit script to a value. |
| + | |||
| + | Can also set the variables of built-in units like spore towers and emitters. | ||
| + | You can check the names of built-in variable for units on the [[crpl: | ||
| + | < | ||
| + | |||
| + | **Interval** values for Emitters, Inhibitors, Spore Towers, Runner Nests should be set as the number of frames, rather than seconds. For example, 2 second interval as shown in-game should be set as 60 frames. | ||
| + | |||
| + | This is what setting an Emitter with 32.5 power and 2.5 second interval would look like: | ||
| + | |||
| + | < | ||
| + | SetScriptVar(< | ||
| + | SetScriptVar(< | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | |||
| + | If you're procedurally generating a unit, and you want to give it a delay, you need to add the current time elapsed to it. | ||
| + | |||
| + | This is what setting a delay of 10 seconds would look like: | ||
| + | < | ||
| + | SetScriptVar(< | ||
| + | </ | ||
| + | |||
| - | Can also set the variables of built-in units like spore towers and emitters. | ||
| - | < | ||
| - | in the map editor dialog. There is room for 6 digits after the decimal. 1.0 in the dialog would | ||
| - | be 1000000 on the internal int. The values in the sample below correlate to 25.0 for the spore | ||
| - | payload and 0.8 for the emitter production amount.</ | ||
| === Examples === | === Examples === | ||
| + | |||
| < | < | ||
| @CreateBullet | @CreateBullet | ||
| : | : | ||
| - | " | + | CreateUnit(" |
| - | <-unit " | + | AddScriptToUnit(<-unit " |
| - | <-unit " | + | SetScriptVar(<-unit " |
| - | <-unit " | + | SetScriptVar(<-unit " |
| - | <-unit " | + | SetScriptVar(<-unit " |
| - | <-unit " | + | SetImage(<-unit " |
| - | <-unit " | + | SetImagePositionZ(<-unit " |
| - | <-unit " | + | SetImageRotation(<-unit " |
| </ | </ | ||
| < | < | ||
| - | SetScriptVar(< | + | SetScriptVar(< |
| - | SetScriptVar(< | + | SetScriptVar(< |
| SetScriptVar(< | SetScriptVar(< | ||
| SetScriptVar(< | SetScriptVar(< | ||
| Line 49: | Line 69: | ||
| SetScriptVar(< | SetScriptVar(< | ||
| SetScriptVar(< | SetScriptVar(< | ||
| + | |||
| + | < | ||
| + | CreateUnit(" | ||
| + | SetScriptVar(< | ||
| + | SetScriptVar(< | ||
| + | |||
| + | === List of vars === | ||
| + | |||
| + | Emitter | ||
| + | Script: 0 | ||
| + | | ||
| + | STARTTIME | ||
| + | Number of frames before emitter starts production. | ||
| + | FINISHTIME | ||
| + | Number of frames before emitter halts production. Defaults to 2147483647 (the maximum signed 32 bit integer). | ||
| + | PRODUCTIONINTERVAL | ||
| + | Number of frames between each creeper production. | ||
| + | PRODUCTIONAMT | ||
| + | The amount of creeper produced per production, multiplied by 1000000. | ||
| + | |||
| + | SporeTower | ||
| + | Script: 0 | ||
| + | | ||
| + | STARTTIME | ||
| + | The number of frames before the tower starts producing spores. | ||
| + | WAVEINTERVAL | ||
| + | The number of frames between each wave of spores. | ||
| + | WAVECOUNT | ||
| + | The number of spores in each wave. | ||
| + | SPOREPAYLOAD | ||
| + | The amount of creeper that each spores dumps on the map when it lands, multiplied by 1000000. | ||
| + | |||
| + | AETower | ||
| + | Script: 0 | ||
| + | | ||
| + | RANGE | ||
| + | The size of the exclusion zone. | ||
| + | |||
| + | RunnerNest | ||
| + | Script: 0 | ||
| + | | ||
| + | SPAWNINTERVAL | ||
| + | The number of frames between the production of each runner | ||
| + | MAXPOPULATION | ||
| + | The maximum number of runners produced by this nest on the map at any given time. | ||
| + | MOVESPEED | ||
| + | The movement speed in pixels per second of each runner. | ||
| + | RUNNERMAXHEALTH | ||
| + | The maximum health and starting health of each runner. | ||
| + | CREEPERPAYLOAD | ||
| + | The amount of creeper that each runner dumps to the map when it dies or is killed, multiplied by 1000000. | ||
| + | |||
| + | Inhibitor | ||
| + | Script: 0 | ||
| + | | ||
| + | STARTTIME | ||
| + | The number of frames before the inhibitor starts producing creeper. | ||
| + | PRODUCTIONINTERVAL | ||
| + | The number of frames between each production of creeper. | ||
| + | PRODUCTIONAMT | ||
| + | The amount of creeper produced. | ||
| + | RANGE | ||
| + | The range of the aerial exclusion zone. Set to 0 for none. | ||
| + | |||
| + | ResourcePack | ||
| + | Script: 0 | ||
| + | | ||
| + | AMT | ||
| + | The starting amount that the pack carries. Must be less than MAXAMT. | ||
| + | MAXAMT | ||
| + | The maximum amount that the pack carries. | ||
| + | RESOURCETYPE | ||
| + | The type of resource that the pack carries. Either ENERGY, ORE or AETHER. | ||
| + | |||
| + | Guppy Pad (added in 1.68) | ||
| + | Script: "" | ||
| + | | ||
| + | MODE | ||
| + | The type of cargo that the guppy ferries. Either PACKET, ORE or AC. | ||
| + | |||
| + | Artifact of Odin (AOO) | ||
| + | Script: 0 | ||
| + | | ||
| + | TYPE | ||
| + | The type of AoO. Either FREEZE, MASS or CONVERT. | ||
| + | | ||
| + | Tech Artifact (Added in 1.83) | ||
| + | | ||
| + | |||
| + | COUNT | ||
| + | The number of items the tech artifact should unlock. | ||