~~NOTOC~~
<=[[4rpl:start| Index]]
* [[4rpl:commands:GetUnitSettings|Get]]
* [[4rpl:commands:SetUnitSettings|Set]]
:!: Available in version 1.3 and later.
====== GetUnitSettings ======
GetUnitSettings(<-unit) ->unitSettingsTable
===== Description =====
Returns a table containing the settings for the specified unit. For certain built-in units, like an emitter, the settings are described in the table below. For these units, the settings are case sensitive. For custom units, the values returned are all defined variables for all attached scripts. If there are multiple scripts, the variables are merged and duplicates will overwrite each other.
:!: In code versions before 4RPL V4 (Game version2.5.0 and higher), Calling GetUnitSettings (Or SetUnitSettings) on a custom unit that does not have a script attached throws an exception and causes the script to terminate at that line. If the unit has a script, it works normally, even if it's completely blank. As such, it would be a safe practice to attach a null script to every decorative unit on a map.
=====Built-in Unit Names and Settings=====
:!: Unit names are case sensitive. The full list of unit names are in [[Unit Types]]
? Start (int)
: The start delay, in frames, for when the emitter begins emitting. \\
? Interval (int)
: The emission interval, in frames.
? Payload (float)
: How much to emit at each emission.
* **"Start"** (int): The start delay, in frames. \\
* **"Interval"** (int): The fire interval, in frames. \\
* **"Payload"** (float): How much creeper is contained in each entity. \\
* **"Count"** (int): How many entities to create. \\
* **"Target"** (int): The target mode (0,1,2) for the created entities. 0 = Random, 1 = structures, 2 = location. \\
* **"TargetLocation"** (V2): The target location for the entity. Only used when Target is set to 2. \\
* **"DisableMiniMapWarn"**(bool): If the minimap should not be pinged prior to entity launch.
* **"EggStart"** (int): The start delay, in frames, for emitting eggs. \\
* **"EggInterval"** (int): The interval, in frames, for emitting eggs. \\
* **"EggCount"** (int): The count of eggs to emit per interval. \\
* **"EggDefenseRatio"** (float): The ratio of eggs that will be sent to other Creeper controlled structures. \\
* **"EggOnlyDuringCutoff"** (bool): If eggs should only be emitted when the creeper is cutoff because of the map creeper limit.
* **"Start"** (int): The start delay, in frames. \\
* **"Interval"** (int): The fire interval, in frames. \\
* **"Payload"** (float): How much creeper is contained in each entity. \\
* **"Count"** (int): How many entities to create. \\
* **"Target"** (int): The target mode (0,1,2) for the created entities. 0 = Random, 1 = structures, 2 = location. \\
* **"TargetLocation"** (V2): The target location for the entity. Only used when Target is set to 2. \\
* **"LifeTime"** (int): How long, in frames, the entity should live. \\
* **"DisableMiniMapWarn"**(bool): If the minimap should not be pinged prior to entity launch.
* **"CarryEggProbability"** (float): The probability (expressed as a float from 0 to 100) that the emitted blob will be able to carry eggs. \\
* **"Start"** (int): The start delay, in frames. \\
* **"Interval"** (int): The fire interval, in frames. \\
* **"Payload"** (float): How much creeper is contained in each entity. \\
* **"Count"** (int): How many entities to create. \\
* **"Target"** (int): The target mode (0,1,2) for the created entities. 0 = Random, 1 = structures, 2 = location. \\
* **"TargetLocation"** (V2): The target location for the entity. Only used when Target is set to 2. \\
* **"LifeTime"** (int): How long, in frames, the entity should live. \\
* **"DisableMiniMapWarn"**(bool): If the minimap should not be pinged prior to entity launch.
* **"ForbStart"** (int): The start delay, in frames, for emitting forbs. \\
* **"ForbInterval"** (int): The interval, in frames, for emitting forbs. \\
* **"ForbPayload"** (float): The amount of creeper each forb carries and puts in each orb that it throws. \\
* **"ForbCount"** (int): The max active count of forbs for this skimmer factory. \\
* **"Start"** (int): The start delay, in frames. \\
* **"Interval"** (int): The fire interval, in frames. \\
* **"Payload"** (float): How much creeper is contained in each entity. \\
* **"Count"** (int): How many entities to create. \\
* **"Target"** (int): The target mode (0,1,2) for the created entities. 0 = Random, 1 = structures, 2 = location. \\
* **"TargetLocation"** (V2): The target location for the entity. Only used when Target is set to 2. \\
* **"DisableMiniMapWarn"**(bool): If the minimap should not be pinged prior to entity launch.
* **"Target"** (int): The target mode (0,1,2) for the created entity. 0 = Random, 1 = structures, 2 = location. Note that for spores, this value only applies on unit creation. \\
* **"TargetLocation"** (V2): The target location for the entity. Only used when Target is set to 2. Note that for spores, this value only applies on unit creation. \\
* **"Payload"** (float): How much creeper is contained in this entity. \\
* **"Target"** (int): The target mode (0,1,2) for the created entity. 0 = Random, 1 = structures, 2 = location. \\
* **"TargetLocation"** (V2): The target location for the entity. Only used when Target is set to 2. \\
* **"Payload"** (float): How much creeper is contained in this entity. \\
* **"LifeTime"** (int): How long, in frames, the entity should live. \\
* **"CarryEgg"** (bool): Whether this blob can carry eggs. \\
* **"Target"** (int): The target mode (0,1,2) for the created entity. 0 = Random, 1 = structures, 2 = location. \\
* **"TargetLocation"** (V2): The target location for the entity. Only used when Target is set to 2. \\
* **"Payload"** (float): How much creeper is contained in this entity. \\
* **"LifeTime"** (int): How long, in frames, the entity should live. \\
* **"Target"** (int): The target mode (0,1,2) for the created entity. 0 = Random, 1 = structures, 2 = location. \\
* **"TargetLocation"** (V2): The target location for the entity. Only used when Target is set to 2. \\
* **"Payload"** (float): How much creeper is contained in this entity. \\
* **"Width"** (int): The width of the dark area. \\
* **"Depth"** (int): The depth of the dark area. \\
* **"Square"** (bool): If the dark area is a square, vs ellipse. \\
* **"Consume"** (bool): If the stash should remove creeper from the map. \\
* **"Size"** (float): The size (max creeper held) of the stash. \\
* **"CollectionRatio"** (float): Multiplier to creeper consumed by the stash. \\
* **"OfflineTime"** (int): How long, in frames, the stash is offline after emitting. \\
* **"UnsupportedTime"** (int): How long, in frames, the stash will wait before releasing its content when it is not in creeper. \\
* **"Interval"** (int):How long, in frames, between each resource production.
* **"Interval"** (int):How long, in frames, between each resource production.
* **"Interval"** (int):How long, in frames, between each resource production.
* **"Resource"** (int):A number (0 - 6) that represents the contained resource. 0 = energy, 1 = AC, 2 = ARG, 3 = Liftic, 4 = Bluite, 5 = Redon, 6 = Greenar
* **"Size"** (int): How much resource the Pod holds.
* **"CreeperDamages"** (bool): Whether creeper damages this pod.
* **"Impervious"** (bool): Whether blobs damage this pod.
* **"PlayerCanDestroy"** (bool): Whether a player can destroy this pod.
* **"Message"** (string): The ADA message to show.
* **"MessageType"** (bool): If false, then show message in ADA Log. If True, then show as a game message.
* **"MessageButton0"** (string): The string to show on message button 0.
* **"MessageButton1"** (string): The string to show on message button 1.
* **"MessageChannel"** (string): The channel name to send a message on when the message is closed (if type is GameMessage)
* **"Pause"** (bool): Whether to pause the game when the infocache is collected.
* **"YPos"** (float): Convenience settings that sets the Y position of the infocache.
:!: Available in version 1.4 and later.
* **"Strength"** (int): The health of the wall/crazonium. Initial strength of a wall is 900000.
* **"WareType"** (int): A number (0 - 3) that represents the contained resource. 0 = energy, 1 = AC, 2 = ARG, 3 = Liftic
* **"WareNum"** (int): The number of resources required to activate the totem.
===== Examples =====
GetUnitSettings(self) ->unitSettings
<=[[4rpl:start| Index]]