abilities
struct info to Lua through luascript.cpp. Here's an example of how it's used (this is located in Player::blockHit)const int16_t& absorbPercent = it.abilities->absorbPercent[combatTypeToIndex(combatType)];
it
variable is the ItemType reference, .abilities
accesses the abilities
pointer and ->absorbPercent
accesses the array of absorb index -> percent values (the key is the combat type, as you can see it uses combatTypeToIndex).it.abilities
exists before using it, otherwise you'll crash) and return that value.There are no things I can't doYou cannot!
I immediately edited my post, but my original answer was for your question asking specifically Lua-only, by which it is impossible.There are no things I can't do
I immediately edited my post, but my original answer was for your question asking specifically Lua-only, by which it is impossible.
Maybe I should've rephrased again, it's impossible without doing stupid things / workarounds.You can read other files via lua. Making a script what will check for items.xml "if player" or ex. demon.xml if target is creature isn't something impossible. Also to reduce resource consumption it may work like a lib so it won't read over and over 1Mb+ file items.xml. It will load important parts only once and then script will read from memory.
Anyway scripting it via lua will take much more time then time I need to spend to learn how to make it via source edit. Also second method gives more experience.