# Set Unit State
Grammar — Turn unit state state value|On/Off
Flags —Native
|Action
Sets a unit’s state.
# Arguments
unit
— Unitint
[ preset::unitState2 ] — Statebool
[ preset::OnOffOption ] — Value
Returns — void
native void UnitSetState(
unit inUnit,
int inState,
bool inVal,
);
# Related
Category: Unit / Properties
- [F] —
string
[ gamelink::Unit ] — Unit Type Of Unit — ( UnitGetType ) - [F] —
int
— Unit Tag — ( UnitGetTag ) - [F] —
int
— Unit Seed — ( UnitGetSeed ) - [F] —
void
— Unit Property Changes — ( TriggerAddEventUnitProperty ) - [F] —
int
[ preset::Unit_Property ] — Triggering Unit Property — ( EventUnitProperty ) - [F] —
int
— Triggering Unit Property Change (Integer) — ( EventUnitPropertyChangeInt ) - [F] —
fixed
— Triggering Unit Property Change (Real) — ( EventUnitPropertyChangeFixed ) - [F] —
void
— Set Unit Property — ( UnitSetPropertyFixed ) - [F] —
void
— Set Unit State — ( UnitSetState ) - [F] —
void
— Set Unit Seed — ( UnitSetSeed ) - [F] —
void
— Reset Unit Seed — ( UnitResetSeed ) - [F] —
void
— Make Unit Invulnerable — ( libNtve_gf_MakeUnitInvulnerable ) - [F] —
void
— Make Unit Uncommandable — ( libNtve_gf_MakeUnitUncommandable ) - [F] —
fixed
— Unit Property — ( UnitGetPropertyFixed ) - [F] —
int
— Unit Property (Int) — ( UnitGetPropertyInt ) - [F] —
fixed
— Unit Type Property — ( UnitTypeGetProperty ) - [F] —
bool
— Unit Classification Check — ( UnitTestState ) - [F] —
bool
— Unit Type Classification Check — ( UnitTypeTestFlag ) - [F] —
bool
— Unit Type Attribute Check — ( UnitTypeTestAttribute ) - [F] —
bool
— Unit Targetable Check — ( UnitTestPlane ) - [F] —
bool
— Unit Is Invulnerable — ( libNtve_gf_UnitIsInvulnerable ) - [F] —
int
— Unit Kills — ( libNtve_gf_UnitGetPropertyKills ) - [F] —
int
— Unit Resources — ( libNtve_gf_UnitGetPropertyResources ) - [F] —
point
— Unit Attachment Point — ( UnitGetAttachmentPoint ) - [F] —
text
— Name Of Unit Type — ( UnitTypeGetName ) - [F] —
string
— Gender Code Of Unit Type — ( UnitTypeGetGenderCode ) - [F] —
int
— Unit Type Cost — ( UnitTypeGetCost ) - [F] —
bool
— Unit Type Is Affected By Upgrade — ( UnitTypeIsAffectedByUpgrade ) - [F] —
void
— Reset Movement Speed — ( UnitResetSpeed ) - [F] —
bool
— Unit Uses Mover — ( UnitMoverExists ) - [F] —
bool
— Unit Type Uses Mover — ( libNtve_gf_UnitMoverExists ) - [F] —
string
[ gamelink::Unit ] — Unit Type From String — ( UnitTypeFromString ) - [F] —
void
— Set Unit Color — ( UnitSetTeamColorIndex ) - [F] —
void
— Set Unit Info Button - Ability Tooltip — ( libNtve_gf_SetUnitInfoButtonAbilityTooltip ) - [F] —
void
— Set Unit Info Button - Button Tooltip — ( libNtve_gf_SetUnitInfoButtonButtonTooltip ) - [F] —
void
— Set Unit Info Button - Item Tooltip — ( libNtve_gf_SetUnitInfoButtonItemTooltip ) - [F] —
void
— Reset Unit Info Button - Ability Tooltip — ( libNtve_gf_ResetUnitInfoButtonAbilityTooltip ) - [F] —
void
— Reset Unit Info Button - Button Tooltip — ( libNtve_gf_ResetUnitInfoButtonButtonTooltip ) - [F] —
void
— Reset Unit Info Button - Item Tooltip — ( libNtve_gf_ResetUnitInfoButtonItemTooltip ) - [F] —
void
— Set Unit Command Button Tooltip — ( UnitSetInfoButtonTooltip ) - [F] —
void
— Reset Unit Command Button Tooltip — ( UnitClearInfoButtonTooltip ) - [F] —
void
— Set Unit Highlight Cursor — ( UnitSetCursor ) - [F] —
void
— Set Unit Ping Cursor — ( UnitSetPingCursor ) - [F] —
void
— Set Unit Info — ( UnitSetInfoText ) - [F] —
void
— Set Unit Info Text — ( UnitSetInfoText2 ) - [F] —
void
— Set Unit Info Tip — ( UnitSetInfoTip ) - [F] —
void
— Set Unit Info SubTip — ( UnitSetInfoSubTip ) - [F] —
void
— Clear Unit Info — ( UnitClearInfoText ) - [F] —
void
— Set Unit Status Bar State (Deprecated) — ( UnitForceStatusBar ) - [F] —
void
— Show Unit Status Bar — ( UnitStatusBarOverride ) - [F] —
void
— Hide Unit Status Bar — ( UnitStatusBarClearOverride ) - [F] —
void
— Set Unit Scale — ( UnitSetScale ) - [F] —
void
— Set Unit Model Variation — ( libNtve_gf_UnitSetVariation ) - [F] —
void
— Change Unit Height — ( UnitSetHeight ) - [F] —
fixed
— Height Of Unit — ( UnitGetHeight ) - [F] —
void
— Change Unit Damage — ( libNtve_gf_ChangeUnitDamage ) - [F] —
unit
— Add On Child — ( UnitAddOnChild ) - [F] —
unit
— Add On Parent — ( UnitAddOnParent )
# Examples
# campaigns/liberty.sc2campaign
// L2722
UnitSetState(lp_unit, c_unitStateHighlightable, false)
// L2723
UnitSetState(lp_unit, c_unitStateCursorable, false)
// L2724
UnitSetState(lp_unit, c_unitStateSelectable, false)
// L2725
UnitSetState(lp_unit, c_unitStateStatusBar, false)
// L2726
UnitSetState(lp_unit, c_unitStateTooltipable, false)
// L2727
UnitSetState(lp_unit, c_unitStateTargetable, false)
// L2897
UnitSetState(UnitLastCreated(), c_unitStateHighlightable, false)
// L2898
UnitSetState(UnitLastCreated(), c_unitStateCursorable, false)
// L2899
UnitSetState(UnitLastCreated(), c_unitStateSelectable, false)
// L2900
UnitSetState(UnitLastCreated(), c_unitStateStatusBar, false)
// L326
UnitSetState(UnitCargoLastCreated(), c_unitStateTargetable, true)
// L682
UnitSetState(UnitFromId(612), c_unitStateTargetable, false)
// L683
UnitSetState(UnitFromId(2010), c_unitStateTargetable, false)
// L684
UnitSetState(UnitFromId(397), c_unitStateTargetable, false)
// L1018
UnitSetState(UnitFromId(290), c_unitStateTargetable, false)
// L1325
UnitSetState(UnitLastCreated(), c_unitStateTargetable, true)
// L3819
UnitSetState(lv_unit, c_unitStateSelectable, false)
// L3820
UnitSetState(lv_unit, c_unitStateStatusBar, false)
// L3821
UnitSetState(lv_unit, c_unitStateTargetable, false)
// L3825
UnitSetState(lv_unit, c_unitStateSelectable, false)
// L641
UnitSetState(auto542B3ECA_var, c_unitStateTargetable, false)
// L648
UnitSetState(auto28CECA96_var, c_unitStateTargetable, false)
// L655
UnitSetState(autoD79C4196_var, c_unitStateTargetable, false)
// L662
UnitSetState(autoC2C6AB81_var, c_unitStateTargetable, false)
// L669
UnitSetState(auto1BA5B4A7_var, c_unitStateTargetable, false)
// L3202
UnitSetState(lv_colonistShip, c_unitStateCursorable, false)
// L3203
UnitSetState(lv_colonistShip, c_unitStateHighlightable, false)
// L3204
UnitSetState(lv_colonistShip, c_unitStateHighlighted, false)
// L3205
UnitSetState(lv_colonistShip, c_unitStateSelectable, false)
// L3206
UnitSetState(lv_colonistShip, c_unitStateTargetable, false)
// L364
UnitSetState(gv_infestationVirophageUnit[lp_colonyIndex], c_unitStateTooltipable, true)
// L1062
UnitSetState(auto8A971C58_var, c_unitStateTargetable, false)
// L1070
UnitSetState(auto38B5833A_var, c_unitStateTargetable, true)
// L1078
UnitSetState(auto97EF4C11_var, c_unitStateTargetable, true)
// L1086
UnitSetState(auto0B898AD1_var, c_unitStateTargetable, true)
// L1513
UnitSetState(EventUnitProgressUnit(), c_unitStateTooltipable, true)
// L1571
UnitSetState(EventUnitProgressUnit(), c_unitStateTooltipable, true)
// L1589
UnitSetState(lv_colonyStructure, c_unitStateTargetable, true)
// L3979
UnitSetState(UnitLastCreated(), c_unitStateSelectable, false)
// L4274
UnitSetState(UnitLastCreated(), c_unitStateSelectable, false)
// L786
UnitSetState(auto79C99746_var, c_unitStateTooltipable, true)
// L950
UnitSetState(auto4E88CFC0_var, c_unitStateTooltipable, true)
// L256
UnitSetState(lp_unit, c_unitStateTooltipable, true)
// L626
UnitSetState(autoA8826E3A_var, c_unitStateTooltipable, true)
// L452
UnitSetState(UnitFromId(109), c_unitStateCursorable, false)
// L453
UnitSetState(UnitFromId(109), c_unitStateHighlightable, false)
// L454
UnitSetState(UnitFromId(109), c_unitStateHighlighted, false)
// L455
UnitSetState(UnitFromId(109), c_unitStateSelectable, false)
// L456
UnitSetState(UnitFromId(109), c_unitStateStatusBar, false)
// L457
UnitSetState(UnitFromId(109), c_unitStateTargetable, false)
// L458
UnitSetState(UnitFromId(109), c_unitStateTooltipable, false)
// L949
UnitSetState(auto604BE6FC_var, c_unitStateHighlightable, false)
// L950
UnitSetState(auto604BE6FC_var, c_unitStateHighlighted, false)
// L951
UnitSetState(auto604BE6FC_var, c_unitStateTargetable, false)
// L952
UnitSetState(auto604BE6FC_var, c_unitStateSelectable, false)
// L2813
UnitSetState(lv_dropship, c_unitStateSelectable, true)
// L816
UnitSetState(autoC18DB74C_var, c_unitStateTooltipable, true)
// L890
UnitSetState(gv_warbot, c_unitStateFidget, false)
// L892
UnitSetState(gv_warbot, c_unitStateTargetable, false)
// L897
UnitSetState(UnitFromId(1488), c_unitStateSelectable, false)
// L898
UnitSetState(UnitFromId(1488), c_unitStateStatusBar, false)
// L899
UnitSetState(UnitFromId(1488), c_unitStateTargetable, false)
// L908
UnitSetState(UnitFromId(2658), c_unitStateSelectable, false)
// L909
UnitSetState(UnitFromId(2658), c_unitStateTargetable, false)
// L910
UnitSetState(UnitFromId(898), c_unitStateSelectable, false)
// L911
UnitSetState(UnitFromId(898), c_unitStateTargetable, false)
// L294
UnitSetState(lp_uNIT, c_unitStateSelectable, false)
// L295
UnitSetState(lp_uNIT, c_unitStateTargetable, false)
// L449
UnitSetState(UnitFromId(1726), c_unitStateTargetable, false)
// L461
UnitSetState(auto4BD2192F_var, c_unitStateTargetable, false)
// L462
UnitSetState(auto4BD2192F_var, c_unitStateSelectable, false)
// L469
UnitSetState(autoF0581A9B_var, c_unitStateTargetable, false)
// L470
UnitSetState(autoF0581A9B_var, c_unitStateSelectable, false)
// L550
UnitSetState(gv_holoboards[lv_iNT], c_unitStateTooltipable, true)
// L1825
UnitSetState(auto36165784_var, c_unitStateTooltipable, true)
// L4832
UnitSetState(lv_crosshairUnit, c_unitStateHidden, true)
// L249
UnitSetState(lp_chosenUnit, c_unitStateTooltipable, true)
// L253
UnitSetState(lp_chosenUnit, c_unitStateTooltipable, true)
// L257
UnitSetState(lp_chosenUnit, c_unitStateTooltipable, true)
// L261
UnitSetState(lp_chosenUnit, c_unitStateTooltipable, true)
// L265
UnitSetState(lp_chosenUnit, c_unitStateTooltipable, true)
// L269
UnitSetState(lp_chosenUnit, c_unitStateTooltipable, true)
// L273
UnitSetState(lp_chosenUnit, c_unitStateTooltipable, true)
// L277
UnitSetState(lp_chosenUnit, c_unitStateTooltipable, true)
// L282
UnitSetState(lp_chosenUnit, c_unitStateTooltipable, true)
// L291
UnitSetState(lp_chosenUnit, c_unitStateTooltipable, true)
// L633
UnitSetState(UnitFromId(258), c_unitStateTargetable, false)
// L637
UnitSetState(UnitFromId(795), c_unitStateTargetable, false)
// L638
UnitSetState(UnitFromId(796), c_unitStateTargetable, false)
// L640
UnitSetState(UnitFromId(788), c_unitStateTargetable, false)
// L1526
UnitSetState(UnitFromId(1167), c_unitStateSelectable, false)
// L1798
UnitSetState(auto2F23254E_var, c_unitStateTooltipable, true)
// L1806
UnitSetState(auto09F1738F_var, c_unitStateTooltipable, true)
// L1814
UnitSetState(auto4F0177E9_var, c_unitStateTooltipable, true)
// L1849
UnitSetState(EventUnitProgressUnit(), c_unitStateTooltipable, true)
// L1856
UnitSetState(EventUnitProgressUnit(), c_unitStateTooltipable, true)
// L2353
UnitSetState(lp_unit, c_unitStateHighlightable, true)
// L2354
UnitSetState(lp_unit, c_unitStateCursorable, true)
// L2360
UnitSetState(lp_unit, c_unitStateHighlightable, false)
// L2361
UnitSetState(lp_unit, c_unitStateCursorable, false)