ADHS Posted October 24, 2022 Posted October 24, 2022 (edited) Hello. There is a LATE ACTIVATION group named 'MyGroup-1' with only one unit called 'MyGroup-1'. step-01. Activating the LATE ACTIVATION group, 'MyGroup-1': local group = Group.getByName('MyGroup-1') trigger.action.activateGroup(group) step-02. Destroying 'MyGroup-1' group: local myGroup = Group.getByName('MyGroup-1') Group.destroy(myGroup) step-03. Respawning 'MyGroup' with Mist: mist.respawnGroup('MyGroup-1', true) My problem is when: trying to set some conditions for the respawned UNIT 'MyGroup-1' such as: if Unit.getByName('MyGroup-1'):isAlive() if Unit.getByName('MyGroup-1'):isActive() if Unit.getByName('MyGroup-1'):inAir() == true i've got NIL errors after the group has been Mist respawned, but not before LATE ACTIVATION. Where am i doing wrong ? Thank you. Edited October 24, 2022 by ADHS Democracy was already invented, while Scrat was eating oak fruits.
toutenglisse Posted October 24, 2022 Posted October 24, 2022 @ADHS I'd say you maybe try to access to respawned Unit at the same time that it is respawned. If so, put a 1 second delay after respawn before checking with "if Unit.getBy...." 1
ADHS Posted October 24, 2022 Author Posted October 24, 2022 20 minutes ago, toutenglisse said: I'd say you maybe try to access to respawned Unit at the same time that it is respawned. Hello and thank you for your reply . Once you didn't find any error in the flow , i will try your directions. Thank you (always) Democracy was already invented, while Scrat was eating oak fruits.
ADHS Posted October 25, 2022 Author Posted October 25, 2022 (edited) On 10/25/2022 at 12:40 AM, toutenglisse said: before checking with "if Unit.getBy...." Thank you (once more), you are amazing man. You are helping us all here! Next time, before i start filling variables with vacum, i will start with a simple: IF UNIT then... PS: the *.*:isAlive() is not working with Units ? Was the only variable that wasn't accepted. Any alternatives to use it ? Thank you (always) Edited October 25, 2022 by ADHS Democracy was already invented, while Scrat was eating oak fruits.
cfrag Posted October 25, 2022 Posted October 25, 2022 7 hours ago, ADHS said: PS: the *.*:isAlive() is not working with Units ? I recommend you use Unit.isExist(someUnit) to ensure that the other accessors don’t abend. note that it’s important to use the ‚class‘ method ‚Unit‘, as someUnit may not exist (in other words: someUnit:isExist() can fail if someUnit doesn’t exist, while Unit.isExist(someUnit) is safe. 1 1
ADHS Posted October 26, 2022 Author Posted October 26, 2022 (edited) 7 hours ago, cfrag said: it’s important to use the ‚class‘ method ‚Unit‘, Hello and thank you very much for the xplanations and your time my friend. Yes, class function "Unit.*(someUnit)" check & assignement from now on. Thank you, thank you. I had never pay attention to UNITs before, but in this mission i forced to reconcider many ways and thinking. I thought that just with GROUP functions all was fine till stucked with LATE ACTIVATION that assumes a GROUP: ALIVE. So now, i have to re-code all of my functions. Edited October 26, 2022 by ADHS Democracy was already invented, while Scrat was eating oak fruits.
ADHS Posted October 26, 2022 Author Posted October 26, 2022 14 hours ago, cfrag said: note that it’s important to use the ‚class‘ method EVERYTHING WORKS FINE! Thank you Democracy was already invented, while Scrat was eating oak fruits.
Recommended Posts