Skip to content
User Avatar
#3818
Auto-translated
}{0TT@6bI4
Let me start by pointing out a definite error. When you assign the return value of the GetObjectPosition function to creature_positions[k], that element becomes a number instead of a table with three elements. Therefore, you need to do this again: creature_positions[k][1], creature_positions[k][2], creature_positions[k][3] = GetObjectPosition(monster)
And in the IsTilePassable check, you should first save the corresponding elements of the table into local x, y, and z, and then pass them to IsTilePassable.
And this is precisely why you're getting the "attempt to index a number" error. Because creature[k] is just a number.

This one didn't work, but your previous version did!) However, I had to make some more adjustments, as IsTilePassable was complaining about an incorrect 3rd argument. In general, everything works, but the existing spawn points are selected strictly from the list, not randomly, which is quite disappointing. How can I randomize this without breaking anything?

 

Another question. I have a check for luck (GetHeroStat(hero, STAT_LUCK)), and I noticed in the console that even if I set a hero's luck to 10, it will only display up to 5. So, if I put a condition in the script that luck must be greater than 6, will that condition always be false?