User Tools

Site Tools


4rpl:commands:setunitwantsern

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
4rpl:commands:setunitwantsern [2024/06/13 14:49] Kalli4rpl:commands:setunitwantsern [2024/06/13 14:56] – [Workaround for SetUnitWantsErn(<-uid 0)] Kalli
Line 23: Line 23:
 <code 4rpl> <code 4rpl>
 # A unit that has an ERN slotted and receives the 4rpl command to "not want an ERN",  # 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  +# will not actually unequip the ERN. As a workaroundit is possible to destroy the unit  
-# and recreate it without the ERN. That's what this function is for. The function supposes  +# and recreate it without the ERN. That's what this function is for.
-# 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 GetUnitWantsErn not GetUnitErnState AND if
Line 34: Line 32:
 :freeErnFromUnit :freeErnFromUnit
 ->UID ->UID
-  <-UID getunittype <-UID getunitposition <-UID getunitsettings createunit dup ->newUID 999 constructunit+  <-UID getunitconstructingdata ev2 dup -1 eq if pop 999 endif ->buildResources 
 +  <-UID getunittype <-UID getunitposition <-UID getunitsettings createunit dup ->newUID <-buildResources constructunit 
 +  # Resources that are on the way to the old unit will be lost.
      
 # Enable/disable the settings that you don't need by commenting them out. # Enable/disable the settings that you don't need by commenting them out.
4rpl/commands/setunitwantsern.txt · Last modified: 2024/06/13 18:32 by Kalli