SOLVED!
The problem was that I should have used parenthesis "externaly" and curly brackets within, I think. Or at least I did that with sdousley's suggested solution and now it definately works.
Before it was giving an error message, "bad substitution", and eventually I noticed that difference with brackets and parenthesis, not that even crossed my mind that it may have anything to do with "bad substitution", but seemed logical and harmless, then I tried.
A final note:
another modification needed is removing the "location" part after the esetroot command, or else you'll get a redundance, part of the file address will appear twice in the variable. In my case, instead of getting something like:
/.kde/share/wallpapers/landscapes/1.jpg
I'd get:
/.kde/share/wallpapers//.kde/share/wallpapers/landscapes/1.jpg
Or something like that.
The odd thing is that when I first edited to fix only the bracket issue, it worked anyway, despite of that, somehow... but after I restarted fluxbox, no wallpaper appeared, and I tested the script through a terminal, where the problem became evident.
Summarizing, the last line should be:
Esetroot -fit ${background[$((RANDOM%num_background))]} 