Page 1 of 1
Unimod fix> unitHP

Posted:
Fri Nov 07, 2014 12:32 pm
by Xandros
Re: Unimod fix> unitHP

Posted:
Fri Nov 07, 2014 4:18 pm
by illidans4
Nice fix! I've faced something similar, you can see what I've done in
UniModLib. The native functions reads more bytes then it should (I think 4 instead of 2), so binary AND can solve this. Also, I'd recommend using "local SYS_unitHP" instead of just "SYS_unitHP" declaration.
Re: Unimod fix> unitHP

Posted:
Sat Nov 08, 2014 12:39 am
by Xandros
Its not making any sense, because its declared in main scope
Re: Unimod fix> unitHP

Posted:
Sun Nov 09, 2014 2:14 pm
by illidans4
I don't understand, it doesn't matter where a function is declared, only where it is called. If you mean the "env", it's a way of accessing global environment (as UniMod does some tricks when accessing global environment for custom native functions). It shouldn't affect anything whether you put a function declaration in the main scope or in onFirstFrame, it will get called only once in both cases. In the main scope, all custom functions are already accessible.
Re: Unimod fix> unitHP

Posted:
Fri Nov 21, 2014 11:51 am
by Xandros
Code has been updated.
Re: Unimod fix> unitHP

Posted:
Fri Nov 21, 2014 1:51 pm
by illidans4
If you wrap it in "do ... end" and declare it like "local SYS_unitHP=unitHP", you'll also never lose the fix.
Re: Unimod fix> unitHP

Posted:
Fri Nov 21, 2014 3:41 pm
by Xandros
I forgot about one line. Now it can be wrapped 1000000 times and it will not break.