This is an old revision of the document!
⇐ Index
Available in version 2.5 and later.
SetUnitWantsERN(<-UID, <-wantsERN)
Sets whether the unit with the specified UID desires an ERN. Pass `true` to make the unit desire ERN, or `false` to indicate it does not.
# need worked example
# A unit that has an ERN slotted and receives the 4rpl command to "not want an ERN", will not actually unequip the ERN. As a workaround it is possible to destroy the unit and recreate it without the ERN. That's what this function is for. The function supposes that the unit that has to lose the ERN, is already constructed, which might not always be the case. <-uid GetUnitWantsErn not GetUnitErnState AND if <-uid @freeErnFromUnit endif :freeErnFromUnit ->UID <-UID getunittype <-UID getunitposition <-UID getunitsettings createunit dup ->newUID 999 constructunit # Enable/disable the settings that you don't need by commenting them out. <-newUID <-UID # dup2 getunitmaxammo setunitmaxammo dup2 getunitammo setunitammo dup2 getunitcandestroy setunitcandestroy dup2 getunitselectable setunitselectable dup2 getunitenabled setunitenabled dup2 getunitarmed setunitarmed dup2 getunitsupplied setunitsupplied # dup2 getunithealrate setunithealrate # dup2 getunitmaxhealth setunitmaxhealth dup2 getunithealth setunithealth # dup2 getunitrange setunitrange dup2 getunitstuncount setunitstuncount dup2 getunitmovecell dup -1 neq if setunitmovecell else pop pop pop pop endif pop pop <-UID 1 1 1 destroyunit
⇐ Index