KnuckleCracker / CW4-bug-tracker

The gathering point for bugs and supporting information, or suggestions about additional features.
Creative Commons Attribution Share Alike 4.0 International
13 stars 2 forks source link

[4RPL] GetUnitPosition does not place any value on the stack if called on a non-existing unit #1046

Closed Karsten75 closed 2 years ago

Karsten75 commented 2 years ago

For units that does exist, GetUnitPosition returns a vector containing the position of the unit.

If the unit does not exist, then nothing is returned. This means that extraordinary care has to be taken to inspect the stack in the eventuality that the unit does not exist.

Recreate. On a map, place one unit (UID=1)

Run this code in the console:

    Trace (GetUnitPosition(1) )
    Trace (GetUnitPosition(7) )

Possible Console output is:

[34, 1, 46, 0]
WARNING: Taking item from an empty stack: TRACE at line 3
knucracker commented 2 years ago

The API now returns V3(0,0,0) when the unit does not exist